Commit cd41cb9b authored by yangguo@chromium.org's avatar yangguo@chromium.org

Turn on parallel recompilation for tests that assert optimization status.

R=mvstanton@chromium.org
BUG=

Review URL: https://codereview.chromium.org/19807002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15793 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ce81b0d3
...@@ -8445,15 +8445,21 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimizeFunction) { ...@@ -8445,15 +8445,21 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimizeFunction) {
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_CompleteOptimization) { RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
HandleScope scope(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
if (!V8::UseCrankshaft()) {
return Smi::FromInt(4); // 4 == "never".
}
bool sync_with_compiler_thread = true;
if (args.length() == 2) {
CONVERT_ARG_HANDLE_CHECKED(String, sync, 1);
if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) {
sync_with_compiler_thread = false;
}
}
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
if (FLAG_parallel_recompilation && V8::UseCrankshaft()) { if (FLAG_parallel_recompilation && sync_with_compiler_thread) {
// While function is in optimization pipeline, it is marked accordingly.
// Note that if the debugger is activated during parallel recompilation,
// the function will be marked with the lazy-recompile builtin, which is
// not related to parallel recompilation.
while (function->IsMarkedForParallelRecompilation() || while (function->IsMarkedForParallelRecompilation() ||
function->IsInRecompileQueue() || function->IsInRecompileQueue() ||
function->IsMarkedForInstallingRecompiledCode()) { function->IsMarkedForInstallingRecompiledCode()) {
...@@ -8461,22 +8467,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompleteOptimization) { ...@@ -8461,22 +8467,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompleteOptimization) {
OS::Sleep(50); OS::Sleep(50);
} }
} }
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
HandleScope scope(isolate);
ASSERT(args.length() == 1);
if (!V8::UseCrankshaft()) {
return Smi::FromInt(4); // 4 == "never".
}
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
if (FLAG_parallel_recompilation) {
if (function->IsMarkedForLazyRecompilation()) {
return Smi::FromInt(5); // 5 == "parallel recompilation".
}
}
if (FLAG_always_opt) { if (FLAG_always_opt) {
// We may have always opt, but that is more best-effort than a real // We may have always opt, but that is more best-effort than a real
// promise, so we still say "no" if it is not optimized. // promise, so we still say "no" if it is not optimized.
......
...@@ -98,8 +98,7 @@ namespace internal { ...@@ -98,8 +98,7 @@ namespace internal {
F(IsParallelRecompilationSupported, 0, 1) \ F(IsParallelRecompilationSupported, 0, 1) \
F(OptimizeFunctionOnNextCall, -1, 1) \ F(OptimizeFunctionOnNextCall, -1, 1) \
F(NeverOptimizeFunction, 1, 1) \ F(NeverOptimizeFunction, 1, 1) \
F(CompleteOptimization, 1, 1) \ F(GetOptimizationStatus, -1, 1) \
F(GetOptimizationStatus, 1, 1) \
F(GetOptimizationCount, 1, 1) \ F(GetOptimizationCount, 1, 1) \
F(CompileForOnStackReplacement, 1, 1) \ F(CompileForOnStackReplacement, 1, 1) \
F(AllocateInNewSpace, 1, 1) \ F(AllocateInNewSpace, 1, 1) \
......
...@@ -362,9 +362,9 @@ if (support_smi_only_arrays) { ...@@ -362,9 +362,9 @@ if (support_smi_only_arrays) {
// No de-opt will occur because HCallNewArray wasn't selected, on account of // No de-opt will occur because HCallNewArray wasn't selected, on account of
// the call site not being monomorphic to Array. // the call site not being monomorphic to Array.
instanceof_check(Array); instanceof_check(Array);
assertTrue(2 != %GetOptimizationStatus(instanceof_check)); assertOptimized(instanceof_check);
instanceof_check(realmBArray); instanceof_check(realmBArray);
assertTrue(2 != %GetOptimizationStatus(instanceof_check)); assertOptimized(instanceof_check);
// Try to optimize again, but first clear all type feedback, and allow it // Try to optimize again, but first clear all type feedback, and allow it
// to be monomorphic on first call. Only after crankshafting do we introduce // to be monomorphic on first call. Only after crankshafting do we introduce
...@@ -375,8 +375,8 @@ if (support_smi_only_arrays) { ...@@ -375,8 +375,8 @@ if (support_smi_only_arrays) {
instanceof_check(Array); instanceof_check(Array);
%OptimizeFunctionOnNextCall(instanceof_check); %OptimizeFunctionOnNextCall(instanceof_check);
instanceof_check(Array); instanceof_check(Array);
assertTrue(2 != %GetOptimizationStatus(instanceof_check)); assertOptimized(instanceof_check);
instanceof_check(realmBArray); instanceof_check(realmBArray);
assertTrue(1 != %GetOptimizationStatus(instanceof_check)); assertUnoptimized(instanceof_check);
} }
...@@ -105,7 +105,7 @@ test_base(dictionary_map_array, 5, false); ...@@ -105,7 +105,7 @@ test_base(dictionary_map_array, 5, false);
test_base(dictionary_map_array, 6, false); test_base(dictionary_map_array, 6, false);
%OptimizeFunctionOnNextCall(test_base); %OptimizeFunctionOnNextCall(test_base);
test_base(dictionary_map_array, -2, true); test_base(dictionary_map_array, -2, true);
assertTrue(%GetOptimizationStatus(test_base) != 1); assertUnoptimized(test_base);
// Forget about the dictionary_map_array's map. // Forget about the dictionary_map_array's map.
%ClearFunctionTypeFeedback(test_base); %ClearFunctionTypeFeedback(test_base);
...@@ -116,7 +116,7 @@ test_base(a, 5, false); ...@@ -116,7 +116,7 @@ test_base(a, 5, false);
test_base(a, 6, false); test_base(a, 6, false);
%OptimizeFunctionOnNextCall(test_base); %OptimizeFunctionOnNextCall(test_base);
test_base(a, 2048, true); test_base(a, 2048, true);
assertTrue(%GetOptimizationStatus(test_base) != 1); assertUnoptimized(test_base);
function test_minus(base,cond) { function test_minus(base,cond) {
a[base - 1] = 1; a[base - 1] = 1;
...@@ -173,7 +173,7 @@ short_test(short_a, 50); ...@@ -173,7 +173,7 @@ short_test(short_a, 50);
%OptimizeFunctionOnNextCall(short_test); %OptimizeFunctionOnNextCall(short_test);
short_a.length = 10; short_a.length = 10;
short_test(short_a, 0); short_test(short_a, 0);
assertTrue(%GetOptimizationStatus(short_test) != 1); assertUnoptimized(test_base);
// A test for when we would modify a phi index. // A test for when we would modify a phi index.
......
...@@ -120,10 +120,10 @@ if (support_smi_only_arrays) { ...@@ -120,10 +120,10 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(bar0); %OptimizeFunctionOnNextCall(bar0);
b = bar0(Array); b = bar0(Array);
assertKind(elements_kind.fast_double, b); assertKind(elements_kind.fast_double, b);
assertTrue(2 != %GetOptimizationStatus(bar0)); assertOptimized(bar0);
// bar0 should deopt // bar0 should deopt
b = bar0(Object); b = bar0(Object);
assertTrue(1 != %GetOptimizationStatus(bar0)); assertUnoptimized(bar0)
// When it's re-optimized, we should call through the full stub // When it's re-optimized, we should call through the full stub
bar0(Array); bar0(Array);
%OptimizeFunctionOnNextCall(bar0); %OptimizeFunctionOnNextCall(bar0);
...@@ -131,7 +131,7 @@ if (support_smi_only_arrays) { ...@@ -131,7 +131,7 @@ if (support_smi_only_arrays) {
// We also lost our ability to record kind feedback, as the site // We also lost our ability to record kind feedback, as the site
// is megamorphic now. // is megamorphic now.
assertKind(elements_kind.fast_smi_only, b); assertKind(elements_kind.fast_smi_only, b);
assertTrue(2 != %GetOptimizationStatus(bar0)); assertOptimized(bar0);
b[0] = 3.5; b[0] = 3.5;
c = bar0(Array); c = bar0(Array);
assertKind(elements_kind.fast_smi_only, c); assertKind(elements_kind.fast_smi_only, c);
...@@ -151,15 +151,15 @@ if (support_smi_only_arrays) { ...@@ -151,15 +151,15 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(bar); %OptimizeFunctionOnNextCall(bar);
a = bar(10); a = bar(10);
assertKind(elements_kind.fast, a); assertKind(elements_kind.fast, a);
assertTrue(2 != %GetOptimizationStatus(bar)); assertOptimized(bar);
// The stub bails out, but the method call should be fine. // The stub bails out, but the method call should be fine.
a = bar(100000); a = bar(100000);
assertTrue(2 != %GetOptimizationStatus(bar)); assertOptimized(bar);
assertKind(elements_kind.dictionary, a); assertKind(elements_kind.dictionary, a);
// If the argument isn't a smi, it bails out as well // If the argument isn't a smi, it bails out as well
a = bar("oops"); a = bar("oops");
assertTrue(2 != %GetOptimizationStatus(bar)); assertOptimized(bar);
assertKind(elements_kind.fast, a); assertKind(elements_kind.fast, a);
function barn(one, two, three) { function barn(one, two, three) {
...@@ -170,11 +170,11 @@ if (support_smi_only_arrays) { ...@@ -170,11 +170,11 @@ if (support_smi_only_arrays) {
barn(1, 2, 3); barn(1, 2, 3);
%OptimizeFunctionOnNextCall(barn); %OptimizeFunctionOnNextCall(barn);
barn(1, 2, 3); barn(1, 2, 3);
assertTrue(2 != %GetOptimizationStatus(barn)); assertOptimized(barn);
a = barn(1, "oops", 3); a = barn(1, "oops", 3);
// The stub should bail out but the method should remain optimized. // The stub should bail out but the method should remain optimized.
assertKind(elements_kind.fast, a); assertKind(elements_kind.fast, a);
assertTrue(2 != %GetOptimizationStatus(barn)); assertOptimized(barn);
})(); })();
...@@ -191,12 +191,12 @@ if (support_smi_only_arrays) { ...@@ -191,12 +191,12 @@ if (support_smi_only_arrays) {
b = bar(); b = bar();
// This only makes sense to test if we allow crankshafting // This only makes sense to test if we allow crankshafting
if (4 != %GetOptimizationStatus(bar)) { if (4 != %GetOptimizationStatus(bar)) {
assertTrue(2 != %GetOptimizationStatus(bar)); assertOptimized(bar);
%DebugPrint(3); %DebugPrint(3);
b[0] = 3.5; b[0] = 3.5;
c = bar(); c = bar();
assertKind(elements_kind.fast_smi_only, c); assertKind(elements_kind.fast_smi_only, c);
assertTrue(2 != %GetOptimizationStatus(bar)); assertOptimized(bar);
} }
})(); })();
......
...@@ -192,7 +192,7 @@ if (support_smi_only_arrays) { ...@@ -192,7 +192,7 @@ if (support_smi_only_arrays) {
b[0] = 3.5; b[0] = 3.5;
c = create0(); c = create0();
assertKind(elements_kind.fast_double, c); assertKind(elements_kind.fast_double, c);
assertTrue(2 != %GetOptimizationStatus(create0)); assertOptimized(create0);
} }
})(); })();
......
...@@ -55,7 +55,7 @@ if (support_smi_only_arrays) { ...@@ -55,7 +55,7 @@ if (support_smi_only_arrays) {
get_literal(3); get_literal(3);
%OptimizeFunctionOnNextCall(get_literal); %OptimizeFunctionOnNextCall(get_literal);
a = get_literal(3); a = get_literal(3);
assertTrue(2 != %GetOptimizationStatus(get_literal)); assertOptimized(get_literal);
assertTrue(%HasFastSmiElements(a)); assertTrue(%HasFastSmiElements(a));
a[0] = 3.5; a[0] = 3.5;
...@@ -64,12 +64,12 @@ if (support_smi_only_arrays) { ...@@ -64,12 +64,12 @@ if (support_smi_only_arrays) {
b = get_literal(3); b = get_literal(3);
assertTrue(%HasFastDoubleElements(b)); assertTrue(%HasFastDoubleElements(b));
assertEquals([1, 2, 3], b); assertEquals([1, 2, 3], b);
assertTrue(1 != %GetOptimizationStatus(get_literal)); assertUnoptimized(get_literal);
// Optimize again // Optimize again
get_literal(3); get_literal(3);
%OptimizeFunctionOnNextCall(get_literal); %OptimizeFunctionOnNextCall(get_literal);
b = get_literal(3); b = get_literal(3);
assertTrue(%HasFastDoubleElements(b)); assertTrue(%HasFastDoubleElements(b));
assertTrue(2 != %GetOptimizationStatus(get_literal)); assertOptimized(get_literal);
} }
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --smi-only-arrays --expose-gc // Flags: --allow-natives-syntax --smi-only-arrays --expose-gc
// Flags: --noparallel-recompilation
// Test element kind of objects. // Test element kind of objects.
// Since --smi-only-arrays affects builtins, its default setting at compile // Since --smi-only-arrays affects builtins, its default setting at compile
...@@ -144,11 +143,11 @@ if (support_smi_only_arrays) { ...@@ -144,11 +143,11 @@ if (support_smi_only_arrays) {
deopt_array(false); deopt_array(false);
%OptimizeFunctionOnNextCall(deopt_array); %OptimizeFunctionOnNextCall(deopt_array);
var array = deopt_array(false); var array = deopt_array(false);
assertTrue(2 != %GetOptimizationStatus(deopt_array)); assertOptimized(deopt_array);
deopt_array(true); deopt_array(true);
assertTrue(2 != %GetOptimizationStatus(deopt_array)); assertOptimized(deopt_array);
array = deopt_array(false); array = deopt_array(false);
assertTrue(2 != %GetOptimizationStatus(deopt_array)); assertOptimized(deopt_array);
// Check that unexpected changes in the objects stored into the boilerplate // Check that unexpected changes in the objects stored into the boilerplate
// also force a deopt. // also force a deopt.
...@@ -166,13 +165,13 @@ if (support_smi_only_arrays) { ...@@ -166,13 +165,13 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(deopt_array_literal_all_smis); %OptimizeFunctionOnNextCall(deopt_array_literal_all_smis);
array = deopt_array_literal_all_smis(5); array = deopt_array_literal_all_smis(5);
array = deopt_array_literal_all_smis(6); array = deopt_array_literal_all_smis(6);
assertTrue(2 != %GetOptimizationStatus(deopt_array_literal_all_smis)); assertOptimized(deopt_array_literal_all_smis);
assertEquals(0, array[0]); assertEquals(0, array[0]);
assertEquals(1, array[1]); assertEquals(1, array[1]);
assertEquals(6, array[2]); assertEquals(6, array[2]);
array = deopt_array_literal_all_smis(.5); array = deopt_array_literal_all_smis(.5);
assertTrue(1 != %GetOptimizationStatus(deopt_array_literal_all_smis)); assertUnoptimized(deopt_array_literal_all_smis);
assertEquals(0, array[0]); assertEquals(0, array[0]);
assertEquals(1, array[1]); assertEquals(1, array[1]);
assertEquals(.5, array[2]); assertEquals(.5, array[2]);
...@@ -191,14 +190,14 @@ if (support_smi_only_arrays) { ...@@ -191,14 +190,14 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(deopt_array_literal_all_doubles); %OptimizeFunctionOnNextCall(deopt_array_literal_all_doubles);
array = deopt_array_literal_all_doubles(5); array = deopt_array_literal_all_doubles(5);
array = deopt_array_literal_all_doubles(6); array = deopt_array_literal_all_doubles(6);
assertTrue(2 != %GetOptimizationStatus(deopt_array_literal_all_doubles)); assertOptimized(deopt_array_literal_all_doubles);
assertEquals(0.5, array[0]); assertEquals(0.5, array[0]);
assertEquals(1, array[1]); assertEquals(1, array[1]);
assertEquals(6, array[2]); assertEquals(6, array[2]);
var foo = new Object(); var foo = new Object();
array = deopt_array_literal_all_doubles(foo); array = deopt_array_literal_all_doubles(foo);
assertTrue(1 != %GetOptimizationStatus(deopt_array_literal_all_doubles)); assertUnoptimized(deopt_array_literal_all_doubles);
assertEquals(0.5, array[0]); assertEquals(0.5, array[0]);
assertEquals(1, array[1]); assertEquals(1, array[1]);
assertEquals(foo, array[2]); assertEquals(foo, array[2]);
...@@ -207,6 +206,6 @@ if (support_smi_only_arrays) { ...@@ -207,6 +206,6 @@ if (support_smi_only_arrays) {
(function literals_after_osr() { (function literals_after_osr() {
var color = [0]; var color = [0];
// Trigger OSR. // Trigger OSR.
while (%GetOptimizationStatus(literals_after_osr) == 2) {} while (%GetOptimizationStatus(literals_after_osr, "no sync") == 2) {}
return [color[0]]; return [color[0]];
})(); })();
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --smi-only-arrays // Flags: --allow-natives-syntax --smi-only-arrays
// Flags: --noparallel-recompilation
// Flags: --notrack-allocation-sites // Flags: --notrack-allocation-sites
// Test element kind of objects. // Test element kind of objects.
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --noparallel-recompilation // Flags: --allow-natives-syntax
if (%IsParallelRecompilationSupported()) { if (%IsParallelRecompilationSupported()) {
print("Parallel recompilation is turned on after all. Skipping this test."); print("Parallel recompilation is turned on after all. Skipping this test.");
......
...@@ -33,10 +33,6 @@ if (!%IsParallelRecompilationSupported()) { ...@@ -33,10 +33,6 @@ if (!%IsParallelRecompilationSupported()) {
quit(); quit();
} }
function assertUnoptimized(fun) {
assertTrue(%GetOptimizationStatus(fun) != 1);
}
function f(foo) { return foo.bar(); } function f(foo) { return foo.bar(); }
var o = {}; var o = {};
...@@ -45,11 +41,14 @@ o.__proto__ = { __proto__: { bar: function() { return 1; } } }; ...@@ -45,11 +41,14 @@ o.__proto__ = { __proto__: { bar: function() { return 1; } } };
assertEquals(1, f(o)); assertEquals(1, f(o));
assertEquals(1, f(o)); assertEquals(1, f(o));
// Mark for parallel optimization.
%OptimizeFunctionOnNextCall(f, "parallel"); %OptimizeFunctionOnNextCall(f, "parallel");
assertEquals(1, f(o)); // Trigger optimization. // Trigger optimization in the parallel thread.
assertUnoptimized(f); // Optimization not yet done. assertEquals(1, f(o));
// While parallel recompilation is running, optimization not yet done.
assertUnoptimized(f, "no sync");
// Change the prototype chain during optimization to trigger map invalidation. // Change the prototype chain during optimization to trigger map invalidation.
o.__proto__.__proto__ = { bar: function() { return 2; } }; o.__proto__.__proto__ = { bar: function() { return 2; } };
%CompleteOptimization(f); // Conclude optimization with... // Optimization eventually bails out due to map dependency.
assertUnoptimized(f); // ... bailing out due to map dependency. assertUnoptimized(f, "sync");
assertEquals(2, f(o)); assertEquals(2, f(o));
...@@ -34,7 +34,7 @@ function test(f) { ...@@ -34,7 +34,7 @@ function test(f) {
%OptimizeFunctionOnNextCall(f); %OptimizeFunctionOnNextCall(f);
f(); f();
// Assert that there has been no deopt. // Assert that there has been no deopt.
assertTrue(%GetOptimizationStatus(f) != 2); assertOptimized(f);
} }
test(function add() { test(function add() {
......
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --count-based-interrupts --interrupt-budget=10 --weighted-back-edges // Flags: --count-based-interrupts --interrupt-budget=10 --weighted-back-edges
// Flags: --allow-natives-syntax --noparallel-recompilation // Flags: --allow-natives-syntax
// Test that OSR works properly when using count-based interrupting/profiling. // Test that OSR works properly when using count-based interrupting/profiling.
function osr_this() { function osr_this() {
var a = 1; var a = 1;
// Trigger OSR. // Trigger OSR.
while (%GetOptimizationStatus(osr_this) == 2) {} while (%GetOptimizationStatus(osr_this, "no sync") == 2) {}
return a; return a;
} }
assertEquals(1, osr_this()); assertEquals(1, osr_this());
...@@ -333,11 +333,10 @@ date.getTime(); ...@@ -333,11 +333,10 @@ date.getTime();
date.getTime(); date.getTime();
%OptimizeFunctionOnNextCall(Date.prototype.getTime); %OptimizeFunctionOnNextCall(Date.prototype.getTime);
assertThrows(function() { Date.prototype.getTime.call(""); }, TypeError); assertThrows(function() { Date.prototype.getTime.call(""); }, TypeError);
assertTrue(%GetOptimizationStatus(Date.prototype.getTime) != 1); assertUnoptimized(Date.prototype.getTime);
date.getYear(); date.getYear();
date.getYear(); date.getYear();
%OptimizeFunctionOnNextCall(Date.prototype.getYear); %OptimizeFunctionOnNextCall(Date.prototype.getYear);
assertThrows(function() { Date.prototype.getYear.call(""); }, TypeError); assertThrows(function() { Date.prototype.getYear.call(""); }, TypeError);
opt_status = %GetOptimizationStatus(Date.prototype.getYear); assertUnoptimized(Date.prototype.getYear);
assertTrue(%GetOptimizationStatus(Date.prototype.getTime) != 1);
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --allow-natives-syntax // Flags: --expose-debug-as debug --allow-natives-syntax
// Flags: --noparallel-recompilation
// This test tests that deoptimization due to debug breaks works for // This test tests that deoptimization due to debug breaks works for
// inlined functions where the full-code is generated before the // inlined functions where the full-code is generated before the
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --expose-gc --noparallel-recompilation // Flags: --expose-debug-as debug --expose-gc --send-idle-notification
// Flags: --send-idle-notification
// Get the Debug object exposed from the debug context global object. // Get the Debug object exposed from the debug context global object.
Debug = debug.Debug; Debug = debug.Debug;
......
...@@ -27,17 +27,6 @@ ...@@ -27,17 +27,6 @@
// Flags: --allow-natives-syntax --expose-gc // Flags: --allow-natives-syntax --expose-gc
/**
* The possible optimization states of a function. Must be in sync with the
* return values of Runtime_GetOptimizationStatus() in runtime.cc!
*/
var OptimizationState = {
YES: 1,
NO: 2,
ALWAYS: 3,
NEVER: 4
};
function mul (a, b) { function mul (a, b) {
return a * b; return a * b;
} }
...@@ -50,7 +39,5 @@ mul(0, -1); ...@@ -50,7 +39,5 @@ mul(0, -1);
%OptimizeFunctionOnNextCall(mul); %OptimizeFunctionOnNextCall(mul);
mul(0, -1); mul(0, -1);
var raw_optimized = %GetOptimizationStatus(mul); assertOptimized(mul);
assertFalse(raw_optimized == OptimizationState.NO);
gc(); gc();
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --smi-only-arrays --noparallel-recompilation // Flags: --allow-natives-syntax --smi-only-arrays --notrack-allocation-sites
// Flags: --notrack-allocation-sites
// No tracking of allocation sites because it interfers with the semantics // No tracking of allocation sites because it interfers with the semantics
// the test is trying to ensure. // the test is trying to ensure.
...@@ -63,7 +62,7 @@ if (support_smi_only_arrays) { ...@@ -63,7 +62,7 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(testDoubleConversion4); %OptimizeFunctionOnNextCall(testDoubleConversion4);
testDoubleConversion4(new Array(5)); testDoubleConversion4(new Array(5));
testDoubleConversion4(new Array(5)); testDoubleConversion4(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testDoubleConversion4)); assertOptimized(testDoubleConversion4);
%ClearFunctionTypeFeedback(testDoubleConversion4); %ClearFunctionTypeFeedback(testDoubleConversion4);
// Make sure that non-element related map checks that are not preceded by // Make sure that non-element related map checks that are not preceded by
...@@ -89,7 +88,7 @@ if (support_smi_only_arrays) { ...@@ -89,7 +88,7 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(testExactMapHoisting); %OptimizeFunctionOnNextCall(testExactMapHoisting);
testExactMapHoisting(new Array(5)); testExactMapHoisting(new Array(5));
testExactMapHoisting(new Array(5)); testExactMapHoisting(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting)); assertOptimized(testExactMapHoisting);
%ClearFunctionTypeFeedback(testExactMapHoisting); %ClearFunctionTypeFeedback(testExactMapHoisting);
// Make sure that non-element related map checks do NOT get hoisted if they // Make sure that non-element related map checks do NOT get hoisted if they
...@@ -121,7 +120,7 @@ if (support_smi_only_arrays) { ...@@ -121,7 +120,7 @@ if (support_smi_only_arrays) {
testExactMapHoisting2(new Array(5)); testExactMapHoisting2(new Array(5));
testExactMapHoisting2(new Array(5)); testExactMapHoisting2(new Array(5));
// Temporarily disabled - see bug 2176. // Temporarily disabled - see bug 2176.
// assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting2)); // assertOptimized(testExactMapHoisting2);
%ClearFunctionTypeFeedback(testExactMapHoisting2); %ClearFunctionTypeFeedback(testExactMapHoisting2);
// Make sure that non-element related map checks do get hoisted if they use // Make sure that non-element related map checks do get hoisted if they use
...@@ -150,7 +149,7 @@ if (support_smi_only_arrays) { ...@@ -150,7 +149,7 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(testExactMapHoisting3); %OptimizeFunctionOnNextCall(testExactMapHoisting3);
testExactMapHoisting3(new Array(5)); testExactMapHoisting3(new Array(5));
testExactMapHoisting3(new Array(5)); testExactMapHoisting3(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testExactMapHoisting3)); assertOptimized(testExactMapHoisting3);
%ClearFunctionTypeFeedback(testExactMapHoisting3); %ClearFunctionTypeFeedback(testExactMapHoisting3);
function testDominatingTransitionHoisting1(a) { function testDominatingTransitionHoisting1(a) {
...@@ -177,7 +176,7 @@ if (support_smi_only_arrays) { ...@@ -177,7 +176,7 @@ if (support_smi_only_arrays) {
// TODO(verwaest) With current changes the elements transition gets hoisted // TODO(verwaest) With current changes the elements transition gets hoisted
// above the access, causing a deopt. We should update the type of access // above the access, causing a deopt. We should update the type of access
// rather than forbid hoisting the transition. // rather than forbid hoisting the transition.
assertTrue(2 != %GetOptimizationStatus(testDominatingTransitionHoisting1)); assertOptimized(testDominatingTransitionHoisting1);
%ClearFunctionTypeFeedback(testDominatingTransitionHoisting1); %ClearFunctionTypeFeedback(testDominatingTransitionHoisting1);
*/ */
...@@ -198,7 +197,7 @@ if (support_smi_only_arrays) { ...@@ -198,7 +197,7 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(testHoistingWithSideEffect); %OptimizeFunctionOnNextCall(testHoistingWithSideEffect);
testHoistingWithSideEffect(new Array(5)); testHoistingWithSideEffect(new Array(5));
testHoistingWithSideEffect(new Array(5)); testHoistingWithSideEffect(new Array(5));
assertTrue(2 != %GetOptimizationStatus(testHoistingWithSideEffect)); assertOptimized(testHoistingWithSideEffect);
%ClearFunctionTypeFeedback(testHoistingWithSideEffect); %ClearFunctionTypeFeedback(testHoistingWithSideEffect);
function testStraightLineDupeElinination(a,b,c,d,e,f) { function testStraightLineDupeElinination(a,b,c,d,e,f) {
...@@ -237,6 +236,6 @@ if (support_smi_only_arrays) { ...@@ -237,6 +236,6 @@ if (support_smi_only_arrays) {
%OptimizeFunctionOnNextCall(testStraightLineDupeElinination); %OptimizeFunctionOnNextCall(testStraightLineDupeElinination);
testStraightLineDupeElinination(new Array(5),0,0,0,0,0); testStraightLineDupeElinination(new Array(5),0,0,0,0,0);
testStraightLineDupeElinination(new Array(5),0,0,0,0,0); testStraightLineDupeElinination(new Array(5),0,0,0,0,0);
assertTrue(2 != %GetOptimizationStatus(testStraightLineDupeElinination)); assertOptimized(testStraightLineDupeElinination);
%ClearFunctionTypeFeedback(testStraightLineDupeElinination); %ClearFunctionTypeFeedback(testStraightLineDupeElinination);
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --harmony-scoping --allow-natives-syntax --noparallel-recompilation // Flags: --harmony-scoping --allow-natives-syntax
// TODO(ES6): properly activate extended mode // TODO(ES6): properly activate extended mode
"use strict"; "use strict";
...@@ -43,7 +43,7 @@ for (var i = 0; i < functions.length; ++i) { ...@@ -43,7 +43,7 @@ for (var i = 0; i < functions.length; ++i) {
} }
%OptimizeFunctionOnNextCall(func); %OptimizeFunctionOnNextCall(func);
func(12); func(12);
assertTrue(%GetOptimizationStatus(func) != 2); assertOptimized(func);
} }
function f1() { } function f1() { }
......
...@@ -33,14 +33,6 @@ if (!%IsParallelRecompilationSupported()) { ...@@ -33,14 +33,6 @@ if (!%IsParallelRecompilationSupported()) {
quit(); quit();
} }
function assertUnoptimized(fun) {
assertTrue(%GetOptimizationStatus(fun) != 1);
}
function assertOptimized(fun) {
assertTrue(%GetOptimizationStatus(fun) != 2);
}
function f(x) { function f(x) {
var xx = x * x; var xx = x * x;
var xxstr = xx.toString(); var xxstr = xx.toString();
...@@ -65,11 +57,8 @@ assertUnoptimized(g); ...@@ -65,11 +57,8 @@ assertUnoptimized(g);
%OptimizeFunctionOnNextCall(g, "parallel"); %OptimizeFunctionOnNextCall(g, "parallel");
f(g(2)); // Trigger optimization. f(g(2)); // Trigger optimization.
assertUnoptimized(f); // Not yet optimized. assertUnoptimized(f, "no sync"); // Not yet optimized while parallel thread
assertUnoptimized(g); assertUnoptimized(g, "no sync"); // is running.
%CompleteOptimization(f); // Wait till optimized code is installed.
%CompleteOptimization(g);
assertOptimized(f); // Optimized now. assertOptimized(f, "sync"); // Optimized once we sync with the parallel thread.
assertOptimized(g); assertOptimized(g, "sync");
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --nouse_inlining --noparallel-recompilation // Flags: --allow-natives-syntax --nouse_inlining
// Test for negative zero that doesn't need bail out // Test for negative zero that doesn't need bail out
...@@ -38,4 +38,4 @@ test_div_no_deopt_minus_zero(); ...@@ -38,4 +38,4 @@ test_div_no_deopt_minus_zero();
test_div_no_deopt_minus_zero(); test_div_no_deopt_minus_zero();
%OptimizeFunctionOnNextCall(test_div_no_deopt_minus_zero); %OptimizeFunctionOnNextCall(test_div_no_deopt_minus_zero);
test_div_no_deopt_minus_zero(); test_div_no_deopt_minus_zero();
assertTrue(2 != %GetOptimizationStatus(test_div_no_deopt_minus_zero)); assertOptimized(test_div_no_deopt_minus_zero);
...@@ -99,6 +99,14 @@ var assertInstanceof; ...@@ -99,6 +99,14 @@ var assertInstanceof;
// Assert that this code is never executed (i.e., always fails if executed). // Assert that this code is never executed (i.e., always fails if executed).
var assertUnreachable; var assertUnreachable;
// Assert that the function code is (not) optimized. If "no sync" is passed
// as second argument, we do not wait for the parallel optimization thread to
// finish when polling for optimization status.
// Only works with --allow-natives-syntax.
var assertOptimized;
var assertUnoptimized;
(function () { // Scope for utility functions. (function () { // Scope for utility functions.
function classOf(object) { function classOf(object) {
...@@ -353,5 +361,26 @@ var assertUnreachable; ...@@ -353,5 +361,26 @@ var assertUnreachable;
throw new MjsUnitAssertionError(message); throw new MjsUnitAssertionError(message);
}; };
var OptimizationStatus;
try {
OptimizationStatus =
new Function("fun", "sync", "return %GetOptimizationStatus(fun, sync);");
} catch (e) {
OptimizationStatus = function() {
throw new Error("natives syntax not allowed");
}
}
assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) {
if (sync_opt === undefined) sync_opt = "";
assertTrue(OptimizationStatus(fun, sync_opt) != 1, name_opt);
}
assertOptimized = function assertOptimized(fun, sync_opt, name_opt) {
if (sync_opt === undefined) sync_opt = "";
assertTrue(OptimizationStatus(fun, sync_opt) != 2, name_opt);
}
})(); })();
...@@ -37,10 +37,7 @@ if (%GetOptimizationStatus(o1) != 4) { ...@@ -37,10 +37,7 @@ if (%GetOptimizationStatus(o1) != 4) {
o1(); o1();
// Check that the given function was optimized. // Check that the given function was optimized.
var o1_status = %GetOptimizationStatus(o1); assertOptimized(o1);
assertTrue(o1_status == 1 // optimized
|| o1_status == 3 // optimized (always opt)
|| o1_status == 5); // lazy recompile requested
// Test the %NeverOptimizeFunction runtime call. // Test the %NeverOptimizeFunction runtime call.
%NeverOptimizeFunction(u1); %NeverOptimizeFunction(u1);
...@@ -61,6 +58,6 @@ if (%GetOptimizationStatus(o1) != 4) { ...@@ -61,6 +58,6 @@ if (%GetOptimizationStatus(o1) != 4) {
u2(); u2(); u2(); u2();
// 2 => not optimized. // 2 => not optimized.
assertTrue(%GetOptimizationStatus(u1) == 2); assertUnoptimized(u1);
assertFalse(%GetOptimizationStatus(u2) == 2); assertOptimized(u2);
} }
\ No newline at end of file
...@@ -26,17 +26,13 @@ ...@@ -26,17 +26,13 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax // Flags: --allow-natives-syntax
// Flags: --parallel-recompilation --parallel-recompilation-delay=50 // Flags: --parallel-recompilation --parallel-recompilation-delay=100
if (!%IsParallelRecompilationSupported()) { if (!%IsParallelRecompilationSupported()) {
print("Parallel recompilation is disabled. Skipping this test."); print("Parallel recompilation is disabled. Skipping this test.");
quit(); quit();
} }
function assertUnoptimized(fun) {
assertTrue(%GetOptimizationStatus(fun) != 1);
}
function f1(a, i) { function f1(a, i) {
return a[i] + 0.5; return a[i] + 0.5;
} }
...@@ -47,9 +43,12 @@ assertEquals(0.5, f1(arr, 0)); ...@@ -47,9 +43,12 @@ assertEquals(0.5, f1(arr, 0));
// Optimized code of f1 depends on initial object and array maps. // Optimized code of f1 depends on initial object and array maps.
%OptimizeFunctionOnNextCall(f1, "parallel"); %OptimizeFunctionOnNextCall(f1, "parallel");
// Trigger optimization in the background thread
assertEquals(0.5, f1(arr, 0)); assertEquals(0.5, f1(arr, 0));
assertUnoptimized(f1); // Not yet optimized.
Object.prototype[1] = 1.5; // Invalidate current initial object map. Object.prototype[1] = 1.5; // Invalidate current initial object map.
assertEquals(2, f1(arr, 1)); assertEquals(2, f1(arr, 1));
%CompleteOptimization(f1); // Conclude optimization with... // Not yet optimized while background thread is running.
assertUnoptimized(f1); // ... bailing out due to map dependency. assertUnoptimized(f1, "no sync");
// Sync with background thread to conclude optimization, which bails out
// due to map dependency.
assertUnoptimized(f1, "sync");
...@@ -26,17 +26,13 @@ ...@@ -26,17 +26,13 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --track-fields --track-double-fields --allow-natives-syntax // Flags: --track-fields --track-double-fields --allow-natives-syntax
// Flags: --parallel-recompilation --parallel-recompilation-delay=50 // Flags: --parallel-recompilation --parallel-recompilation-delay=100
if (!%IsParallelRecompilationSupported()) { if (!%IsParallelRecompilationSupported()) {
print("Parallel recompilation is disabled. Skipping this test."); print("Parallel recompilation is disabled. Skipping this test.");
quit(); quit();
} }
function assertUnoptimized(fun) {
assertTrue(%GetOptimizationStatus(fun) != 1);
}
function new_object() { function new_object() {
var o = {}; var o = {};
o.a = 1; o.a = 1;
...@@ -53,9 +49,9 @@ add_field(new_object()); ...@@ -53,9 +49,9 @@ add_field(new_object());
%OptimizeFunctionOnNextCall(add_field, "parallel"); %OptimizeFunctionOnNextCall(add_field, "parallel");
var o = new_object(); var o = new_object();
add_field(o); // Trigger optimization. // Trigger optimization in the background thread.
assertUnoptimized(add_field); // Not yet optimized. add_field(o);
o.c = 2.2; // Invalidate transition map. // Invalidate transition map while optimization is underway.
%CompleteOptimization(add_field); // Conclude optimization with... o.c = 2.2;
assertUnoptimized(add_field); // ... bailing out due to map dependency. // Sync with background thread to conclude optimization that bailed out.
assertUnoptimized(add_field, "sync");
...@@ -48,4 +48,4 @@ f(); ...@@ -48,4 +48,4 @@ f();
%OptimizeFunctionOnNextCall(g, "parallel"); %OptimizeFunctionOnNextCall(g, "parallel");
f(0); // g() is disabled for optimization on inlining attempt. f(0); // g() is disabled for optimization on inlining attempt.
// Attempt to optimize g() should not run into any assertion. // Attempt to optimize g() should not run into any assertion.
%CompleteOptimization(g); assertUnoptimized(g, "sync");
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --noparallel-recompilation // Flags: --allow-natives-syntax
// An exception thrown in a function optimized by on-stack replacement (OSR) // An exception thrown in a function optimized by on-stack replacement (OSR)
// should be able to construct a receiver from all optimized stack frames. // should be able to construct a receiver from all optimized stack frames.
...@@ -52,7 +52,7 @@ function h() { ...@@ -52,7 +52,7 @@ function h() {
g(); g();
} else { } else {
// Run for a bit as long as h is unoptimized. // Run for a bit as long as h is unoptimized.
while (%GetOptimizationStatus(h) == 2) { while (%GetOptimizationStatus(h, "no sync") == 2) {
for (var j = 0; j < 100; j++) g(); for (var j = 0; j < 100; j++) g();
} }
g(); g();
......
...@@ -35,7 +35,7 @@ mul(0, 0); ...@@ -35,7 +35,7 @@ mul(0, 0);
mul(0, 0); mul(0, 0);
%OptimizeFunctionOnNextCall(mul); %OptimizeFunctionOnNextCall(mul);
assertEquals(0, mul(0, -1)); assertEquals(0, mul(0, -1));
assertTrue(%GetOptimizationStatus(mul) != 2); assertOptimized(mul);
function div(x, y) { function div(x, y) {
return (x / y) | 0; return (x / y) | 0;
...@@ -45,4 +45,4 @@ div(4, 2); ...@@ -45,4 +45,4 @@ div(4, 2);
div(4, 2); div(4, 2);
%OptimizeFunctionOnNextCall(div); %OptimizeFunctionOnNextCall(div);
assertEquals(1, div(5, 3)); assertEquals(1, div(5, 3));
assertTrue(%GetOptimizationStatus(div) != 2); assertOptimized(div);
...@@ -64,5 +64,5 @@ test(); ...@@ -64,5 +64,5 @@ test();
// Second compilation should have noticed that LICM wasn't a good idea, and now // Second compilation should have noticed that LICM wasn't a good idea, and now
// function should no longer deopt when called. // function should no longer deopt when called.
test(); test();
assertTrue(2 != %GetOptimizationStatus(test)); assertOptimized(test);
...@@ -36,5 +36,4 @@ foo(); ...@@ -36,5 +36,4 @@ foo();
%OptimizeFunctionOnNextCall(foo); %OptimizeFunctionOnNextCall(foo);
foo(); foo();
// Function should be optimized now. assertOptimized(foo);
assertTrue(%GetOptimizationStatus(foo) != 2);
...@@ -27,18 +27,6 @@ ...@@ -27,18 +27,6 @@
// Flags: --allow-natives-syntax --expose-gc // Flags: --allow-natives-syntax --expose-gc
/**
* The possible optimization states of a function. Must be in sync with the
* return values of Runtime_GetOptimizationStatus() in runtime.cc!
*/
var OptimizationState = {
YES: 1,
NO: 2,
ALWAYS: 3,
NEVER: 4
};
function simple() { function simple() {
return simple_two_args(0, undefined); return simple_two_args(0, undefined);
} }
...@@ -53,7 +41,5 @@ simple(); ...@@ -53,7 +41,5 @@ simple();
simple(); simple();
%OptimizeFunctionOnNextCall(simple); %OptimizeFunctionOnNextCall(simple);
simple(); simple();
var raw_optimized = %GetOptimizationStatus(simple); assertOptimized(simple);
assertFalse(raw_optimized == OptimizationState.NO);
gc(); gc();
...@@ -37,5 +37,4 @@ f(); ...@@ -37,5 +37,4 @@ f();
f(); f();
%OptimizeFunctionOnNextCall(f); %OptimizeFunctionOnNextCall(f);
f(); f();
assertTrue(%GetOptimizationStatus(f) != 2); assertOptimized(f);
...@@ -54,4 +54,4 @@ callConstantFunctionOnPrototype(receiver); ...@@ -54,4 +54,4 @@ callConstantFunctionOnPrototype(receiver);
callConstantFunctionOnPrototype(receiver); callConstantFunctionOnPrototype(receiver);
// Make sure that the function is still optimized. // Make sure that the function is still optimized.
assertTrue(2 != %GetOptimizationStatus(callConstantFunctionOnPrototype)); assertOptimized(callConstantFunctionOnPrototype);
...@@ -38,7 +38,7 @@ function f() { ...@@ -38,7 +38,7 @@ function f() {
} }
f(); f();
assertTrue(%GetOptimizationStatus(f) != 2); assertOptimized(f);
function g() { function g() {
...@@ -70,5 +70,4 @@ function g() { ...@@ -70,5 +70,4 @@ function g() {
} }
g(); g();
assertTrue(%GetOptimizationStatus(g) != 2); assertOptimized(g);
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
function outer() { function outer() {
inner(1,2,3); inner(1,2,3);
// Trigger OSR. // Trigger OSR.
while (%GetOptimizationStatus(outer) == 2) {} while (%GetOptimizationStatus(outer, "no sync") == 2) {}
} }
outer(); outer();
......
...@@ -34,19 +34,21 @@ if (!%IsParallelRecompilationSupported()) { ...@@ -34,19 +34,21 @@ if (!%IsParallelRecompilationSupported()) {
quit(); quit();
} }
function assertUnoptimized(fun) {
assertTrue(%GetOptimizationStatus(fun) != 1);
}
function test(fun) { function test(fun) {
fun(); fun();
fun(); fun();
// Mark for parallel optimization.
%OptimizeFunctionOnNextCall(fun, "parallel"); %OptimizeFunctionOnNextCall(fun, "parallel");
fun(); // Trigger optimization in the background. //Trigger optimization in the background.
gc(); // Tenure cons string. fun();
assertUnoptimized(fun); // Compilation not complete yet. //Tenure cons string.
%CompleteOptimization(fun); // Compilation embeds tenured cons string. gc();
gc(); // Visit embedded cons string during mark compact. // In the mean time, parallel recompiling is not complete yet.
assertUnoptimized(fun, "no sync");
// Parallel recompilation eventually finishes and embeds tenured cons string.
assertOptimized(fun, "sync");
//Visit embedded cons string during mark compact.
gc();
} }
function f() { function f() {
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --allow-natives-syntax // Flags: --expose-debug-as debug --allow-natives-syntax
// Flags: --parallel-recompilation --parallel-recompilation-delay=300 // Flags: --parallel-recompilation --parallel-recompilation-delay=100
if (!%IsParallelRecompilationSupported()) { if (!%IsParallelRecompilationSupported()) {
print("Parallel recompilation is disabled. Skipping this test."); print("Parallel recompilation is disabled. Skipping this test.");
...@@ -62,7 +62,8 @@ f(); // Kick off parallel recompilation. ...@@ -62,7 +62,8 @@ f(); // Kick off parallel recompilation.
Debug.setListener(listener); // Activate debugger. Debug.setListener(listener); // Activate debugger.
Debug.setBreakPoint(f, 2, 0); // Force deopt. Debug.setBreakPoint(f, 2, 0); // Force deopt.
%CompleteOptimization(f); // Install optimized code. // Sync with parallel optimization thread. But no optimized code is installed.
assertUnoptimized(f, "sync");
f(); // Trigger break point. f(); // Trigger break point.
assertEquals(1, listened); assertEquals(1, listened);
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
// Test dictionary -> double elements -> dictionary elements round trip // Test dictionary -> double elements -> dictionary elements round trip
// Flags: --allow-natives-syntax --unbox-double-arrays --expose-gc // Flags: --allow-natives-syntax --unbox-double-arrays --expose-gc
// Flags: --noparallel-recompilation
var large_array_size = 100000; var large_array_size = 100000;
var approx_dict_to_elements_threshold = 70000; var approx_dict_to_elements_threshold = 70000;
...@@ -346,7 +345,7 @@ function testOneArrayType(allocator) { ...@@ -346,7 +345,7 @@ function testOneArrayType(allocator) {
-Infinity, -Infinity,
expected_array_value(7)); expected_array_value(7));
assertTrue(%GetOptimizationStatus(test_various_stores) != 2); assertOptimized(test_various_stores);
// Make sure that we haven't converted from fast double. // Make sure that we haven't converted from fast double.
assertTrue(%HasFastDoubleElements(large_array)); assertTrue(%HasFastDoubleElements(large_array));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment