Reland "[Test] Update tests to work with lazy feedback allocation."

This is a reland of 289b25765a.
The fix for failures landed here:
https://chromium-review.googlesource.com/c/v8/v8/+/1599388

Original change's description:
> [Test] Update tests to work with lazy feedback allocation.
>
> This adds either %EnsureFeedbackVectorForFunction or
> %PrepareFunctionForOptimization to allocate feedback vectors when testing
> optimization, allocation sites, IC transitions etc.,
>
> Bug: v8:8394
> Change-Id: I6ad1b6d460e4abda693b326cddb87754e080a0a1
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1593303
> Commit-Queue: Mythri Alle <mythria@chromium.org>
> Auto-Submit: Mythri Alle <mythria@chromium.org>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#61212}

Bug: v8:8394
Change-Id: Idb5bba221d138e6fd73155f959b9e16fc948c709
TBR: rmcilroy@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1599607
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Auto-Submit: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61332}
This commit is contained in:
Mythri A 2019-05-03 15:32:12 +01:00 committed by Commit Bot
parent f3f3f289fc
commit f820041aba
129 changed files with 667 additions and 212 deletions

View File

@ -784,7 +784,9 @@ TEST(InvocationCount) {
CompileRun(
"function bar() {};"
"%EnsureFeedbackVectorForFunction(bar);"
"function foo() { return bar(); };"
"%EnsureFeedbackVectorForFunction(foo);"
"foo();");
Handle<JSFunction> foo = Handle<JSFunction>::cast(GetGlobalProperty("foo"));
CHECK_EQ(1, foo->feedback_vector()->invocation_count());

View File

@ -37,6 +37,7 @@ function ChangeSmiConstantAndOsr() {
}
return j;
}
%PrepareFunctionForOptimization(ChangeSmiConstantAndOsr);
var r1 = ChangeSmiConstantAndOsr();
if (changed) {
assertEquals("result", r1);
@ -54,6 +55,7 @@ function ChangeFloatConstantAndOsr() {
}
return j;
}
%PrepareFunctionForOptimization(ChangeFloatConstantAndOsr);
var r2 = ChangeFloatConstantAndOsr();
if (changed) {
assertEquals("result", r2);
@ -72,6 +74,7 @@ function ChangeFloatVarAndOsr() {
}
return j;
}
%PrepareFunctionForOptimization(ChangeFloatVarAndOsr);
var r3 = ChangeFloatVarAndOsr();
if (changed) {
assertEquals("result0.1", r3);
@ -105,6 +108,7 @@ function ChangeIntVarAndOsr() {
}
return j;
}
%PrepareFunctionForOptimization(ChangeIntVarAndOsr);
var r4 = ChangeIntVarAndOsr();
if (changed) {

View File

@ -7,9 +7,13 @@ var Debug = debug.Debug;
Debug.setListener(() => undefined);
const myObj = {};
function f() {
const myObj = {};
for (let i = 0; i < 10; i++) {
%OptimizeOsr();
%ScheduleBreak();
for (let i = 0; i < 10; i++) {
%OptimizeOsr();
%ScheduleBreak();
}
}
%PrepareFunctionForOptimization(f);
f()

View File

@ -9,6 +9,7 @@ Debug.setListener(function() {});
function f() {
for (var i = 0; i < 100; i++) %OptimizeOsr();
}
%PrepareFunctionForOptimization(f);
Debug.setBreakPoint(f, 0, 0);
f();

View File

@ -23,6 +23,7 @@ function wrapper1() {
}
f1();
}
%PrepareFunctionForOptimization(wrapper1);
function f2() {
counter++;

View File

@ -67,6 +67,7 @@ function assertKind(expected, obj, name_opt) {
function bar0(t) {
return new t();
}
%PrepareFunctionForOptimization(bar0);
a = bar0(Array);
a[0] = 3.5;
b = bar0(Array);
@ -77,7 +78,8 @@ function assertKind(expected, obj, name_opt) {
assertOptimized(bar0);
// bar0 should deopt
b = bar0(Object);
assertUnoptimized(bar0)
assertUnoptimized(bar0);
%PrepareFunctionForOptimization(bar0);
// When it's re-optimized, we should call through the full stub
bar0(Array);
%OptimizeFunctionOnNextCall(bar0);
@ -99,6 +101,7 @@ function assertKind(expected, obj, name_opt) {
function bar() {
return new Array();
}
%PrepareFunctionForOptimization(bar);
a = bar();
bar();
%OptimizeFunctionOnNextCall(bar);
@ -115,6 +118,7 @@ function assertKind(expected, obj, name_opt) {
// map for Array in that context will be used.
(function() {
function bar() { return new Array(); }
%PrepareFunctionForOptimization(bar);
bar();
bar();
%OptimizeFunctionOnNextCall(bar);
@ -134,6 +138,7 @@ function assertKind(expected, obj, name_opt) {
// should deal with arguments that create holey arrays.
(function() {
function bar(len) { return new Array(len); }
%PrepareFunctionForOptimization(bar);
bar(0);
bar(0);
%OptimizeFunctionOnNextCall(bar);
@ -153,6 +158,7 @@ function assertKind(expected, obj, name_opt) {
// Test: Make sure that crankshaft continues with feedback for large arrays.
(function() {
function bar(len) { return new Array(len); }
%PrepareFunctionForOptimization(bar);
var size = 100001;
// Perform a gc, because we are allocating a very large array and if a gc
// happens during the allocation we could lose our memento.

View File

@ -79,6 +79,7 @@ function array_literal_test() {
assertEquals(2, f0[1]);
assertEquals(1, f0[0]);
}
%PrepareFunctionForOptimization(array_literal_test);
%PrepareFunctionForOptimization(array_literal_test);
for (var i = 0; i < 3; i++) {
@ -109,6 +110,7 @@ function test_large_literal() {
[0, 1, 2, 3, 4, 5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5,
new Object(), new Object(), new Object(), new Object()]);
}
%PrepareFunctionForOptimization(test_large_literal);
%PrepareFunctionForOptimization(test_large_literal);
for (var i = 0; i < 3; i++) {
@ -124,6 +126,7 @@ function deopt_array(use_literal) {
return new Array();
}
}
%PrepareFunctionForOptimization(deopt_array);
%PrepareFunctionForOptimization(deopt_array);
deopt_array(false);
@ -142,6 +145,7 @@ assertOptimized(deopt_array);
function deopt_array_literal_all_smis(a) {
return [0, 1, a];
}
%PrepareFunctionForOptimization(deopt_array_literal_all_smis);
%PrepareFunctionForOptimization(deopt_array_literal_all_smis);
deopt_array_literal_all_smis(2);
@ -168,6 +172,7 @@ assertEquals(.5, array[2]);
function deopt_array_literal_all_doubles(a) {
return [0.5, 1, a];
}
%PrepareFunctionForOptimization(deopt_array_literal_all_doubles);
%PrepareFunctionForOptimization(deopt_array_literal_all_doubles);
deopt_array_literal_all_doubles(.5);

View File

@ -17,6 +17,7 @@ function makeArray() {
return a;
}
%PrepareFunctionForOptimization(doShift);
doShift(makeArray());
doShift(makeArray());
%OptimizeFunctionOnNextCall(doShift);

View File

@ -197,6 +197,7 @@ assertEquals(0.5, array_store_1([], 0, 0.5));
a[b] = c;
}
%PrepareFunctionForOptimization(grow_store);
a = new Array(1);
grow_store(a,1,1);
grow_store(a,2,1);
@ -216,6 +217,7 @@ assertEquals(0.5, array_store_1([], 0, 0.5));
function f(o, k, v) {
o[k] = v;
}
%PrepareFunctionForOptimization(f);
a = [3.5];
f(a, 1, "hi"); // DOUBLE packed array -> tagged packed grow
@ -238,6 +240,7 @@ assertEquals(0.5, array_store_1([], 0, 0.5));
function f(o, k, v) {
o[k] = v;
}
%PrepareFunctionForOptimization(f);
a = [3.5];
f(a, 0, "hi"); // DOUBLE packed array -> tagged packed grow

View File

@ -21,6 +21,7 @@
}
%PrepareFunctionForOptimization(slice0);
%PrepareFunctionForOptimization(slice);
assertEquals(arr, slice());
assertFalse(arr === slice());
@ -29,7 +30,6 @@
%OptimizeFunctionOnNextCall(slice0);
assertEquals(slice(), slice0());
%PrepareFunctionForOptimization(slice);
%OptimizeFunctionOnNextCall(slice);
assertEquals(slice(), slice0());
@ -415,6 +415,7 @@
function test() {
%PrepareFunctionForOptimization(slice0);
%PrepareFunctionForOptimization(slice);
assertEquals(arr, slice());
assertFalse(arr === slice());
@ -423,7 +424,6 @@
%OptimizeFunctionOnNextCall(slice0);
assertEquals(slice(), slice0());
%PrepareFunctionForOptimization(slice);
%OptimizeFunctionOnNextCall(slice);
assertEquals(slice(), slice0());
@ -455,13 +455,13 @@
}
function test() {
%PrepareFunctionForOptimization(slice0);
%PrepareFunctionForOptimization(slice);
assertEquals(arr, slice());
assertFalse(arr === slice());
assertEquals(slice(), slice0());
assertEquals(slice0(), slice());
%PrepareFunctionForOptimization(slice0);
%PrepareFunctionForOptimization(slice);
%OptimizeFunctionOnNextCall(slice0);
assertEquals(slice(), slice0());
%OptimizeFunctionOnNextCall(slice);

View File

@ -38,6 +38,7 @@ function f() {
arr[500] = 20;
arr[10] = arr[50];
}
%EnsureFeedbackVectorForFunction(f);
function g() {
f();

View File

@ -32,6 +32,7 @@
(function() {
// Produce a SpeculativeNumberEqual with Number feedback.
function bar(x, y) { return x === y; }
%EnsureFeedbackVectorForFunction(bar);
bar(0.1, 0.5);
bar(-0, 100);
@ -83,6 +84,7 @@
(function() {
// Produce a SpeculativeNumberLessThan with Number feedback.
function bar(x, y) { return x < y; }
%EnsureFeedbackVectorForFunction(bar);
bar(0.1, 0.5);
bar(-0, 100);
@ -134,6 +136,7 @@
(function() {
// Produce a SpeculativeNumberLessThanOrEqual with Number feedback.
function bar(x, y) { return x <= y; }
%EnsureFeedbackVectorForFunction(bar);
bar(0.1, 0.5);
bar(-0, 100);

View File

@ -269,6 +269,7 @@ function osr_inner(t, limit) {
}
return r;
}
%PrepareFunctionForOptimization(osr_inner);
function osr_outer(t, osr_after) {
var r = 1;
@ -281,6 +282,7 @@ function osr_outer(t, osr_after) {
}
return r;
}
%PrepareFunctionForOptimization(osr_outer);
function osr_outer_and_deopt(t, osr_after) {
var r = 1;
@ -290,6 +292,7 @@ function osr_outer_and_deopt(t, osr_after) {
}
return r;
}
%PrepareFunctionForOptimization(osr_outer_and_deopt);
function test_osr() {
with ({}) {} // Disable optimizations of this function.

View File

@ -38,6 +38,7 @@ function f1() {
}
return sum;
}
%PrepareFunctionForOptimization(f1);
function f2() {
var sum = 0;
@ -50,6 +51,7 @@ function f2() {
}
return sum;
}
%PrepareFunctionForOptimization(f2);
function f3() {
var sum = 0;
@ -62,6 +64,7 @@ function f3() {
}
return sum;
}
%PrepareFunctionForOptimization(f3);
function test1() {
var j = 11;

View File

@ -14,6 +14,7 @@ function fastaRandom(n, table) {
n--;
}
}
%PrepareFunctionForOptimization(fastaRandom);
print("---BEGIN 1");
assertEquals(undefined, fastaRandom(6, null));

View File

@ -41,4 +41,5 @@ function f(x, b, c) {
return a + 4;
}
%PrepareFunctionForOptimization(f);
assertEquals(55, f(5, "122", "1221"));

View File

@ -24,6 +24,7 @@ function foo() {
result.push(out);
return result;
}
%PrepareFunctionForOptimization(foo);
function check() {

View File

@ -28,6 +28,7 @@ function test(expected, func, depth) {
for (var depth = 1; depth < 4; depth++) {
var body = nest(orig, name, depth);
func = eval("(" + body + ")");
%PrepareFunctionForOptimization(func);
assertEquals(expected, func());
assertEquals(expected, func());
@ -47,6 +48,7 @@ function foo() {
}
return result;
}
%PrepareFunctionForOptimization(foo);
test(45, foo);
@ -58,6 +60,7 @@ function bar() {
}
return sum;
}
%PrepareFunctionForOptimization(bar);
test(45, bar);
@ -71,6 +74,7 @@ function bon() {
return sum;
}
}
%PrepareFunctionForOptimization(bon);
test(45, bon);
@ -87,6 +91,7 @@ function row() {
}
return 11;
}
%PrepareFunctionForOptimization(row);
test(7, row);
@ -98,6 +103,7 @@ function nub() {
}
return i;
}
%PrepareFunctionForOptimization(nub);
test(2, nub);
@ -112,5 +118,6 @@ function kub() {
}
return result;
}
%PrepareFunctionForOptimization(kub);
test(1, kub);

View File

@ -24,6 +24,7 @@ function bar() {
}
return result;
}
%PrepareFunctionForOptimization(bar);
test(4005, bar);
@ -35,6 +36,7 @@ function baz() {
}
return sum;
}
%PrepareFunctionForOptimization(baz);
test(2, baz);
@ -46,6 +48,7 @@ function qux() {
}
return result;
}
%PrepareFunctionForOptimization(qux);
test(1, qux);
@ -60,6 +63,7 @@ function nux() {
}
return result;
}
%PrepareFunctionForOptimization(nux);
test(1, nux);
@ -78,5 +82,6 @@ function blo() {
}
return result;
}
%PrepareFunctionForOptimization(blo);
test(4005, blo());

View File

@ -18,6 +18,7 @@ function foo(t) {
}
return 5;
}
%PrepareFunctionForOptimization(foo);
test(5, foo, {x:20});
@ -31,5 +32,6 @@ function bar(t) {
}
return sum;
}
%PrepareFunctionForOptimization(bar);
test(62, bar, {x:20,y:11});

View File

@ -11,6 +11,7 @@ function thrower() {
if (x == 5) %OptimizeOsr(1);
if (x == 10) throw "terminate";
}
%PrepareFunctionForOptimization(thrower);
%NeverOptimizeFunction(thrower); // Don't want to inline the thrower.
%NeverOptimizeFunction(test); // Don't want to inline the func into test.
@ -25,18 +26,22 @@ function test(func) {
function n1() {
while (true) thrower();
}
%PrepareFunctionForOptimization(n1);
function n2() {
while (true) while (true) thrower();
}
%PrepareFunctionForOptimization(n2);
function n3() {
while (true) while (true) while (true) thrower();
}
%PrepareFunctionForOptimization(n3);
function n4() {
while (true) while (true) while (true) while (true) thrower();
}
%PrepareFunctionForOptimization(n4);
function b1(a) {
while (true) {
@ -44,6 +49,7 @@ function b1(a) {
if (a) break
}
}
%PrepareFunctionForOptimization(b1);
function b2(a) {
@ -54,6 +60,7 @@ function b2(a) {
}
}
}
%PrepareFunctionForOptimization(b2);
function b3(a) {
@ -67,6 +74,7 @@ function b3(a) {
}
}
}
%PrepareFunctionForOptimization(b3);
test(n1);

View File

@ -17,6 +17,7 @@ function foo() {
}
return sum;
}
%PrepareFunctionForOptimization(foo);
assertEquals(30, foo());
assertEquals(30, foo());
@ -36,6 +37,7 @@ function bar(a) {
}
return sum;
}
%PrepareFunctionForOptimization(bar);
assertEquals(1, bar(1));
assertEquals(1, bar(1));

View File

@ -11,6 +11,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f0);
function f1(a) {
for (var i = 0; i < 3; i = i + 1 | 0) {
@ -18,6 +19,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f1);
function f2(a,b) {
for (var i = 0; i < 3; i = i + 1 | 0) {
@ -25,6 +27,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f2);
function f3(a,b,c) {
for (var i = 0; i < 3; i = i + 1 | 0) {
@ -32,6 +35,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f3);
function f4(a,b,c,d) {
for (var i = 0; i < 3; i = i + 1 | 0) {
@ -39,6 +43,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f4);
function bar() {
assertEquals(3, f0().blah);

View File

@ -11,6 +11,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f0);
function f1(a) {
for (var i = 0; i < 3; i = i + 1 | 0) {
@ -18,6 +19,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f1);
function f2(a,b) {
for (var i = 0; i < 3; i = i + 1 | 0) {
@ -25,6 +27,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f2);
function f3(a,b,c) {
for (var i = 0; i < 3; i = i + 1 | 0) {
@ -32,6 +35,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f3);
function f4(a,b,c,d) {
for (var i = 0; i < 3; i = i + 1 | 0) {
@ -39,6 +43,7 @@ function mod() {
}
return {blah: i};
}
%PrepareFunctionForOptimization(f4);
function bar() {
assertEquals(3, f0().blah);

View File

@ -22,10 +22,12 @@ function gen(w) { // defeat compiler cache.
"} f" + num;
return eval(src);
}
%PrepareFunctionForOptimization(gen);
function check(x,a,b,c) {
for (var i = 0; i < 3; i++) {
var f = gen(i);
%PrepareFunctionForOptimization(f);
assertEquals(x, f(a, b, c));
}
}

View File

@ -26,6 +26,7 @@ function gen(w) { // defeat compiler cache.
function check(x,a,b,c) {
for (var i = 0; i < 3; i++) {
var f = gen(i);
%PrepareFunctionForOptimization(f);
assertEquals(x, f(a, b, c));
}
}

View File

@ -44,6 +44,7 @@ function bar(goal) {
}
return sum;
}
%PrepareFunctionForOptimization(bar);
for (var i = 0; i < 13; i++) {
%DeoptimizeFunction(bar);

View File

@ -59,5 +59,6 @@ function gen(i) {
for (var i = 1; i < 10; i++) {
var f = gen(i);
%PrepareFunctionForOptimization(f);
assertEquals(1979, f());
}

View File

@ -40,6 +40,7 @@ function f() {
}
return sum;
}
%PrepareFunctionForOptimization(f);
assertEquals(1450, f());

View File

@ -19,7 +19,7 @@ function f() {
return sum;
}
%PrepareFunctionForOptimization(f);
assertEquals(15000, f());
assertEquals(15000, f());
assertEquals(15000, f());

View File

@ -16,5 +16,6 @@ function f(x) {
}
return sum;
}
%PrepareFunctionForOptimization(f);
assertEquals(50, f(5));

View File

@ -13,6 +13,7 @@ function foo(a) {
}
return r;
}
%PrepareFunctionForOptimization(foo);
function bar(a) {
for (var i = 0; i < 10; i++) {
@ -21,6 +22,7 @@ function bar(a) {
}
return r;
}
%PrepareFunctionForOptimization(bar);
function baz(a) {
for (var i = 0; i < 10; i++) {
@ -28,6 +30,7 @@ function baz(a) {
}
return /\0/;
}
%PrepareFunctionForOptimization(baz);
function qux(a) {
for (var i = 0; i < 10; i++) {
@ -39,6 +42,7 @@ function qux(a) {
}
return r;
}
%PrepareFunctionForOptimization(qux);
function test(f) {
// Test the reference equality of regex's created in OSR'd function.

View File

@ -15,6 +15,7 @@ function f() {
}
return sum;
}
%PrepareFunctionForOptimization(f);
for (var i = 0; i < 2; i++) {

View File

@ -19,6 +19,7 @@ function SingleLoop() {
}
}
}
%PrepareFunctionForOptimization(SingleLoop);
// These function could also fail if the exception handlers are not updated at
@ -38,6 +39,7 @@ function EmptyBody() {
a++;
}
}
%PrepareFunctionForOptimization(EmptyBody);
function NestedLoops() {
for (var a = 0; a < 2; a++) {
@ -52,6 +54,7 @@ function NestedLoops() {
}
}
}
%PrepareFunctionForOptimization(NestedLoops);
SingleLoop();

View File

@ -20,5 +20,6 @@ function f(x) {
}
return sum;
}
%PrepareFunctionForOptimization(f);
assertEquals(500, f(5));

View File

@ -35,6 +35,7 @@ function foo() {
}
return result;
}
%PrepareFunctionForOptimization(foo);
test(1, foo);
@ -54,5 +55,6 @@ function smo() {
}
return result;
}
%PrepareFunctionForOptimization(smo);
test(11, smo);

View File

@ -18,6 +18,7 @@
}
}
%PrepareFunctionForOptimization(g);
g();
})();
@ -33,5 +34,6 @@
}
}
%PrepareFunctionForOptimization(g);
g();
})();

View File

@ -16,4 +16,5 @@ function f() {
return sum;
}
%PrepareFunctionForOptimization(f);
f();

View File

@ -13,4 +13,5 @@ function f() {
return x;
}
%PrepareFunctionForOptimization(f);
assertEquals(0, f());

View File

@ -6,12 +6,14 @@
(function() {
"use asm";
return function() {
var f = function() {
for (var i = 0; i < 10; i++) {
if (i == 5) {
%OptimizeOsr();
}
}
with (Object());
}
};
%PrepareFunctionForOptimization(f);
return f;
})()();

View File

@ -12,4 +12,5 @@ function f() {
}
}
%PrepareFunctionForOptimization(f);
f();

View File

@ -13,4 +13,5 @@ function foo() {
}
}
%PrepareFunctionForOptimization(foo);
foo();

View File

@ -12,4 +12,5 @@ function f(get, ...a) {
}
return get();
}
%PrepareFunctionForOptimization(f);
assertThrows(f);

View File

@ -11,6 +11,7 @@ function foo(o) {
}
}
%PrepareFunctionForOptimization(foo);
foo([1]);
foo([1]);
%OptimizeFunctionOnNextCall(foo);

View File

@ -13,6 +13,7 @@ function OSRInsideTry(x) {
}
return x + 2;
}
%PrepareFunctionForOptimization(OSRInsideTry);
assertEquals(24, OSRInsideTry(23));
@ -25,6 +26,7 @@ function OSRInsideCatch(x) {
}
return x + 2;
}
%PrepareFunctionForOptimization(OSRInsideCatch);
assertEquals(24, OSRInsideCatch(23));
@ -37,6 +39,7 @@ function OSRInsideFinally_Return(x) {
}
return x + 2;
}
%PrepareFunctionForOptimization(OSRInsideFinally_Return);
assertEquals(24, OSRInsideFinally_Return(23));
@ -48,4 +51,5 @@ function OSRInsideFinally_ReThrow(x) {
}
return x + 2;
}
%PrepareFunctionForOptimization(OSRInsideFinally_ReThrow);
assertThrows("OSRInsideFinally_ReThrow(new Error)", Error);

View File

@ -44,6 +44,7 @@ if (!%IsConcurrentRecompilationSupported()) {
function f1(a, i) {
return a[i] + 0.5;
}
%PrepareFunctionForOptimization(f1);
%PrepareFunctionForOptimization(f1);
var arr = [0.0,,2.5];

View File

@ -99,6 +99,7 @@ function TestLoadFromConstantFieldOfAPrototype(the_value, other_value) {
// Ensure O.prototype is in fast mode by loading from its field.
function warmup() { return new O().v; }
%EnsureFeedbackVectorForFunction(warmup);
warmup(); warmup(); warmup();
assertTrue(%HasFastProperties(O.prototype));

View File

@ -14,6 +14,7 @@ function foo(i, deopt = false) {
foo(i - 1, deopt);
}
}
%PrepareFunctionForOptimization(foo);
assertEquals(0, %GetDeoptCount(foo));

View File

@ -14,6 +14,7 @@ function foo(i, deopt = false) {
foo(i - 1, deopt);
}
}
%PrepareFunctionForOptimization(foo);
%PrepareFunctionForOptimization(foo);
assertEquals(0, %GetDeoptCount(foo));

View File

@ -18,6 +18,7 @@ function foo(i, deopt = false, deoptobj = null) {
assertEquals(0, %GetDeoptCount(foo));
%PrepareFunctionForOptimization(foo);
foo(10);
foo(10);
%OptimizeFunctionOnNextCall(foo);

View File

@ -75,6 +75,7 @@ function test(a, b, c, d, e, v) {
assertEquals(24, d);
assertEquals(37.5, e);
}
%PrepareFunctionForOptimization(test);
test(10.0, 20.0, 30.0, 40.0, 50.0, 1.5);

View File

@ -6,6 +6,7 @@
function f(x, y) { return x + y; }
%PrepareFunctionForOptimization(f);
assertEquals(1, f(0, 1));
assertEquals(5, f(2, 3));
%OptimizeFunctionOnNextCall(f);

View File

@ -30,7 +30,7 @@
function div(g) {
return (g/-1) ^ 1
}
%PrepareFunctionForOptimization(div);
var kMinInt = 1 << 31;
var expected_MinInt = div(kMinInt);
var expected_minus_zero = div(0);
@ -42,6 +42,7 @@ function mul(g) {
return (g * -1) ^ 1
}
%PrepareFunctionForOptimization(mul);
expected_MinInt = mul(kMinInt);
expected_minus_zero = mul(0);
%OptimizeFunctionOnNextCall(mul);

View File

@ -45,6 +45,7 @@ function test_wrapper() {
} while (--count > 0);
}
%PrepareFunctionForOptimization(testDoubleConversion4);
testDoubleConversion4(new Array(5));
testDoubleConversion4(new Array(5)); // Call twice to make sure that second
// store is a transition and not
@ -71,6 +72,7 @@ function test_wrapper() {
} while (--count > 0);
}
%PrepareFunctionForOptimization(testExactMapHoisting);
testExactMapHoisting(new Array(5));
testExactMapHoisting(new Array(5)); // Call twice to make sure that second
// store is a transition and not
@ -102,6 +104,7 @@ function test_wrapper() {
} while (--count > 0);
}
%PrepareFunctionForOptimization(testExactMapHoisting2);
testExactMapHoisting2(new Array(5));
testExactMapHoisting2(new Array(5)); // Call twice to make sure that second
// store is a transition and not
@ -129,6 +132,7 @@ function test_wrapper() {
} while (--count > 0);
}
%PrepareFunctionForOptimization(testExactMapHoisting3);
var add_transition = new Array(5);
add_transition.foo = 0;
add_transition[0] = new Object(); // For FAST_ELEMENT transition to be created
@ -155,6 +159,7 @@ function test_wrapper() {
}
/*
%PrepareFunctionForOptimization(testDominatingTransitionHoisting1);
testDominatingTransitionHoisting1(new Array(5));
testDominatingTransitionHoisting1(new Array(5)); // Call twice to make sure
// that second store is a
@ -180,6 +185,7 @@ function test_wrapper() {
} while (--count > 3);
}
%PrepareFunctionForOptimization(testHoistingWithSideEffect);
testHoistingWithSideEffect(new Array(5));
testHoistingWithSideEffect(new Array(5)); // Call twice to make sure that
// second store is a transition and
@ -203,6 +209,7 @@ function test_wrapper() {
} while (--count > 3);
}
%PrepareFunctionForOptimization(testStraightLineDupeElinination);
testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,0,0,.5);
testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,0,.5,0);
testStraightLineDupeElinination(new Array(0, 0, 0, 0, 0),0,0,.5,0,0);

View File

@ -30,6 +30,7 @@
assertUnoptimized(foo);
assertTrue(%HasDictionaryElements(a));
%PrepareFunctionForOptimization(foo);
var b = [];
foo(b, 1);
foo(b, 2);

View File

@ -15,6 +15,7 @@
function readA(x) {
return x.a;
}
%PrepareFunctionForOptimization(readA);
var a = new A();
assertUnoptimized(readA);
readA(a); readA(a); readA(a);
@ -26,6 +27,7 @@
b.b = o;
assertEquals(readA(b), o);
assertUnoptimized(readA);
%PrepareFunctionForOptimization(readA);
%OptimizeFunctionOnNextCall(readA);
assertEquals(readA(a), o);
assertOptimized(readA);
@ -37,6 +39,7 @@
return x.a;
}
assertUnoptimized(readAFromB);
%PrepareFunctionForOptimization(readAFromB);
readAFromB(b); readAFromB(b); readAFromB(b);
%OptimizeFunctionOnNextCall(readAFromB);
assertEquals(readAFromB(b), o);
@ -49,6 +52,8 @@
c.a = [1];
assertUnoptimized(readA);
assertUnoptimized(readAFromB);
%PrepareFunctionForOptimization(readA);
%PrepareFunctionForOptimization(readAFromB);
assertEquals(readA(a), o);
assertEquals(readA(b), o);
assertEquals(readA(c), [1]);
@ -77,7 +82,9 @@
A.prototype = {y: 20};
function B(o) { return o.a.y; }
function C() { this.a = new A(); }
%EnsureFeedbackVectorForFunction(C);
%PrepareFunctionForOptimization(B);
B(new C());
B(new C());
%OptimizeFunctionOnNextCall(B);
@ -88,6 +95,7 @@
assertEquals(10, B(c));
assertUnoptimized(B);
%PrepareFunctionForOptimization(B);
var c = new C();
%OptimizeFunctionOnNextCall(B);
assertEquals(20, B(c));
@ -116,6 +124,7 @@
var f2 = new Foo({x: 2});
var f3 = new Foo({x: 3});
function readX(f) { return f.x.x; }
%PrepareFunctionForOptimization(readX);
assertEquals(readX(f1), 1);
assertEquals(readX(f2), 2);
assertUnoptimized(readX);
@ -123,6 +132,7 @@
assertEquals(readX(f3), 3);
assertOptimized(readX);
function writeX(f, x) { f.x = x; }
%PrepareFunctionForOptimization(writeX);
writeX(f1, {x: 11});
writeX(f2, {x: 22});
assertUnoptimized(writeX);
@ -146,6 +156,7 @@
var f2 = new Narf(2);
var f3 = new Narf(3);
function baz(f, y) { f.y = y; }
%PrepareFunctionForOptimization(baz);
baz(f1, {b: 9});
baz(f2, {b: 9});
baz(f2, {b: 9});
@ -161,6 +172,7 @@
function readA(o) { return o.x.a; }
var f = new Foo({a:1});
var b = new Bar({a:2});
%PrepareFunctionForOptimization(readA);
assertEquals(readA(f), 1);
assertEquals(readA(b), 2);
assertEquals(readA(f), 1);

File diff suppressed because it is too large Load Diff

View File

@ -9,4 +9,5 @@ function f() {
if (i == 5) %OptimizeOsr();
}
}
%EnsureFeedbackVectorForFunction(f);
f();

View File

@ -11,6 +11,7 @@
}
return 23;
}
%PrepareFunctionForOptimization(gen1);
var g = gen1();
assertEquals({ value:23, done:true }, g.next());
})();
@ -23,6 +24,7 @@
}
return 23;
}
%PrepareFunctionForOptimization(gen2);
var g = gen2();
assertEquals({ value:0, done:false }, g.next());
assertEquals({ value:1, done:false }, g.next());
@ -38,6 +40,7 @@
}
return 23;
}
%PrepareFunctionForOptimization(gen3);
var g = gen3();
assertEquals({ value:0, done:false }, g.next());
assertEquals({ value:1, done:false }, g.next());
@ -57,6 +60,7 @@
}
return 23;
}
%PrepareFunctionForOptimization(gen4);
var g = gen4();
assertEquals({ value:0, done:false }, g.next());
assertEquals({ value:1, done:false }, g.next());

View File

@ -10,6 +10,10 @@ function f(b) {
}
}
f(0);
assertThrows(() => {f(1)}, ReferenceError);
%PrepareFunctionForOptimization(f);
f(0);
f(0);
%OptimizeFunctionOnNextCall(f);

View File

@ -15,7 +15,13 @@ class B extends A {
}
}
}
// No feedback case
test = new B(0);
assertThrows(() => {new B(1)}, ReferenceError);
// Ensure Feedback
%PrepareFunctionForOptimization(B);
%EnsureFeedbackVectorForFunction(A);
test = new B(0);
test = new B(0);
assertThrows(() => {new B(1)}, ReferenceError);

View File

@ -15,6 +15,10 @@ class B extends A {
}
}
test = new B(1);
assertThrows(() => {new B(0)}, ReferenceError);
%PrepareFunctionForOptimization(B);
test = new B(1);
test = new B(1);
%OptimizeFunctionOnNextCall(B);

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --opt --interrupt-budget=100 --allow-natives-syntax
// Flags: --opt --interrupt-budget=100 --budget-for-feedback-vector-allocation=10 --allow-natives-syntax
function f() {
let s = 0;

View File

@ -11,6 +11,7 @@
function foo(a, i) { return a[i]; }
%PrepareFunctionForOptimization(foo);
var a = ['one', , 'three'];
foo(a, 0);
foo(a, 0);

View File

@ -36,6 +36,7 @@ function get(obj, key) {
return obj[key];
}
%PrepareFunctionForOptimization(get);
get(o, "foo");
get(o, "foo");
get(o, "foo");

View File

@ -37,6 +37,7 @@ function get(obj, key) {
return obj[key];
}
%PrepareFunctionForOptimization(get);
assertEquals("bar", get(o, s));
get(o, s);
get(o, s);

View File

@ -34,6 +34,7 @@ function test_div_no_deopt_minus_zero() {
assertTrue(0 === (Math.floor((zero_in_array[0] | 0) / -1) | 0));
}
%PrepareFunctionForOptimization(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);

View File

@ -29,6 +29,7 @@
function o1() {
}
%PrepareFunctionForOptimization(o1);
o1(); o1();
%OptimizeFunctionOnNextCall(o1);
@ -45,6 +46,8 @@ function u1() {
function u2() {
u1();
}
%PrepareFunctionForOptimization(u1);
%PrepareFunctionForOptimization(u2);
u1(); u1();
u2(); u2();

View File

@ -220,9 +220,11 @@ assertDoesNotThrow(function() { objControl.splice(0, 0, 100, 101, 102); });
// Verify that crankshaft still does the right thing.
obj = [1, 2, 3];
push_call = function(a) { a.push(1000); return a; }
push_call = function(a) { a.push(1000); return a; };
%PrepareFunctionForOptimization(push_call);
// Include a call site that doesn't have a custom built-in.
var shift_call = function(a) { a.shift(1000); return a; }
var shift_call = function(a) { a.shift(1000); return a; };
%PrepareFunctionForOptimization(shift_call);
for (var i = 0; i < 3; i++) {
push_call(obj);
shift_call(obj);

View File

@ -20,7 +20,8 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
a.abc = 25;
}
return v;
}
};
%EnsureFeedbackVectorForFunction(callback);
a.map(callback);
};
%PrepareFunctionForOptimization(eagerDeoptInCalled);
@ -41,7 +42,8 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
result += v;
a.length = (i == 13 && deopt) ? 25 : 27;
return v;
}
};
%EnsureFeedbackVectorForFunction(callback);
a.map(callback);
};
%PrepareFunctionForOptimization(eagerDeoptInCalled);
@ -65,7 +67,8 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
a_noescape.length = 25;
}
return v;
}
};
%EnsureFeedbackVectorForFunction(callback);
a_noescape.map(callback);
};
%PrepareFunctionForOptimization(eagerDeoptInCalled);
@ -93,6 +96,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
gc(); gc();
return v;
};
%EnsureFeedbackVectorForFunction(callback);
%NeverOptimizeFunction(callback);
b.map(callback);
};
@ -117,6 +121,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
}
return 2 * v;
};
%EnsureFeedbackVectorForFunction(callback);
%NeverOptimizeFunction(callback);
return b.map(callback);
};
@ -137,7 +142,8 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
%DeoptimizeNow();
}
return v;
}
};
%EnsureFeedbackVectorForFunction(callback);
b.map(callback);
};
%PrepareFunctionForOptimization(lazyDeopt);
@ -161,6 +167,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
}
return v;
};
%EnsureFeedbackVectorForFunction(callback);
%NeverOptimizeFunction(callback);
b.map(callback);
};
@ -186,7 +193,8 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
gc();
}
return v;
}
};
%EnsureFeedbackVectorForFunction(callback);
c.map(callback);
};
%PrepareFunctionForOptimization(lazyDeopt);
@ -211,7 +219,8 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
throw("a");
}
return v;
}
};
%EnsureFeedbackVectorForFunction(callback);
try {
c.map(callback);
} catch (e) {
@ -241,6 +250,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
}
return v;
};
%EnsureFeedbackVectorForFunction(callback);
%NeverOptimizeFunction(callback);
try {
c.map(callback);
@ -270,6 +280,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
}
return 2 * v;
};
%EnsureFeedbackVectorForFunction(callback);
%NeverOptimizeFunction(callback);
var result = 0;
try {
@ -303,6 +314,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
}
return v;
};
%EnsureFeedbackVectorForFunction(callback);
var o = [1,2,3];
b.map(callback);
};
@ -326,6 +338,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
}
return v;
};
%EnsureFeedbackVectorForFunction(callback);
%NeverOptimizeFunction(callback);
var o = [1,2,3];
b.map(callback);
@ -352,6 +365,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
}
return v;
};
%EnsureFeedbackVectorForFunction(callback);
var o = [1,2,3];
b.map(callback);
};
@ -375,6 +389,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
}
return v;
};
%EnsureFeedbackVectorForFunction(callback);
a.map(callback);
};
%PrepareFunctionForOptimization(lazyDeopt);
@ -408,7 +423,8 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
// array.
return v;
}
}
};
%EnsureFeedbackVectorForFunction(callback);
return c.map(callback);
};
%PrepareFunctionForOptimization(to_double);
@ -439,7 +455,8 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
// Later, to PACKED_ELEMENTS.
return v + 'hello';
}
}
};
%EnsureFeedbackVectorForFunction(callback);
return c.map(callback);
};
%PrepareFunctionForOptimization(to_fast);
@ -460,6 +477,7 @@ var c = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25];
function double_results() {
// TurboFan recognizes the result is a double.
var callback = v => v + 0.5;
%EnsureFeedbackVectorForFunction(callback);
return a.map(callback);
}
%PrepareFunctionForOptimization(double_results);

View File

@ -43,6 +43,8 @@ function f(x) {
g();
}
%PrepareFunctionForOptimization(f);
%PrepareFunctionForOptimization(g);
f();
f();
%OptimizeFunctionOnNextCall(f);

View File

@ -34,6 +34,7 @@
for (var i = 0; osr && i < 2; i++) %OptimizeOsr();
return result;
}
%PrepareFunctionForOptimization(f);
assertEquals("result", f(true, 3, false));
assertEquals("result", f(true, 3, false));
@ -58,6 +59,7 @@
function f() {
return g(void(h() + ""));
};
%PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);

View File

@ -35,6 +35,7 @@ function f(deopt, osr) {
return result;
}
%PrepareFunctionForOptimization(f);
assertEquals("result", f(3, false));
assertEquals("result", f(3, false));
%OptimizeFunctionOnNextCall(f);

View File

@ -31,21 +31,25 @@
// should be able to construct a receiver from all optimized stack frames.
function A() { }
%EnsureFeedbackVectorForFunction(A);
A.prototype.f = function() { }
function B() { }
%EnsureFeedbackVectorForFunction(B);
var o = new A();
// This function throws if o does not have an f property, and should not be
// inlined.
function g() { try { return o.f(); } finally { }}
%EnsureFeedbackVectorForFunction(g);
// This function should be optimized via OSR.
function h() {
for (var i = 0; i < 10; i++) %OptimizeOsr();
g();
}
%PrepareFunctionForOptimization(h);
h();
o = new B();

View File

@ -31,4 +31,5 @@ function foo () {
};
}
%PrepareFunctionForOptimization(foo);
foo();

View File

@ -31,6 +31,7 @@ function mul(x, y) {
return (x * y) | 0;
}
%PrepareFunctionForOptimization(mul);
mul(0, 0);
mul(0, 0);
%OptimizeFunctionOnNextCall(mul);
@ -41,6 +42,7 @@ function div(x, y) {
return (x / y) | 0;
}
%PrepareFunctionForOptimization(div);
div(4, 2);
div(4, 2);
%OptimizeFunctionOnNextCall(div);

View File

@ -35,8 +35,10 @@ function simple_two_args(always_zero, always_undefined) {
var always_five = always_undefined || 5;
return always_zero * always_five * .5;
}
%EnsureFeedbackVectorForFunction(simple_two_args);
%PrepareFunctionForOptimization(simple);
simple();
simple();
%OptimizeFunctionOnNextCall(simple);

View File

@ -33,6 +33,7 @@ function f() {
assertEquals(-1.0, Math.round(-0.5000000000000001));
}
%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);

View File

@ -55,6 +55,7 @@ function callConstantFunctionOnPrototype(obj) {
obj.holderMethod();
}
%PrepareFunctionForOptimization(callConstantFunctionOnPrototype);
callConstantFunctionOnPrototype(receiver);
callConstantFunctionOnPrototype(receiver);
%OptimizeFunctionOnNextCall(callConstantFunctionOnPrototype);

View File

@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --use-osr --allow-natives-syntax --ignition-osr --opt
// Flags: --use-osr --allow-natives-syntax --opt
// Flags: --no-always-opt
// Can't OSR with always-opt or in Lite mode.
@ -50,6 +50,7 @@ function f() {
} while (false);
}
%PrepareFunctionForOptimization(f);
f();
function g() {
@ -85,4 +86,5 @@ function g() {
} while (false);
}
%PrepareFunctionForOptimization(g);
g();

View File

@ -14,6 +14,7 @@ function Cb(a, trigger) {
}
return g;
}
%PrepareFunctionForOptimization(Cb);
var s1 = "long string to make cons string 1";
var s2 = "long string to make cons string 2";

View File

@ -33,7 +33,7 @@ if (isNeverOptimizeLiteMode()) {
x = 42;
return f.arguments[0];
}
%EnsureFeedbackVectorForFunction(f);
f(0);
%OptimizeFunctionOnNextCall(f);
assertEquals(42, f(0));

View File

@ -27,6 +27,10 @@
// Flags: --allow-natives-syntax
for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
var xl = 4096;
var z = i % xl;
function f() {
for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
var xl = 4096;
var z = i % xl;
}
%PrepareFunctionForOptimization(f);
f();

View File

@ -10,6 +10,7 @@ function foo(a) {
}
}
%PrepareFunctionForOptimization(foo);
foo([1,2,3]);
foo([2,3,4]);
%OptimizeFunctionOnNextCall(foo);

View File

@ -18,6 +18,7 @@ function foo() {
}
}
%PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);

View File

@ -10,6 +10,7 @@ function foo(obj) {
counter += obj;
return counter;
}
%PrepareFunctionForOptimization(foo);
function bar() {
var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

View File

@ -59,6 +59,7 @@ assertEquals(1, r1);
assertTrue(r1 === r2);
assertTrue(r2 === r3);
%OptimizeFunctionOnNextCall(callsFReceiver);
r1 = callsFReceiver(o1);
callsFReceiver(o1);
%OptimizeFunctionOnNextCall(callsFReceiver);

View File

@ -23,6 +23,7 @@ function literals_sharing_test(warmup, optimize) {
// propagated to the next closure.
assertTrue(%HasDoubleElements(a));
};
%EnsureFeedbackVectorForFunction(closure);
if (optimize) %OptimizeFunctionOnNextCall(closure);
closure();
}

View File

@ -9,6 +9,7 @@ function bar(a) {
return x == undefined;
}
%PrepareFunctionForOptimization(bar);
// Make the keyed load be polymorphic on holey smi and holey fast.
bar([, 2, 3]);
bar([, 'two', 'three']);

View File

@ -11,6 +11,7 @@
return 23;
} while(false)
}
%PrepareFunctionForOptimization(f);
assertEquals(23, f());
assertEquals(23, f());
})();
@ -24,6 +25,7 @@
} while(false)
return 999;
}
%PrepareFunctionForOptimization(g);
var gen = g();
assertEquals({ value:23, done:false }, gen.next());
assertEquals({ value:42, done:false }, gen.next());

View File

@ -20,6 +20,7 @@ function f(osr_and_recurse) {
}
return 65;
}
%PrepareFunctionForOptimization(f);
assertEquals(65, f(false));
assertEquals(65, f(false));
assertEquals(42, f(true));

View File

@ -15,6 +15,7 @@ var f = (function() {
}
}
})();
%PrepareFunctionForOptimization(f);
g = (function() { f((Array), counter()); });
g();

View File

@ -8,6 +8,7 @@ function get(a, i) {
return a[i];
}
%PrepareFunctionForOptimization(get);
get([1,,3], 0);
get([1,,3], 2);
%OptimizeFunctionOnNextCall(get);

View File

@ -8,6 +8,7 @@ function get(a, i) {
return a[i];
}
%PrepareFunctionForOptimization(get);
get([1,,3], 0);
get([1,,3], 2);
%OptimizeFunctionOnNextCall(get);

View File

@ -7,6 +7,7 @@
function foo(x) {
return Symbol.iterator == x;
}
%PrepareFunctionForOptimization(foo);
function main() {
foo(Symbol());

View File

@ -8,6 +8,7 @@ var o = {};
function foo(s) { return o[s]; }
%PrepareFunctionForOptimization(foo);
var s = 'c' + 'c';
foo(s);
foo(s);

View File

@ -7,6 +7,7 @@
(function() {
function foo(o) { o["x"] = 1; }
%PrepareFunctionForOptimization(foo);
assertThrows(() => foo(undefined));
assertThrows(() => foo(undefined));
%OptimizeFunctionOnNextCall(foo);
@ -17,6 +18,7 @@
(function() {
function foo(o) { o["x"] = 1; }
%PrepareFunctionForOptimization(foo);
assertThrows(() => foo(null));
assertThrows(() => foo(null));
%OptimizeFunctionOnNextCall(foo);
@ -27,6 +29,7 @@
(function() {
function foo(o) { return o["x"]; }
%PrepareFunctionForOptimization(foo);
assertThrows(() => foo(undefined));
assertThrows(() => foo(undefined));
%OptimizeFunctionOnNextCall(foo);
@ -37,6 +40,7 @@
(function() {
function foo(o) { return o["x"]; }
%PrepareFunctionForOptimization(foo);
assertThrows(() => foo(null));
assertThrows(() => foo(null));
%OptimizeFunctionOnNextCall(foo);
@ -47,6 +51,7 @@
(function() {
function foo(o) { o.x = 1; }
%PrepareFunctionForOptimization(foo);
assertThrows(() => foo(undefined));
assertThrows(() => foo(undefined));
%OptimizeFunctionOnNextCall(foo);
@ -57,6 +62,7 @@
(function() {
function foo(o) { o.x = 1; }
%PrepareFunctionForOptimization(foo);
assertThrows(() => foo(null));
assertThrows(() => foo(null));
%OptimizeFunctionOnNextCall(foo);
@ -67,6 +73,7 @@
(function() {
function foo(o) { return o.x; }
%PrepareFunctionForOptimization(foo);
assertThrows(() => foo(undefined));
assertThrows(() => foo(undefined));
%OptimizeFunctionOnNextCall(foo);
@ -77,6 +84,7 @@
(function() {
function foo(o) { return o.x; }
%PrepareFunctionForOptimization(foo);
assertThrows(() => foo(null));
assertThrows(() => foo(null));
%OptimizeFunctionOnNextCall(foo);

View File

@ -6,6 +6,7 @@
function foo(o) { return o.x; }
%PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo({}));
assertEquals(undefined, foo(1));
assertEquals(undefined, foo({}));

View File

@ -8,6 +8,7 @@ function foo(s) {
return s[5];
}
%PrepareFunctionForOptimization(foo);
assertEquals("f", foo("abcdef"));
assertEquals(undefined, foo("a"));
%OptimizeFunctionOnNextCall(foo);
@ -19,6 +20,7 @@ assertOptimized(foo);
String.prototype[5] = "5";
assertEquals("f", foo("abcdef"));
%PrepareFunctionForOptimization(foo);
assertEquals("5", foo("a"));
%OptimizeFunctionOnNextCall(foo);
assertEquals("f", foo("abcdef"));

View File

@ -8,6 +8,7 @@ function foo(s) {
return s[5];
}
%PrepareFunctionForOptimization(foo);
assertEquals("f", foo("abcdef"));
assertEquals(undefined, foo("a"));
%OptimizeFunctionOnNextCall(foo);
@ -23,6 +24,7 @@ String.prototype.__proto__ = new Proxy(String.prototype.__proto__, {
});
assertEquals("f", foo("abcdef"));
%PrepareFunctionForOptimization(foo);
assertEquals("5", foo("a"));
%OptimizeFunctionOnNextCall(foo);
assertEquals("f", foo("abcdef"));

Some files were not shown because too many files have changed in this diff Show More