[test] Add %PrepareFunctionForOptimize in mjsunit tests
Bug: v8:8801, v8:8394, v8:9183 Change-Id: Ic31f97a1b591317a004dc52c8eee777dd6353487 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1662299 Commit-Queue: Mythri Alle <mythria@chromium.org> Commit-Queue: Ross McIlroy <rmcilroy@chromium.org> Auto-Submit: Mythri Alle <mythria@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Cr-Commit-Position: refs/heads/master@{#62216}
This commit is contained in:
parent
0c5479df6d
commit
9b77a149a6
@ -13,6 +13,7 @@
|
||||
f("abc", "de", 1);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", "de", {});
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", "de", {});
|
||||
assertOptimized(f);
|
||||
@ -27,6 +28,7 @@
|
||||
f("abc", "de", 1);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", {}, 1);
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", {}, 1);
|
||||
assertOptimized(f);
|
||||
@ -39,8 +41,10 @@
|
||||
%PrepareFunctionForOptimization(f);
|
||||
f("abc", "de", 1);
|
||||
f("abc", "de", 1);
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f({}, "de", 1);
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f({}, "de", 1);
|
||||
assertOptimized(f);
|
||||
@ -55,6 +59,7 @@
|
||||
f("abc", 1);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", {});
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f({}, {});
|
||||
assertOptimized(f);
|
||||
@ -69,6 +74,7 @@
|
||||
f("abc", 1);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", {});
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", {});
|
||||
assertOptimized(f);
|
||||
@ -84,6 +90,7 @@
|
||||
f("abc", 1);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", {});
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f("abc", {});
|
||||
assertOptimized(f);
|
||||
|
@ -168,10 +168,12 @@ assertEquals(2, a.BYTES_PER_ELEMENT);
|
||||
// Test Float64Arrays.
|
||||
function get(a, index) {
|
||||
return a[index];
|
||||
}
|
||||
};
|
||||
%PrepareFunctionForOptimization(get);
|
||||
function set(a, index, value) {
|
||||
a[index] = value;
|
||||
}
|
||||
};
|
||||
%PrepareFunctionForOptimization(set);
|
||||
function temp() {
|
||||
var array = new Float64Array(2);
|
||||
for (var i = 0; i < 5; i++) {
|
||||
@ -294,6 +296,7 @@ function test_store_nan(array, sum) {
|
||||
const kRuns = 10;
|
||||
|
||||
function run_test(test_func, array, expected_result) {
|
||||
%PrepareFunctionForOptimization(test_func);
|
||||
for (var i = 0; i < 5; i++) test_func(array, 0);
|
||||
%OptimizeFunctionOnNextCall(test_func);
|
||||
var sum = 0;
|
||||
@ -345,6 +348,7 @@ for (var t = 0; t < types.length; t++) {
|
||||
assertTrue(delete a.length);
|
||||
|
||||
// Make sure bounds checks are handled correctly for external arrays.
|
||||
%PrepareFunctionForOptimization(run_bounds_test);
|
||||
run_bounds_test(a);
|
||||
run_bounds_test(a);
|
||||
run_bounds_test(a);
|
||||
@ -365,6 +369,7 @@ for (var t = 0; t < types.length; t++) {
|
||||
return a[0] = a[0] = 1;
|
||||
}
|
||||
|
||||
%PrepareFunctionForOptimization(array_load_set_smi_check2);
|
||||
array_load_set_smi_check2(a);
|
||||
%OptimizeFunctionOnNextCall(array_load_set_smi_check2);
|
||||
array_load_set_smi_check2(a);
|
||||
@ -379,6 +384,7 @@ function store_float32_undefined(ext_array) {
|
||||
ext_array[0] = undefined;
|
||||
}
|
||||
|
||||
%PrepareFunctionForOptimization(store_float32_undefined);
|
||||
var float32_array = new Float32Array(1);
|
||||
// Make sure runtime does it right
|
||||
store_float32_undefined(float32_array);
|
||||
@ -395,6 +401,7 @@ function store_float64_undefined(ext_array) {
|
||||
ext_array[0] = undefined;
|
||||
}
|
||||
|
||||
%PrepareFunctionForOptimization(store_float64_undefined);
|
||||
var float64_array = new Float64Array(1);
|
||||
// Make sure runtime does it right
|
||||
store_float64_undefined(float64_array);
|
||||
@ -640,6 +647,8 @@ function boo(a, i, v) {
|
||||
|
||||
function do_tagged_index_external_array_test(constructor) {
|
||||
var t_array = new constructor([1, 2, 3, 4, 5, 6]);
|
||||
%PrepareFunctionForOptimization(goo);
|
||||
%PrepareFunctionForOptimization(boo);
|
||||
assertEquals(1, goo(t_array, 0));
|
||||
assertEquals(1, goo(t_array, 0));
|
||||
boo(t_array, 0, 13);
|
||||
@ -662,6 +671,8 @@ do_tagged_index_external_array_test(Float32Array);
|
||||
do_tagged_index_external_array_test(Float64Array);
|
||||
|
||||
var built_in_array = new Array(1, 2, 3, 4, 5, 6);
|
||||
%PrepareFunctionForOptimization(goo);
|
||||
%PrepareFunctionForOptimization(boo);
|
||||
assertEquals(1, goo(built_in_array, 0));
|
||||
assertEquals(1, goo(built_in_array, 0));
|
||||
%OptimizeFunctionOnNextCall(goo);
|
||||
@ -672,6 +683,8 @@ assertEquals(11, goo(built_in_array, 0));
|
||||
%ClearFunctionFeedback(boo);
|
||||
|
||||
built_in_array = new Array(1.5, 2, 3, 4, 5, 6);
|
||||
%PrepareFunctionForOptimization(goo);
|
||||
%PrepareFunctionForOptimization(boo);
|
||||
assertEquals(1.5, goo(built_in_array, 0));
|
||||
assertEquals(1.5, goo(built_in_array, 0));
|
||||
%OptimizeFunctionOnNextCall(goo);
|
||||
|
@ -613,6 +613,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertOptimized(g);
|
||||
deopt = true;
|
||||
g();
|
||||
%PrepareFunctionForOptimization(g);
|
||||
assertOptimized(g);
|
||||
deopt = false;
|
||||
array = [11,'22',33,45,56,6,77,84,93,101];
|
||||
@ -644,6 +645,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertOptimized(g);
|
||||
deopt = true;
|
||||
g();
|
||||
%PrepareFunctionForOptimization(g);
|
||||
assertOptimized(g);
|
||||
deopt = false;
|
||||
array = [11,'22',33,45,56,6,77,84,93,101];
|
||||
@ -688,6 +690,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertOptimized(g);
|
||||
deopt = true;
|
||||
g();
|
||||
%PrepareFunctionForOptimization(g);
|
||||
assertOptimized(g);
|
||||
deopt = false;
|
||||
array = [11,'22',33,45,56,6,77,84,93,101];
|
||||
@ -745,6 +748,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -780,6 +784,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -815,6 +820,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -851,6 +857,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -910,6 +917,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -948,6 +956,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1050,6 +1059,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertOptimized(g);
|
||||
deopt = true;
|
||||
g();
|
||||
%PrepareFunctionForOptimization(g);
|
||||
deopt = false;
|
||||
array = [11,'22',33,45,56,6,77,84,93,101];
|
||||
Object.freeze(array);
|
||||
@ -1105,6 +1115,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
done = true;
|
||||
assertEquals(null, g());
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1140,6 +1151,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1175,6 +1187,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1211,6 +1224,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
done = true;
|
||||
assertEquals(null, g());
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1269,6 +1283,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1307,6 +1322,7 @@ assertEquals(undefined, Object.freeze(arr).reduceRight(function(val) { return va
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
|
@ -613,6 +613,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertOptimized(g);
|
||||
deopt = true;
|
||||
g();
|
||||
%PrepareFunctionForOptimization(g);
|
||||
assertOptimized(g);
|
||||
deopt = false;
|
||||
array = [11,'22',33,45,56,6,77,84,93,101];
|
||||
@ -648,6 +649,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
deopt = false;
|
||||
array = [11,'22',33,45,56,6,77,84,93,101];
|
||||
Object.preventExtensions(array);
|
||||
%PrepareFunctionForOptimization(g);
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
assertUnoptimized(g);
|
||||
@ -692,6 +694,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
deopt = false;
|
||||
array = [11,'22',33,45,56,6,77,84,93,101];
|
||||
Object.preventExtensions(array);
|
||||
%PrepareFunctionForOptimization(g);
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
assertUnoptimized(g);
|
||||
@ -745,6 +748,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -780,6 +784,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -815,6 +820,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -851,6 +857,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -910,6 +917,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -948,6 +956,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1050,6 +1059,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertOptimized(g);
|
||||
deopt = true;
|
||||
g();
|
||||
%PrepareFunctionForOptimization(g);
|
||||
deopt = false;
|
||||
array = [11,'22',33,45,56,6,77,84,93,101];
|
||||
Object.preventExtensions(array);
|
||||
@ -1105,6 +1115,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
done = true;
|
||||
assertEquals(null, g());
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1140,6 +1151,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1175,6 +1187,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1211,6 +1224,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
done = true;
|
||||
assertEquals(null, g());
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1269,6 +1283,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
@ -1307,6 +1322,7 @@ assertEquals(undefined, Object.preventExtensions(arr).reduceRight(function(val)
|
||||
assertEquals(null, g());
|
||||
assertOptimized(g);
|
||||
done = false;
|
||||
%PrepareFunctionForOptimization(g);
|
||||
g(); g();
|
||||
%OptimizeFunctionOnNextCall(g);
|
||||
g();
|
||||
|
@ -60,6 +60,7 @@
|
||||
return v < 8;
|
||||
});
|
||||
}
|
||||
%PrepareFunctionForOptimization(softyPlusEarlyExit);
|
||||
assertFalse(softyPlusEarlyExit(false));
|
||||
assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8], called_values);
|
||||
softyPlusEarlyExit(false);
|
||||
|
@ -20,5 +20,6 @@ function f(v3) {
|
||||
};
|
||||
%PrepareFunctionForOptimization(f);
|
||||
f(Object);
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
f(Object);
|
||||
|
@ -59,4 +59,6 @@ for (i = 0; i < cases.length; ++i) {
|
||||
%OptimizeFunctionOnNextCall(do_max);
|
||||
assertEquals(c[3], do_min(c[0], c[1]));
|
||||
assertEquals(c[2], do_max(c[0], c[1]));
|
||||
%PrepareFunctionForOptimization(do_min);
|
||||
%PrepareFunctionForOptimization(do_max);
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ f(100000, o3);
|
||||
|
||||
// This causes all code for f to be lazily deopted.
|
||||
o2.a = 5;
|
||||
%PrepareFunctionForOptimization(f);
|
||||
|
||||
// If OSR did not evict the old code, it will be installed in f here.
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
|
@ -55,6 +55,7 @@ if (standalone) {
|
||||
optimize = empty_func;
|
||||
clearFunctionTypeFeedback = empty_func;
|
||||
deoptimizeFunction = empty_func;
|
||||
prepareForOptimize = empty_func;
|
||||
} else {
|
||||
optimize = function(name) {
|
||||
%OptimizeFunctionOnNextCall(name);
|
||||
@ -65,6 +66,9 @@ if (standalone) {
|
||||
deoptimizeFunction = function(name) {
|
||||
%DeoptimizeFunction(name);
|
||||
}
|
||||
prepareForOptimize = function(name) {
|
||||
%PrepareFunctionForOptimization(name);
|
||||
}
|
||||
}
|
||||
|
||||
function base_setter_test(create_func, index, store_value) {
|
||||
@ -76,6 +80,7 @@ function base_setter_test(create_func, index, store_value) {
|
||||
var ap = [];
|
||||
ap.__defineSetter__(index, function() { calls++; });
|
||||
|
||||
prepareForOptimize(foo);
|
||||
foo(a);
|
||||
foo(a);
|
||||
foo(a);
|
||||
@ -141,6 +146,7 @@ function base_setter_test(create_func, index, store_value) {
|
||||
a = create_func();
|
||||
ap2 = [];
|
||||
a.__proto__ = ap2;
|
||||
prepareForOptimize(foo);
|
||||
foo(a);
|
||||
foo(a);
|
||||
foo(a);
|
||||
@ -161,6 +167,7 @@ function base_setter_test(create_func, index, store_value) {
|
||||
a = create_func();
|
||||
a.__proto__ = ap2;
|
||||
bar = function(a) { a[index+1] = store_value; }
|
||||
prepareForOptimize(bar);
|
||||
bar(a);
|
||||
bar(a);
|
||||
bar(a); // store should be generic
|
||||
|
@ -95,30 +95,36 @@
|
||||
assertEquals(9, x);
|
||||
|
||||
// Test deopt at the beginning of the case label evaluation.
|
||||
%PrepareFunctionForOptimization(f);
|
||||
assertResult([2], "ca", "deopt", true);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertResult([4], "ca", "deopt", false);
|
||||
assertEquals(10, x);
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
|
||||
// Test deopt in the middle of the case label evaluation.
|
||||
assertResult([2], "ac", true, "deopt");
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertResult([4], "ac", false, "deopt");
|
||||
assertEquals(11, x);
|
||||
|
||||
// Test deopt in the default case.
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
print("here");
|
||||
assertResult([4], 10000, false, false, "deopt");
|
||||
assertEquals(12, x);
|
||||
|
||||
// Test deopt in the default case.
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertResult([4], 10000, false, false, "deopt");
|
||||
assertEquals(13, x);
|
||||
|
||||
// Test deopt in x++ case.
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertResult([5], 13, false, false, "deopt");
|
||||
assertEquals(14, x);
|
||||
@ -159,6 +165,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
%PrepareFunctionForOptimization(f);
|
||||
|
||||
function assertResult(r, label, b1, b2, b3) {
|
||||
f(label, b1, b2, b3);
|
||||
@ -192,30 +199,36 @@
|
||||
assertEquals(9, x);
|
||||
|
||||
// Test deopt at the beginning of the case label evaluation.
|
||||
%PrepareFunctionForOptimization(f);
|
||||
assertResult([2,3], "ca", "deopt", true);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertResult([4,5], "ca", "deopt", false);
|
||||
assertEquals(10, x);
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
|
||||
// Test deopt in the middle of the case label evaluation.
|
||||
assertResult([2,3], "ac", true, "deopt");
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertResult([4,5], "ac", false, "deopt");
|
||||
assertEquals(11, x);
|
||||
|
||||
// Test deopt in the default case.
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
print("here");
|
||||
assertResult([4,5], 10000, false, false, "deopt");
|
||||
assertEquals(12, x);
|
||||
|
||||
// Test deopt in the default case.
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertResult([4,5], 10000, false, false, "deopt");
|
||||
assertEquals(13, x);
|
||||
|
||||
// Test deopt in x++ case.
|
||||
%PrepareFunctionForOptimization(f);
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertResult([5], 13, false, false, "deopt");
|
||||
assertEquals(14, x);
|
||||
|
Loading…
Reference in New Issue
Block a user