Bug 1207827 - Fix ARM64 OOM bugs in Assembler::bind(). r=nbp
authorJakob Olesen <jolesen@mozilla.com>
Thu, 22 Oct 2015 15:06:38 -0700
changeset 304292 6d93ac9755f9f39d11c26d929f3b23b0490e367a
parent 304291 3aa6ee8288c0c2206499245a8a95531291426cb3
child 304293 eddc6be3bd52bf73404e742785856d90d5d92d66
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)
reviewersnbp
bugs1207827
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 1207827 - Fix ARM64 OOM bugs in Assembler::bind(). r=nbp
js/src/jit/arm64/Assembler-arm64.cpp
--- a/js/src/jit/arm64/Assembler-arm64.cpp
+++ b/js/src/jit/arm64/Assembler-arm64.cpp
@@ -216,17 +216,20 @@ Assembler::fImmPool32(ARMFPRegister dest
 {
     return fImmPool(dest, (uint8_t*)&value, vixl::LDR_s_lit);
 }
 
 void
 Assembler::bind(Label* label, BufferOffset targetOffset)
 {
     // Nothing has seen the label yet: just mark the location.
-    if (!label->used()) {
+    // If we've run out of memory, don't attempt to modify the buffer which may
+    // not be there. Just mark the label as bound to the (possibly bogus)
+    // targetOffset.
+    if (!label->used() || oom()) {
         label->bind(targetOffset.getOffset());
         return;
     }
 
     // Get the most recent instruction that used the label, as stored in the label.
     // This instruction is the head of an implicit linked list of label uses.
     uint32_t branchOffset = label->offset();
 
@@ -254,17 +257,19 @@ Assembler::bind(Label* label, BufferOffs
     // Bind the label, so that future uses may encode the offset immediately.
     label->bind(targetOffset.getOffset());
 }
 
 void
 Assembler::bind(RepatchLabel* label)
 {
     // Nothing has seen the label yet: just mark the location.
-    if (!label->used()) {
+    // If we've run out of memory, don't attempt to modify the buffer which may
+    // not be there. Just mark the label as bound to nextOffset().
+    if (!label->used() || oom()) {
         label->bind(nextOffset().getOffset());
         return;
     }
     int branchOffset = label->offset();
     Instruction* inst = getInstructionAt(BufferOffset(branchOffset));
     inst->SetImmPCOffsetTarget(inst + nextOffset().getOffset() - branchOffset);
 }