From 76f67de10669237303bf6fbf468260f83bcf3595 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 9 Oct 2014 12:17:12 -0400 Subject: [PATCH] Backed out changeset 61b3f3d9bffe (bug 1079826) for jit-test failures. --HG-- extra : rebase_source : e55e7c6fcf2f1f116175d33b0fe0f12f266b5f0d --- js/src/asmjs/AsmJSModule.cpp | 17 ++--------- js/src/asmjs/AsmJSModule.h | 5 ---- .../tests/asm.js/testTimeout7-nosignals.js | 29 ------------------- js/src/jit-test/tests/asm.js/testTimeout7.js | 18 ++++++++++-- 4 files changed, 18 insertions(+), 51 deletions(-) delete mode 100644 js/src/jit-test/tests/asm.js/testTimeout7-nosignals.js diff --git a/js/src/asmjs/AsmJSModule.cpp b/js/src/asmjs/AsmJSModule.cpp index 375aa2c9e68..eb6c077a8f1 100644 --- a/js/src/asmjs/AsmJSModule.cpp +++ b/js/src/asmjs/AsmJSModule.cpp @@ -81,7 +81,6 @@ AsmJSModule::AsmJSModule(ScriptSource *scriptSource, uint32_t srcStart, uint32_t dynamicallyLinked_(false), loadedFromCache_(false), profilingEnabled_(false), - interrupted_(false), codeIsProtected_(false) { mozilla::PodZero(&pod); @@ -96,8 +95,6 @@ AsmJSModule::AsmJSModule(ScriptSource *scriptSource, uint32_t srcStart, uint32_t AsmJSModule::~AsmJSModule() { - MOZ_ASSERT(!interrupted_); - scriptSource_->decref(); if (code_) { @@ -449,11 +446,8 @@ AsmJSReportOverRecursed() static bool AsmJSHandleExecutionInterrupt() { - AsmJSActivation *act = PerThreadData::innermostAsmJSActivation(); - act->module().setInterrupted(true); - bool ret = HandleExecutionInterrupt(act->cx()); - act->module().setInterrupted(false); - return ret; + JSContext *cx = PerThreadData::innermostAsmJSActivation()->cx(); + return HandleExecutionInterrupt(cx); } static int32_t @@ -1552,13 +1546,6 @@ AsmJSModule::clone(JSContext *cx, ScopedJSDeletePtr *moduleOut) con bool AsmJSModule::changeHeap(Handle newBuffer, JSContext *cx) { - // Content JS should not be able to run (and change heap) from within an - // interrupt callback, but in case it does, fail to change heap. Otherwise, - // the heap can change at every single instruction which would prevent - // future optimizations like heap-base hoisting. - if (interrupted_) - return false; - uint32_t heapLength = newBuffer->byteLength(); if (heapLength & pod.heapLengthMask_ || heapLength < pod.minHeapLength_) return false; diff --git a/js/src/asmjs/AsmJSModule.h b/js/src/asmjs/AsmJSModule.h index 280b3751b86..e256d416ee4 100644 --- a/js/src/asmjs/AsmJSModule.h +++ b/js/src/asmjs/AsmJSModule.h @@ -821,7 +821,6 @@ class AsmJSModule bool dynamicallyLinked_; bool loadedFromCache_; bool profilingEnabled_; - bool interrupted_; // This field is accessed concurrently when requesting an interrupt. // Access must be synchronized via the runtime's interrupt lock. @@ -1479,10 +1478,6 @@ class AsmJSModule return profilingEnabled_; } void setProfilingEnabled(bool enabled, JSContext *cx); - void setInterrupted(bool interrupted) { - MOZ_ASSERT(isDynamicallyLinked()); - interrupted_ = interrupted; - } // Additionally, these functions may only be called while holding the // runtime's interrupt lock. diff --git a/js/src/jit-test/tests/asm.js/testTimeout7-nosignals.js b/js/src/jit-test/tests/asm.js/testTimeout7-nosignals.js deleted file mode 100644 index c5fc0622101..00000000000 --- a/js/src/jit-test/tests/asm.js/testTimeout7-nosignals.js +++ /dev/null @@ -1,29 +0,0 @@ -// |jit-test| exitstatus: 6; -load(libdir + "asm.js"); - -// This test may iloop for valid reasons if not compiled with asm.js (namely, -// inlining may allow the heap load to be hoisted out of the loop). -if (!isAsmJSCompilationAvailable()) - quit(); - -setJitCompilerOption("signals.enable", 0); - -var byteLength = - Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'byteLength').get); - -var buf1 = new ArrayBuffer(BUF_CHANGE_MIN); -new Int32Array(buf1)[0] = 13; -var buf2 = new ArrayBuffer(BUF_CHANGE_MIN); -new Int32Array(buf2)[0] = 42; - -// Test changeHeap from interrupt (as if that could ever happen...) -var m = asmCompile('glob', 'ffis', 'b', USE_ASM + - `var I32=glob.Int32Array; var i32=new I32(b); - var len=glob.byteLength; - function changeHeap(b2) { if(len(b2) & 0xffffff || len(b2) <= 0xffffff) return false; i32=new I32(b2); b=b2; return true } - function f() {} - function loop(i) { i=i|0; while((i32[i>>2]|0) == 13) { f() } } - return {loop:loop, changeHeap:changeHeap}`); -var { loop, changeHeap } = asmLink(m, this, null, buf1); -timeout(1, function() { assertEq(changeHeap(buf2), false); return false }); -loop(0); diff --git a/js/src/jit-test/tests/asm.js/testTimeout7.js b/js/src/jit-test/tests/asm.js/testTimeout7.js index f84c9ae897e..aa7411def74 100644 --- a/js/src/jit-test/tests/asm.js/testTimeout7.js +++ b/js/src/jit-test/tests/asm.js/testTimeout7.js @@ -1,4 +1,3 @@ -// |jit-test| exitstatus: 6; load(libdir + "asm.js"); // This test may iloop for valid reasons if not compiled with asm.js (namely, @@ -23,5 +22,20 @@ var m = asmCompile('glob', 'ffis', 'b', USE_ASM + function loop(i) { i=i|0; while((i32[i>>2]|0) == 13) { f() } } return {loop:loop, changeHeap:changeHeap}`); var { loop, changeHeap } = asmLink(m, this, null, buf1); -timeout(1, function() { assertEq(changeHeap(buf2), false); return false }); +timeout(1, function() { changeHeap(buf2); return true }); loop(0); +timeout(-1); + +// Try again, but this time with signals disabled +setJitCompilerOption("signals.enable", 0); +var m = asmCompile('glob', 'ffis', 'b', USE_ASM + + `var I32=glob.Int32Array; var i32=new I32(b); + var len=glob.byteLength; + function changeHeap(b2) { if(len(b2) & 0xffffff || len(b2) <= 0xffffff) return false; i32=new I32(b2); b=b2; return true } + function f() {} + function loop(i) { i=i|0; while((i32[i>>2]|0) == 13) { f() } } + return {loop:loop, changeHeap:changeHeap}`); +var { loop, changeHeap } = asmLink(m, this, null, buf1); +timeout(1, function() { changeHeap(buf2); return true }); +loop(0); +timeout(-1);