Bug 1217606 - Handle OOM in Assembler::emitExtendedJumpTable(). r=sstangl
authorJakob Olesen <jolesen@mozilla.com>
Thu, 22 Oct 2015 16:06:44 -0700
changeset 304294 36e27dc524a4cf8f1404743c38b4ec5104982cb3
parent 304293 eddc6be3bd52bf73404e742785856d90d5d92d66
child 304295 06cf7b88a3e5480b2d59a1330031dab67913ccbe
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs1217606
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1217606 - Handle OOM in Assembler::emitExtendedJumpTable(). r=sstangl Assertions would trip if the assembler buffer runs out of memory midway through the jump table.
js/src/jit/arm64/Assembler-arm64.cpp
--- a/js/src/jit/arm64/Assembler-arm64.cpp
+++ b/js/src/jit/arm64/Assembler-arm64.cpp
@@ -119,26 +119,29 @@ Assembler::emitExtendedJumpTable()
         //   [Patchable 8-byte constant low bits]
         //   [Patchable 8-byte constant high bits]
         DebugOnly<size_t> preOffset = size_t(armbuffer_.nextOffset().getOffset());
 
         ldr(vixl::ip0, ptrdiff_t(8 / vixl::kInstructionSize));
         br(vixl::ip0);
 
         DebugOnly<size_t> prePointer = size_t(armbuffer_.nextOffset().getOffset());
-        MOZ_ASSERT(prePointer - preOffset == OffsetOfJumpTableEntryPointer);
+        MOZ_ASSERT_IF(!oom(), prePointer - preOffset == OffsetOfJumpTableEntryPointer);
 
         brk(0x0);
         brk(0x0);
 
         DebugOnly<size_t> postOffset = size_t(armbuffer_.nextOffset().getOffset());
 
-        MOZ_ASSERT(postOffset - preOffset == SizeOfJumpTableEntry);
+        MOZ_ASSERT_IF(!oom(), postOffset - preOffset == SizeOfJumpTableEntry);
     }
 
+    if (oom())
+        return BufferOffset();
+
     return tableOffset;
 }
 
 void
 Assembler::executableCopy(uint8_t* buffer)
 {
     // Copy the code and all constant pools into the output buffer.
     armbuffer_.executableCopy(buffer);