[Test] Add %PrepareForOptimization in tests
With bytecode flushing and lazy feedback allocation, we need to call %PrepareForOptimization before we call %OptimizeFunctionOnNextCall Bug: v8:8801, v8:8394 Change-Id: I81918f174b2f97cbaa8b8ef2e459080c2581f535 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1588415 Commit-Queue: Mythri Alle <mythria@chromium.org> Commit-Queue: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Cr-Commit-Position: refs/heads/master@{#61122}
This commit is contained in:
parent
397f53ed0f
commit
41ef63df21
@ -29,6 +29,7 @@ function CreateManyClosures_Setup() {
|
|||||||
// Create a closure and optimize.
|
// Create a closure and optimize.
|
||||||
var f = g();
|
var f = g();
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
f(0);
|
f(0);
|
||||||
f(0);
|
f(0);
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
|
@ -20,6 +20,7 @@ function Inline() {
|
|||||||
function Middle() { Inner(); }
|
function Middle() { Inner(); }
|
||||||
function Outer() { Middle(); }
|
function Outer() { Middle(); }
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(Outer);
|
||||||
Outer();
|
Outer();
|
||||||
Outer();
|
Outer();
|
||||||
%OptimizeFunctionOnNextCall(Outer);
|
%OptimizeFunctionOnNextCall(Outer);
|
||||||
|
@ -31,6 +31,7 @@ function InlineSetup() {
|
|||||||
function Middle() { return Inner(); }
|
function Middle() { return Inner(); }
|
||||||
function Outer() { return Middle(); }
|
function Outer() { return Middle(); }
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(Outer);
|
||||||
Outer();
|
Outer();
|
||||||
Outer();
|
Outer();
|
||||||
%OptimizeFunctionOnNextCall(Outer);
|
%OptimizeFunctionOnNextCall(Outer);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
// Flags: --allow-natives-syntax --nostress-opt --opt
|
// Flags: --allow-natives-syntax --nostress-opt --opt
|
||||||
|
|
||||||
function test(f, iterations) {
|
function test(f, iterations) {
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
f();
|
f();
|
||||||
f();
|
f();
|
||||||
// Some of the tests need to learn until they stabilize.
|
// Some of the tests need to learn until they stabilize.
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
function f1(a, i) {
|
function f1(a, i) {
|
||||||
return a[i] + 0.5;
|
return a[i] + 0.5;
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(f1);
|
||||||
var arr = [0.0,,2.5];
|
var arr = [0.0,,2.5];
|
||||||
assertEquals(0.5, f1(arr, 0));
|
assertEquals(0.5, f1(arr, 0));
|
||||||
assertEquals(0.5, f1(arr, 0));
|
assertEquals(0.5, f1(arr, 0));
|
||||||
|
@ -101,6 +101,7 @@ let tests = {
|
|||||||
let { array, expected, array2, expected2 } = tests[key];
|
let { array, expected, array2, expected2 } = tests[key];
|
||||||
|
|
||||||
// Warmup:
|
// Warmup:
|
||||||
|
%PrepareFunctionForOptimization(fn);
|
||||||
fn(array);
|
fn(array);
|
||||||
fn(array);
|
fn(array);
|
||||||
%OptimizeFunctionOnNextCall(fn);
|
%OptimizeFunctionOnNextCall(fn);
|
||||||
@ -203,6 +204,7 @@ let tests = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Warmup
|
// Warmup
|
||||||
|
%PrepareFunctionForOptimization(sum);
|
||||||
sum(array);
|
sum(array);
|
||||||
sum(array);
|
sum(array);
|
||||||
%OptimizeFunctionOnNextCall(sum);
|
%OptimizeFunctionOnNextCall(sum);
|
||||||
|
@ -34,6 +34,7 @@ var functions = [ f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
|
|||||||
|
|
||||||
for (var i = 0; i < functions.length; ++i) {
|
for (var i = 0; i < functions.length; ++i) {
|
||||||
var func = functions[i];
|
var func = functions[i];
|
||||||
|
%PrepareFunctionForOptimization(func);
|
||||||
print("Testing:");
|
print("Testing:");
|
||||||
print(func);
|
print(func);
|
||||||
for (var j = 0; j < 10; ++j) {
|
for (var j = 0; j < 10; ++j) {
|
||||||
@ -315,6 +316,7 @@ function TestThrow() {
|
|||||||
throw x;
|
throw x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
for (var i = 0; i < 5; i++) {
|
for (var i = 0; i < 5; i++) {
|
||||||
try {
|
try {
|
||||||
f();
|
f();
|
||||||
@ -339,6 +341,7 @@ TestThrow();
|
|||||||
function TestFunctionLocal(s) {
|
function TestFunctionLocal(s) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var func = eval("(function baz(){" + s + "; })");
|
var func = eval("(function baz(){" + s + "; })");
|
||||||
|
%PrepareFunctionForOptimization(func);
|
||||||
print("Testing:");
|
print("Testing:");
|
||||||
print(func);
|
print(func);
|
||||||
for (var i = 0; i < 5; ++i) {
|
for (var i = 0; i < 5; ++i) {
|
||||||
@ -361,6 +364,7 @@ function TestFunctionLocal(s) {
|
|||||||
function TestFunctionContext(s) {
|
function TestFunctionContext(s) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var func = eval("(function baz(){ " + s + "; (function() { x; }); })");
|
var func = eval("(function baz(){ " + s + "; (function() { x; }); })");
|
||||||
|
%PrepareFunctionForOptimization(func);
|
||||||
print("Testing:");
|
print("Testing:");
|
||||||
print(func);
|
print(func);
|
||||||
for (var i = 0; i < 5; ++i) {
|
for (var i = 0; i < 5; ++i) {
|
||||||
@ -387,6 +391,7 @@ function TestFunctionContext(s) {
|
|||||||
function TestBlockLocal(s) {
|
function TestBlockLocal(s) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var func = eval("(function baz(){ { " + s + "; } })");
|
var func = eval("(function baz(){ { " + s + "; } })");
|
||||||
|
%PrepareFunctionForOptimization(func);
|
||||||
print("Testing:");
|
print("Testing:");
|
||||||
print(func);
|
print(func);
|
||||||
for (var i = 0; i < 5; ++i) {
|
for (var i = 0; i < 5; ++i) {
|
||||||
@ -409,6 +414,7 @@ function TestBlockLocal(s) {
|
|||||||
function TestBlockContext(s) {
|
function TestBlockContext(s) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var func = eval("(function baz(){ { " + s + "; (function() { x; }); } })");
|
var func = eval("(function baz(){ { " + s + "; (function() { x; }); } })");
|
||||||
|
%PrepareFunctionForOptimization(func);
|
||||||
print("Testing:");
|
print("Testing:");
|
||||||
print(func);
|
print(func);
|
||||||
for (var i = 0; i < 5; ++i) {
|
for (var i = 0; i < 5; ++i) {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
return maxWithZero(x, y);
|
return maxWithZero(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(testMax);
|
||||||
testMax(1, 2);
|
testMax(1, 2);
|
||||||
testMax(1, 2);
|
testMax(1, 2);
|
||||||
%OptimizeFunctionOnNextCall(testMax);
|
%OptimizeFunctionOnNextCall(testMax);
|
||||||
|
@ -728,6 +728,9 @@ function assertAccessorDescriptor(object, name) {
|
|||||||
function invoke_constructor() { A() }
|
function invoke_constructor() { A() }
|
||||||
function call_constructor() { A.call() }
|
function call_constructor() { A.call() }
|
||||||
function apply_constructor() { A.apply() }
|
function apply_constructor() { A.apply() }
|
||||||
|
%PrepareFunctionForOptimization(invoke_constructor);
|
||||||
|
%PrepareFunctionForOptimization(call_constructor);
|
||||||
|
%PrepareFunctionForOptimization(apply_constructor);
|
||||||
|
|
||||||
for (var i=0; i<3; i++) {
|
for (var i=0; i<3; i++) {
|
||||||
assertThrows(invoke_constructor);
|
assertThrows(invoke_constructor);
|
||||||
@ -1106,6 +1109,7 @@ function testClassRestrictedProperties(C) {
|
|||||||
" return new clazz(i); })";
|
" return new clazz(i); })";
|
||||||
|
|
||||||
let fn = eval(evalString);
|
let fn = eval(evalString);
|
||||||
|
%PrepareFunctionForOptimization(fn);
|
||||||
assertEquals(fn(1).value, 1);
|
assertEquals(fn(1).value, 1);
|
||||||
assertEquals(fn(2).value, 2);
|
assertEquals(fn(2).value, 2);
|
||||||
assertEquals(fn(3).value, 3);
|
assertEquals(fn(3).value, 3);
|
||||||
@ -1138,6 +1142,7 @@ function testClassRestrictedProperties(C) {
|
|||||||
|
|
||||||
let fn = eval(evalString);
|
let fn = eval(evalString);
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(fn);
|
||||||
assertEquals(fn(1).value, 1);
|
assertEquals(fn(1).value, 1);
|
||||||
assertEquals(fn(2).value, 2);
|
assertEquals(fn(2).value, 2);
|
||||||
assertEquals(fn(3).value, 3);
|
assertEquals(fn(3).value, 3);
|
||||||
@ -1174,6 +1179,7 @@ function testClassRestrictedProperties(C) {
|
|||||||
" return (new clazz(i)); })";
|
" return (new clazz(i)); })";
|
||||||
|
|
||||||
let fn = eval(evalString);
|
let fn = eval(evalString);
|
||||||
|
%PrepareFunctionForOptimization(fn);
|
||||||
assertEquals(fn(1).value, 1);
|
assertEquals(fn(1).value, 1);
|
||||||
assertEquals(fn(2).value, 2);
|
assertEquals(fn(2).value, 2);
|
||||||
assertEquals(fn(3).value, 3);
|
assertEquals(fn(3).value, 3);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
// Flags: --allow-natives-syntax
|
// Flags: --allow-natives-syntax
|
||||||
|
|
||||||
function test(f) {
|
function test(f) {
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
f();
|
f();
|
||||||
f();
|
f();
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
|
@ -25,6 +25,7 @@ function TestSetWithModifiedIterator(ctor) {
|
|||||||
|
|
||||||
arrayIteratorProto.next = originalNext;
|
arrayIteratorProto.next = originalNext;
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(TestSetWithModifiedIterator);
|
||||||
TestSetWithModifiedIterator(Set);
|
TestSetWithModifiedIterator(Set);
|
||||||
TestSetWithModifiedIterator(Set);
|
TestSetWithModifiedIterator(Set);
|
||||||
TestSetWithModifiedIterator(Set);
|
TestSetWithModifiedIterator(Set);
|
||||||
@ -33,6 +34,7 @@ TestSetWithModifiedIterator(Set);
|
|||||||
assertOptimized(TestSetWithModifiedIterator);
|
assertOptimized(TestSetWithModifiedIterator);
|
||||||
%DeoptimizeFunction(TestSetWithModifiedIterator);
|
%DeoptimizeFunction(TestSetWithModifiedIterator);
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(TestSetWithModifiedIterator);
|
||||||
TestSetWithModifiedIterator(WeakSet);
|
TestSetWithModifiedIterator(WeakSet);
|
||||||
TestSetWithModifiedIterator(WeakSet);
|
TestSetWithModifiedIterator(WeakSet);
|
||||||
TestSetWithModifiedIterator(WeakSet);
|
TestSetWithModifiedIterator(WeakSet);
|
||||||
@ -63,6 +65,7 @@ function TestMapWithModifiedIterator(ctor) {
|
|||||||
|
|
||||||
arrayIteratorProto.next = originalNext;
|
arrayIteratorProto.next = originalNext;
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(TestMapWithModifiedIterator);
|
||||||
TestMapWithModifiedIterator(Map);
|
TestMapWithModifiedIterator(Map);
|
||||||
TestMapWithModifiedIterator(Map);
|
TestMapWithModifiedIterator(Map);
|
||||||
TestMapWithModifiedIterator(Map);
|
TestMapWithModifiedIterator(Map);
|
||||||
@ -71,6 +74,7 @@ TestMapWithModifiedIterator(Map);
|
|||||||
assertOptimized(TestMapWithModifiedIterator);
|
assertOptimized(TestMapWithModifiedIterator);
|
||||||
%DeoptimizeFunction(TestMapWithModifiedIterator);
|
%DeoptimizeFunction(TestMapWithModifiedIterator);
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(TestMapWithModifiedIterator);
|
||||||
TestMapWithModifiedIterator(WeakMap);
|
TestMapWithModifiedIterator(WeakMap);
|
||||||
TestMapWithModifiedIterator(WeakMap);
|
TestMapWithModifiedIterator(WeakMap);
|
||||||
TestMapWithModifiedIterator(WeakMap);
|
TestMapWithModifiedIterator(WeakMap);
|
||||||
|
@ -20,6 +20,7 @@ function TestSetWithCustomIterator(ctor) {
|
|||||||
assertTrue(set.has(k2));
|
assertTrue(set.has(k2));
|
||||||
assertEquals(2, callCount);
|
assertEquals(2, callCount);
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(TestSetWithCustomIterator);
|
||||||
TestSetWithCustomIterator(Set);
|
TestSetWithCustomIterator(Set);
|
||||||
TestSetWithCustomIterator(Set);
|
TestSetWithCustomIterator(Set);
|
||||||
TestSetWithCustomIterator(Set);
|
TestSetWithCustomIterator(Set);
|
||||||
@ -28,6 +29,7 @@ TestSetWithCustomIterator(Set);
|
|||||||
assertOptimized(TestSetWithCustomIterator);
|
assertOptimized(TestSetWithCustomIterator);
|
||||||
|
|
||||||
TestSetWithCustomIterator(WeakSet);
|
TestSetWithCustomIterator(WeakSet);
|
||||||
|
%PrepareFunctionForOptimization(TestSetWithCustomIterator);
|
||||||
TestSetWithCustomIterator(WeakSet);
|
TestSetWithCustomIterator(WeakSet);
|
||||||
TestSetWithCustomIterator(WeakSet);
|
TestSetWithCustomIterator(WeakSet);
|
||||||
%OptimizeFunctionOnNextCall(TestSetWithCustomIterator);
|
%OptimizeFunctionOnNextCall(TestSetWithCustomIterator);
|
||||||
@ -50,6 +52,7 @@ function TestMapWithCustomIterator(ctor) {
|
|||||||
assertEquals(2, map.get(k2));
|
assertEquals(2, map.get(k2));
|
||||||
assertEquals(2, callCount);
|
assertEquals(2, callCount);
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(TestMapWithCustomIterator);
|
||||||
TestMapWithCustomIterator(Map);
|
TestMapWithCustomIterator(Map);
|
||||||
TestMapWithCustomIterator(Map);
|
TestMapWithCustomIterator(Map);
|
||||||
TestMapWithCustomIterator(Map);
|
TestMapWithCustomIterator(Map);
|
||||||
@ -58,6 +61,7 @@ TestMapWithCustomIterator(Map);
|
|||||||
assertOptimized(TestMapWithCustomIterator);
|
assertOptimized(TestMapWithCustomIterator);
|
||||||
|
|
||||||
TestMapWithCustomIterator(WeakMap);
|
TestMapWithCustomIterator(WeakMap);
|
||||||
|
%PrepareFunctionForOptimization(TestMapWithCustomIterator);
|
||||||
TestMapWithCustomIterator(WeakMap);
|
TestMapWithCustomIterator(WeakMap);
|
||||||
TestMapWithCustomIterator(WeakMap);
|
TestMapWithCustomIterator(WeakMap);
|
||||||
%OptimizeFunctionOnNextCall(TestMapWithCustomIterator);
|
%OptimizeFunctionOnNextCall(TestMapWithCustomIterator);
|
||||||
|
@ -24,6 +24,7 @@ function TestSetPrototypeModified(ctor) {
|
|||||||
|
|
||||||
ctor.prototype.add = originalPrototypeAdd;
|
ctor.prototype.add = originalPrototypeAdd;
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(TestSetPrototypeModified);
|
||||||
TestSetPrototypeModified(Set);
|
TestSetPrototypeModified(Set);
|
||||||
TestSetPrototypeModified(Set);
|
TestSetPrototypeModified(Set);
|
||||||
TestSetPrototypeModified(Set);
|
TestSetPrototypeModified(Set);
|
||||||
@ -32,6 +33,7 @@ TestSetPrototypeModified(Set);
|
|||||||
assertOptimized(TestSetPrototypeModified);
|
assertOptimized(TestSetPrototypeModified);
|
||||||
%DeoptimizeFunction(TestSetPrototypeModified);
|
%DeoptimizeFunction(TestSetPrototypeModified);
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(TestSetPrototypeModified);
|
||||||
TestSetPrototypeModified(WeakSet);
|
TestSetPrototypeModified(WeakSet);
|
||||||
TestSetPrototypeModified(WeakSet);
|
TestSetPrototypeModified(WeakSet);
|
||||||
TestSetPrototypeModified(WeakSet);
|
TestSetPrototypeModified(WeakSet);
|
||||||
@ -60,6 +62,7 @@ function TestMapPrototypeModified(ctor) {
|
|||||||
|
|
||||||
ctor.prototype.set = originalPrototypeSet;
|
ctor.prototype.set = originalPrototypeSet;
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(TestMapPrototypeModified);
|
||||||
TestMapPrototypeModified(Map);
|
TestMapPrototypeModified(Map);
|
||||||
TestMapPrototypeModified(Map);
|
TestMapPrototypeModified(Map);
|
||||||
TestMapPrototypeModified(Map);
|
TestMapPrototypeModified(Map);
|
||||||
@ -68,6 +71,7 @@ TestMapPrototypeModified(Map);
|
|||||||
assertOptimized(TestMapPrototypeModified);
|
assertOptimized(TestMapPrototypeModified);
|
||||||
%DeoptimizeFunction(TestMapPrototypeModified);
|
%DeoptimizeFunction(TestMapPrototypeModified);
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(TestMapPrototypeModified);
|
||||||
TestMapPrototypeModified(WeakMap);
|
TestMapPrototypeModified(WeakMap);
|
||||||
TestMapPrototypeModified(WeakMap);
|
TestMapPrototypeModified(WeakMap);
|
||||||
TestMapPrototypeModified(WeakMap);
|
TestMapPrototypeModified(WeakMap);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
return { [name]: value, __proto__: deoptMe() };
|
return { [name]: value, __proto__: deoptMe() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
checkObject("a", 1, f("a", 1));
|
checkObject("a", 1, f("a", 1));
|
||||||
checkObject("b", 2, f("b", 2));
|
checkObject("b", 2, f("b", 2));
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
|
@ -20,6 +20,7 @@ function g({x = {a:10,b:20}},
|
|||||||
assertSame(0, n.length);
|
assertSame(0, n.length);
|
||||||
assertTrue(p.test("abc"));
|
assertTrue(p.test("abc"));
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(g);
|
||||||
g({},{});
|
g({},{});
|
||||||
%OptimizeFunctionOnNextCall(g);
|
%OptimizeFunctionOnNextCall(g);
|
||||||
g({},{});
|
g({},{});
|
||||||
@ -35,6 +36,7 @@ var h = ({x = {a:10,b:20}},
|
|||||||
assertSame(0, n.length);
|
assertSame(0, n.length);
|
||||||
assertTrue(p.test("abc"));
|
assertTrue(p.test("abc"));
|
||||||
};
|
};
|
||||||
|
%PrepareFunctionForOptimization(h);
|
||||||
h({},{});
|
h({},{});
|
||||||
%OptimizeFunctionOnNextCall(h);
|
%OptimizeFunctionOnNextCall(h);
|
||||||
h({},{});
|
h({},{});
|
||||||
|
@ -49,6 +49,7 @@ check();
|
|||||||
|
|
||||||
function f() { return array["-1"]; }
|
function f() { return array["-1"]; }
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
for (var i = 0; i < 3; i++) {
|
for (var i = 0; i < 3; i++) {
|
||||||
assertEquals(undefined, f());
|
assertEquals(undefined, f());
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ function TestMapConstructorEntrySideEffect(ctor) {
|
|||||||
ctor.prototype.set = originalPrototypeSet;
|
ctor.prototype.set = originalPrototypeSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(TestMapConstructorEntrySideEffect);
|
||||||
TestMapConstructorEntrySideEffect(Map);
|
TestMapConstructorEntrySideEffect(Map);
|
||||||
TestMapConstructorEntrySideEffect(Map);
|
TestMapConstructorEntrySideEffect(Map);
|
||||||
TestMapConstructorEntrySideEffect(Map);
|
TestMapConstructorEntrySideEffect(Map);
|
||||||
@ -45,7 +46,9 @@ TestMapConstructorEntrySideEffect(Map);
|
|||||||
TestMapConstructorEntrySideEffect(Map);
|
TestMapConstructorEntrySideEffect(Map);
|
||||||
assertOptimized(TestMapConstructorEntrySideEffect);
|
assertOptimized(TestMapConstructorEntrySideEffect);
|
||||||
|
|
||||||
|
// This call would deopt
|
||||||
TestMapConstructorEntrySideEffect(WeakMap);
|
TestMapConstructorEntrySideEffect(WeakMap);
|
||||||
|
%PrepareFunctionForOptimization(TestMapConstructorEntrySideEffect);
|
||||||
TestMapConstructorEntrySideEffect(WeakMap);
|
TestMapConstructorEntrySideEffect(WeakMap);
|
||||||
TestMapConstructorEntrySideEffect(WeakMap);
|
TestMapConstructorEntrySideEffect(WeakMap);
|
||||||
%OptimizeFunctionOnNextCall(TestMapConstructorEntrySideEffect);
|
%OptimizeFunctionOnNextCall(TestMapConstructorEntrySideEffect);
|
||||||
|
@ -38,6 +38,7 @@ function TestMapConstructorEntrySideEffect(ctor) {
|
|||||||
assertEquals(3, col.get(k3));
|
assertEquals(3, col.get(k3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(TestMapConstructorEntrySideEffect);
|
||||||
TestMapConstructorEntrySideEffect(Map);
|
TestMapConstructorEntrySideEffect(Map);
|
||||||
TestMapConstructorEntrySideEffect(Map);
|
TestMapConstructorEntrySideEffect(Map);
|
||||||
TestMapConstructorEntrySideEffect(Map);
|
TestMapConstructorEntrySideEffect(Map);
|
||||||
@ -45,7 +46,9 @@ TestMapConstructorEntrySideEffect(Map);
|
|||||||
TestMapConstructorEntrySideEffect(Map);
|
TestMapConstructorEntrySideEffect(Map);
|
||||||
assertOptimized(TestMapConstructorEntrySideEffect);
|
assertOptimized(TestMapConstructorEntrySideEffect);
|
||||||
|
|
||||||
|
// This call would deopt
|
||||||
TestMapConstructorEntrySideEffect(WeakMap);
|
TestMapConstructorEntrySideEffect(WeakMap);
|
||||||
|
%PrepareFunctionForOptimization(TestMapConstructorEntrySideEffect);
|
||||||
TestMapConstructorEntrySideEffect(WeakMap);
|
TestMapConstructorEntrySideEffect(WeakMap);
|
||||||
TestMapConstructorEntrySideEffect(WeakMap);
|
TestMapConstructorEntrySideEffect(WeakMap);
|
||||||
%OptimizeFunctionOnNextCall(TestMapConstructorEntrySideEffect);
|
%OptimizeFunctionOnNextCall(TestMapConstructorEntrySideEffect);
|
||||||
|
@ -30,6 +30,7 @@ function f(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
f(5);
|
f(5);
|
||||||
f(5);
|
f(5);
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
|
@ -19,6 +19,7 @@ assertTrue(isNaN(Math.fround({ valueOf: function() { return "abc"; } })));
|
|||||||
function unopt(x) { return Math.fround(x); }
|
function unopt(x) { return Math.fround(x); }
|
||||||
function opt(y) { return Math.fround(y); }
|
function opt(y) { return Math.fround(y); }
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(opt);
|
||||||
opt(0.1);
|
opt(0.1);
|
||||||
opt(0.1);
|
opt(0.1);
|
||||||
unopt(0.1);
|
unopt(0.1);
|
||||||
|
@ -35,12 +35,14 @@ function testTrunc(expected, input) {
|
|||||||
assertEquals(expected, test(input));
|
assertEquals(expected, test(input));
|
||||||
assertEquals(expected, test(input));
|
assertEquals(expected, test(input));
|
||||||
assertEquals(expected, test(input));
|
assertEquals(expected, test(input));
|
||||||
|
%PrepareFunctionForOptimization(test);
|
||||||
%OptimizeFunctionOnNextCall(test);
|
%OptimizeFunctionOnNextCall(test);
|
||||||
assertEquals(expected, test(input));
|
assertEquals(expected, test(input));
|
||||||
|
|
||||||
var test_double_input = new Function(
|
var test_double_input = new Function(
|
||||||
'n',
|
'n',
|
||||||
'"' + (test_id++) + '";return Math.trunc(+n)');
|
'"' + (test_id++) + '";return Math.trunc(+n)');
|
||||||
|
%PrepareFunctionForOptimization(test_double_input);
|
||||||
assertEquals(expected, test_double_input(input));
|
assertEquals(expected, test_double_input(input));
|
||||||
assertEquals(expected, test_double_input(input));
|
assertEquals(expected, test_double_input(input));
|
||||||
assertEquals(expected, test_double_input(input));
|
assertEquals(expected, test_double_input(input));
|
||||||
@ -50,6 +52,7 @@ function testTrunc(expected, input) {
|
|||||||
var test_double_output = new Function(
|
var test_double_output = new Function(
|
||||||
'n',
|
'n',
|
||||||
'"' + (test_id++) + '";return Math.trunc(n) + -0.0');
|
'"' + (test_id++) + '";return Math.trunc(n) + -0.0');
|
||||||
|
%PrepareFunctionForOptimization(test_double_output);
|
||||||
assertEquals(expected, test_double_output(input));
|
assertEquals(expected, test_double_output(input));
|
||||||
assertEquals(expected, test_double_output(input));
|
assertEquals(expected, test_double_output(input));
|
||||||
assertEquals(expected, test_double_output(input));
|
assertEquals(expected, test_double_output(input));
|
||||||
@ -63,6 +66,7 @@ function test() {
|
|||||||
function itrunc(x) {
|
function itrunc(x) {
|
||||||
return 1 / Math.trunc(x);
|
return 1 / Math.trunc(x);
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(itrunc);
|
||||||
assertEquals(Infinity, itrunc(0));
|
assertEquals(Infinity, itrunc(0));
|
||||||
assertEquals(-Infinity, itrunc(-0));
|
assertEquals(-Infinity, itrunc(-0));
|
||||||
assertEquals(Infinity, itrunc(Math.PI / 4));
|
assertEquals(Infinity, itrunc(Math.PI / 4));
|
||||||
|
@ -144,6 +144,7 @@
|
|||||||
var object = {
|
var object = {
|
||||||
method() { return 42; }
|
method() { return 42; }
|
||||||
};
|
};
|
||||||
|
%PrepareFunctionForOptimization(object.method);
|
||||||
assertEquals(42, object.method());
|
assertEquals(42, object.method());
|
||||||
assertEquals(42, object.method());
|
assertEquals(42, object.method());
|
||||||
%OptimizeFunctionOnNextCall(object.method);
|
%OptimizeFunctionOnNextCall(object.method);
|
||||||
|
@ -966,6 +966,7 @@ assertTrue(
|
|||||||
obj2 = Object.create(obj1);
|
obj2 = Object.create(obj1);
|
||||||
obj3 = Object.create(obj2);
|
obj3 = Object.create(obj2);
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(testGetterOnProto);
|
||||||
testGetterOnProto(111, obj3);
|
testGetterOnProto(111, obj3);
|
||||||
testGetterOnProto(111, obj3);
|
testGetterOnProto(111, obj3);
|
||||||
%OptimizeFunctionOnNextCall(testGetterOnProto);
|
%OptimizeFunctionOnNextCall(testGetterOnProto);
|
||||||
@ -974,6 +975,7 @@ testGetterOnProto(111, obj3);
|
|||||||
|
|
||||||
assertTrue(Reflect.defineProperty(obj1, "quebec", { get: anotherGetter }));
|
assertTrue(Reflect.defineProperty(obj1, "quebec", { get: anotherGetter }));
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(testGetterOnProto);
|
||||||
testGetterOnProto(222, obj3);
|
testGetterOnProto(222, obj3);
|
||||||
testGetterOnProto(222, obj3);
|
testGetterOnProto(222, obj3);
|
||||||
%OptimizeFunctionOnNextCall(testGetterOnProto);
|
%OptimizeFunctionOnNextCall(testGetterOnProto);
|
||||||
@ -997,6 +999,7 @@ assertTrue(
|
|||||||
obj2 = Object.create(obj1);
|
obj2 = Object.create(obj1);
|
||||||
obj3 = Object.create(obj2);
|
obj3 = Object.create(obj2);
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(testSetterOnProto);
|
||||||
testSetterOnProto(445, obj3);
|
testSetterOnProto(445, obj3);
|
||||||
testSetterOnProto(445, obj3);
|
testSetterOnProto(445, obj3);
|
||||||
%OptimizeFunctionOnNextCall(testSetterOnProto);
|
%OptimizeFunctionOnNextCall(testSetterOnProto);
|
||||||
@ -1005,6 +1008,7 @@ testSetterOnProto(445, obj3);
|
|||||||
|
|
||||||
assertTrue(Reflect.defineProperty(obj1, "romeo", { set: anotherSetter }));
|
assertTrue(Reflect.defineProperty(obj1, "romeo", { set: anotherSetter }));
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(testSetterOnProto);
|
||||||
testSetterOnProto(446, obj3);
|
testSetterOnProto(446, obj3);
|
||||||
testSetterOnProto(446, obj3);
|
testSetterOnProto(446, obj3);
|
||||||
%OptimizeFunctionOnNextCall(testSetterOnProto);
|
%OptimizeFunctionOnNextCall(testSetterOnProto);
|
||||||
@ -1023,6 +1027,7 @@ assertTrue(Reflect.defineProperty(obj1, "sierra",
|
|||||||
obj2 = Object.create(obj1);
|
obj2 = Object.create(obj1);
|
||||||
obj3 = Object.create(obj2);
|
obj3 = Object.create(obj2);
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(testSetterOnProtoStrict);
|
||||||
testSetterOnProtoStrict(obj3);
|
testSetterOnProtoStrict(obj3);
|
||||||
testSetterOnProtoStrict(obj3);
|
testSetterOnProtoStrict(obj3);
|
||||||
%OptimizeFunctionOnNextCall(testSetterOnProtoStrict);
|
%OptimizeFunctionOnNextCall(testSetterOnProtoStrict);
|
||||||
@ -1051,6 +1056,7 @@ function Assign(o) {
|
|||||||
|
|
||||||
function C() {}
|
function C() {}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(Assign);
|
||||||
Assign(new C);
|
Assign(new C);
|
||||||
Assign(new C);
|
Assign(new C);
|
||||||
%OptimizeFunctionOnNextCall(Assign);
|
%OptimizeFunctionOnNextCall(Assign);
|
||||||
|
@ -8,6 +8,7 @@ function foo() {
|
|||||||
return Math.clz32(12.34);
|
return Math.clz32(12.34);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(foo);
|
||||||
foo();
|
foo();
|
||||||
foo();
|
foo();
|
||||||
%OptimizeFunctionOnNextCall(foo);
|
%OptimizeFunctionOnNextCall(foo);
|
||||||
|
@ -19,6 +19,7 @@ function f24(deopt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f24);
|
||||||
for (var j = 0; j < 10; ++j) {
|
for (var j = 0; j < 10; ++j) {
|
||||||
f24(12);
|
f24(12);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
// Flags: --allow-natives-syntax
|
// Flags: --allow-natives-syntax
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(print);
|
||||||
try {
|
try {
|
||||||
%OptimizeFunctionOnNextCall(print);
|
%OptimizeFunctionOnNextCall(print);
|
||||||
} catch(e) { }
|
} catch(e) { }
|
||||||
@ -11,5 +12,6 @@ try {
|
|||||||
try {
|
try {
|
||||||
function* f() {
|
function* f() {
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
} catch(e) { }
|
} catch(e) { }
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
(function(x) {
|
(function(x) {
|
||||||
(function(x) {
|
(function(x) {
|
||||||
var boom = (() => eval(x));
|
var boom = (() => eval(x));
|
||||||
|
%PrepareFunctionForOptimization(boom);
|
||||||
assertEquals(23, boom());
|
assertEquals(23, boom());
|
||||||
assertEquals(23, boom());
|
assertEquals(23, boom());
|
||||||
%OptimizeFunctionOnNextCall(boom);
|
%OptimizeFunctionOnNextCall(boom);
|
||||||
@ -19,6 +20,7 @@
|
|||||||
(function(x) {
|
(function(x) {
|
||||||
(function(x) {
|
(function(x) {
|
||||||
var boom = (() => (eval("var x = 66"), x));
|
var boom = (() => (eval("var x = 66"), x));
|
||||||
|
%PrepareFunctionForOptimization(boom);
|
||||||
assertEquals(66, boom());
|
assertEquals(66, boom());
|
||||||
assertEquals(66, boom());
|
assertEquals(66, boom());
|
||||||
%OptimizeFunctionOnNextCall(boom);
|
%OptimizeFunctionOnNextCall(boom);
|
||||||
|
@ -17,6 +17,7 @@ function g() {
|
|||||||
f(6, 5, 4, 3, 2, 1);
|
f(6, 5, 4, 3, 2, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(g);
|
||||||
g();
|
g();
|
||||||
g();
|
g();
|
||||||
g();
|
g();
|
||||||
|
@ -9,6 +9,7 @@ function fn(a) {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(fn);
|
||||||
fn('a');
|
fn('a');
|
||||||
fn('a');
|
fn('a');
|
||||||
%OptimizeFunctionOnNextCall(fn);
|
%OptimizeFunctionOnNextCall(fn);
|
||||||
|
@ -22,6 +22,7 @@ function testArray() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(testArray);
|
||||||
testArray();
|
testArray();
|
||||||
testArray();
|
testArray();
|
||||||
%OptimizeFunctionOnNextCall(testArray);
|
%OptimizeFunctionOnNextCall(testArray);
|
||||||
@ -33,6 +34,7 @@ function testTypedArray() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(testTypedArray);
|
||||||
testTypedArray();
|
testTypedArray();
|
||||||
testTypedArray();
|
testTypedArray();
|
||||||
%OptimizeFunctionOnNextCall(testTypedArray);
|
%OptimizeFunctionOnNextCall(testTypedArray);
|
||||||
|
@ -8,6 +8,7 @@ function bar() {}
|
|||||||
bar({ a: new Proxy({}, {}) });
|
bar({ a: new Proxy({}, {}) });
|
||||||
function foo(x) { x.a.b == ""; }
|
function foo(x) { x.a.b == ""; }
|
||||||
var x = {a: {b: "" }};
|
var x = {a: {b: "" }};
|
||||||
|
%PrepareFunctionForOptimization(foo);
|
||||||
foo(x);
|
foo(x);
|
||||||
foo(x);
|
foo(x);
|
||||||
%OptimizeFunctionOnNextCall(foo);
|
%OptimizeFunctionOnNextCall(foo);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
function g() { return { val: new.target }; }
|
function g() { return { val: new.target }; }
|
||||||
function f() { return (new g()).val; }
|
function f() { return (new g()).val; }
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertEquals(g, f());
|
assertEquals(g, f());
|
||||||
assertEquals(g, f());
|
assertEquals(g, f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
|
@ -160,6 +160,7 @@ function id(v) {
|
|||||||
function f() {
|
function f() {
|
||||||
return [...'abc'];
|
return [...'abc'];
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertArrayEquals(['a', 'b', 'c'], f());
|
assertArrayEquals(['a', 'b', 'c'], f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertArrayEquals(['a', 'b', 'c'], f());
|
assertArrayEquals(['a', 'b', 'c'], f());
|
||||||
@ -194,6 +195,7 @@ function id(v) {
|
|||||||
return ['a', ...['b', 'c', 'd'], 'e']
|
return ['a', ...['b', 'c', 'd'], 'e']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
@ -211,6 +213,7 @@ function id(v) {
|
|||||||
return ['a', ...['b', 'c', 'd'], 'e']
|
return ['a', ...['b', 'c', 'd'], 'e']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
@ -228,6 +231,7 @@ function id(v) {
|
|||||||
return ['a', ...['b', 'c', 'd'], 'e']
|
return ['a', ...['b', 'c', 'd'], 'e']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
|
@ -157,6 +157,7 @@ function id(v) {
|
|||||||
function f() {
|
function f() {
|
||||||
return [...'abc'];
|
return [...'abc'];
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertArrayEquals(['a', 'b', 'c'], f());
|
assertArrayEquals(['a', 'b', 'c'], f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertArrayEquals(['a', 'b', 'c'], f());
|
assertArrayEquals(['a', 'b', 'c'], f());
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
return ['a', ...['b', 'c', 'd'], 'e']
|
return ['a', ...['b', 'c', 'd'], 'e']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
return ['a', ...['b', 'c', 'd'], 'e']
|
return ['a', ...['b', 'c', 'd'], 'e']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
return ['a', ...['b', 'c', 'd'], 'e']
|
return ['a', ...['b', 'c', 'd'], 'e']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
assertArrayEquals(['a', 'b', 'c', 'd', 'e'], f());
|
||||||
|
@ -161,6 +161,7 @@ function testSpreadCallsStrict() {
|
|||||||
assertEquals(36, O.sum(0, ...[1], 2, 3, ...[4, 5], 6, 7, 8));
|
assertEquals(36, O.sum(0, ...[1], 2, 3, ...[4, 5], 6, 7, 8));
|
||||||
assertEquals(45, O.sum(0, ...[1], 2, 3, ...[4, 5], 6, 7, 8, ...[9]));
|
assertEquals(45, O.sum(0, ...[1], 2, 3, ...[4, 5], 6, 7, 8, ...[9]));
|
||||||
};
|
};
|
||||||
|
%PrepareFunctionForOptimization(testSpreadCallsStrict);
|
||||||
testSpreadCallsStrict();
|
testSpreadCallsStrict();
|
||||||
%OptimizeFunctionOnNextCall(testSpreadCallsStrict);
|
%OptimizeFunctionOnNextCall(testSpreadCallsStrict);
|
||||||
testSpreadCallsStrict();
|
testSpreadCallsStrict();
|
||||||
|
@ -43,6 +43,7 @@ function isValidSymbolString(s) {
|
|||||||
function TestNew() {
|
function TestNew() {
|
||||||
function indirectSymbol() { return Symbol() }
|
function indirectSymbol() { return Symbol() }
|
||||||
function indirect() { return indirectSymbol() }
|
function indirect() { return indirectSymbol() }
|
||||||
|
%PrepareFunctionForOptimization(indirect);
|
||||||
for (var i = 0; i < 2; ++i) {
|
for (var i = 0; i < 2; ++i) {
|
||||||
for (var j = 0; j < 5; ++j) {
|
for (var j = 0; j < 5; ++j) {
|
||||||
symbols.push(Symbol())
|
symbols.push(Symbol())
|
||||||
@ -519,6 +520,7 @@ function TestComparison() {
|
|||||||
var throwFuncs = [lt, gt, le, ge, lt_same, gt_same, le_same, ge_same];
|
var throwFuncs = [lt, gt, le, ge, lt_same, gt_same, le_same, ge_same];
|
||||||
|
|
||||||
for (var f of throwFuncs) {
|
for (var f of throwFuncs) {
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
assertThrows(f, TypeError);
|
assertThrows(f, TypeError);
|
||||||
%OptimizeFunctionOnNextCall(f);
|
%OptimizeFunctionOnNextCall(f);
|
||||||
assertThrows(f, TypeError);
|
assertThrows(f, TypeError);
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return a.filter(callback);
|
return a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(eagerDeoptInCalled);
|
||||||
eagerDeoptInCalled();
|
eagerDeoptInCalled();
|
||||||
eagerDeoptInCalled();
|
eagerDeoptInCalled();
|
||||||
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
|
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
|
||||||
@ -43,7 +44,8 @@
|
|||||||
return i == 0 ? false : true;
|
return i == 0 ? false : true;
|
||||||
}
|
}
|
||||||
return a.filter(callback);
|
return a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(eagerDeoptInCalled);
|
||||||
var like_a = [1,2,3,4,5,6,7,8,9,10];
|
var like_a = [1,2,3,4,5,6,7,8,9,10];
|
||||||
assertEquals(like_a.slice(1), eagerDeoptInCalled());
|
assertEquals(like_a.slice(1), eagerDeoptInCalled());
|
||||||
eagerDeoptInCalled();
|
eagerDeoptInCalled();
|
||||||
@ -66,7 +68,8 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return a.filter(callback);
|
return a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyChanger);
|
||||||
assertEquals(a, lazyChanger());
|
assertEquals(a, lazyChanger());
|
||||||
lazyChanger();
|
lazyChanger();
|
||||||
%OptimizeFunctionOnNextCall(lazyChanger);
|
%OptimizeFunctionOnNextCall(lazyChanger);
|
||||||
@ -88,7 +91,8 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return a.filter(callback);
|
return a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeselection);
|
||||||
assertEquals(a, lazyDeselection());
|
assertEquals(a, lazyDeselection());
|
||||||
lazyDeselection();
|
lazyDeselection();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeselection);
|
%OptimizeFunctionOnNextCall(lazyDeselection);
|
||||||
@ -111,7 +115,8 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
a_noescape.filter(callback);
|
a_noescape.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(eagerDeoptInCalled);
|
||||||
eagerDeoptInCalled();
|
eagerDeoptInCalled();
|
||||||
eagerDeoptInCalled();
|
eagerDeoptInCalled();
|
||||||
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
|
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
|
||||||
@ -138,7 +143,8 @@
|
|||||||
};
|
};
|
||||||
%NeverOptimizeFunction(callback);
|
%NeverOptimizeFunction(callback);
|
||||||
b.filter(callback);
|
b.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -160,7 +166,8 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
a.filter(callback);
|
a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -184,7 +191,8 @@
|
|||||||
};
|
};
|
||||||
%NeverOptimizeFunction(callback);
|
%NeverOptimizeFunction(callback);
|
||||||
a.filter(callback);
|
a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -209,7 +217,8 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
a.filter(callback);
|
a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -238,7 +247,8 @@
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
caught = true;
|
caught = true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -268,7 +278,8 @@
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
caught = true;
|
caught = true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -299,7 +310,8 @@
|
|||||||
result = "nope";
|
result = "nope";
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
assertEquals([1,2,3,4], lazyDeopt(false));
|
assertEquals([1,2,3,4], lazyDeopt(false));
|
||||||
assertEquals([1,2,3,4], lazyDeopt(false));
|
assertEquals([1,2,3,4], lazyDeopt(false));
|
||||||
assertEquals("nope", lazyDeopt(true));
|
assertEquals("nope", lazyDeopt(true));
|
||||||
@ -326,7 +338,8 @@
|
|||||||
};
|
};
|
||||||
var o = [1,2,3];
|
var o = [1,2,3];
|
||||||
b.filter(callback);
|
b.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -351,7 +364,8 @@
|
|||||||
%NeverOptimizeFunction(callback);
|
%NeverOptimizeFunction(callback);
|
||||||
var o = [1,2,3];
|
var o = [1,2,3];
|
||||||
b.filter(callback);
|
b.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -377,7 +391,8 @@
|
|||||||
};
|
};
|
||||||
var o = [1,2,3];
|
var o = [1,2,3];
|
||||||
b.filter(callback);
|
b.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
lazyDeopt();
|
lazyDeopt();
|
||||||
%OptimizeFunctionOnNextCall(lazyDeopt);
|
%OptimizeFunctionOnNextCall(lazyDeopt);
|
||||||
@ -401,7 +416,8 @@
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
a.filter(callback);
|
a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(lazyDeopt);
|
||||||
assertThrows(() => lazyDeopt());
|
assertThrows(() => lazyDeopt());
|
||||||
assertThrows(() => lazyDeopt());
|
assertThrows(() => lazyDeopt());
|
||||||
try {
|
try {
|
||||||
@ -428,6 +444,7 @@
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(withHoles);
|
||||||
withHoles();
|
withHoles();
|
||||||
withHoles();
|
withHoles();
|
||||||
%OptimizeFunctionOnNextCall(withHoles);
|
%OptimizeFunctionOnNextCall(withHoles);
|
||||||
@ -445,6 +462,7 @@
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
%PrepareFunctionForOptimization(withHoles);
|
||||||
withHoles();
|
withHoles();
|
||||||
withHoles();
|
withHoles();
|
||||||
%OptimizeFunctionOnNextCall(withHoles);
|
%OptimizeFunctionOnNextCall(withHoles);
|
||||||
@ -461,6 +479,7 @@
|
|||||||
return a.filter(x => x % 2 === 0, side_effect(a, b));
|
return a.filter(x => x % 2 === 0, side_effect(a, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(unreliable);
|
||||||
let a = [1, 2, 3];
|
let a = [1, 2, 3];
|
||||||
unreliable(a, false);
|
unreliable(a, false);
|
||||||
unreliable(a, false);
|
unreliable(a, false);
|
||||||
@ -480,7 +499,8 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
a.filter(callback);
|
a.filter(callback);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(species_breakage);
|
||||||
species_breakage();
|
species_breakage();
|
||||||
species_breakage();
|
species_breakage();
|
||||||
%OptimizeFunctionOnNextCall(species_breakage);
|
%OptimizeFunctionOnNextCall(species_breakage);
|
||||||
|
@ -19,7 +19,8 @@ var e = [,,,,0.5,3,4];
|
|||||||
result += i;
|
result += i;
|
||||||
}
|
}
|
||||||
arg.forEach(sum);
|
arg.forEach(sum);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(polymorph1);
|
||||||
polymorph1(a);
|
polymorph1(a);
|
||||||
polymorph1(a);
|
polymorph1(a);
|
||||||
polymorph1(b);
|
polymorph1(b);
|
||||||
@ -39,7 +40,8 @@ var e = [,,,,0.5,3,4];
|
|||||||
result += i;
|
result += i;
|
||||||
}
|
}
|
||||||
arg.forEach(sum);
|
arg.forEach(sum);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(polymorph1);
|
||||||
polymorph1(a);
|
polymorph1(a);
|
||||||
polymorph1(a);
|
polymorph1(a);
|
||||||
polymorph1(b);
|
polymorph1(b);
|
||||||
@ -61,7 +63,8 @@ var e = [,,,,0.5,3,4];
|
|||||||
result += i;
|
result += i;
|
||||||
}
|
}
|
||||||
arg.forEach(sum);
|
arg.forEach(sum);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(polymorph1);
|
||||||
polymorph1(a);
|
polymorph1(a);
|
||||||
polymorph1(a);
|
polymorph1(a);
|
||||||
polymorph1(b);
|
polymorph1(b);
|
||||||
@ -82,7 +85,8 @@ var e = [,,,,0.5,3,4];
|
|||||||
result += v;
|
result += v;
|
||||||
}
|
}
|
||||||
arg.forEach(sum);
|
arg.forEach(sum);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(polymorph1);
|
||||||
polymorph1(d);
|
polymorph1(d);
|
||||||
polymorph1(d);
|
polymorph1(d);
|
||||||
polymorph1(d);
|
polymorph1(d);
|
||||||
@ -100,7 +104,8 @@ var e = [,,,,0.5,3,4];
|
|||||||
result += v;
|
result += v;
|
||||||
}
|
}
|
||||||
arg.forEach(sum);
|
arg.forEach(sum);
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(polymorph1);
|
||||||
polymorph1(d);
|
polymorph1(d);
|
||||||
polymorph1(e);
|
polymorph1(e);
|
||||||
polymorph1(d);
|
polymorph1(d);
|
||||||
|
@ -39,6 +39,7 @@ function f() {
|
|||||||
return pixels[1] + pixels[6];
|
return pixels[1] + pixels[6];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
f();
|
f();
|
||||||
f();
|
f();
|
||||||
assertEquals(6, pixels[5]);
|
assertEquals(6, pixels[5]);
|
||||||
|
@ -19,7 +19,8 @@ assertFalse(isNeverOptimize());
|
|||||||
for (var i = 0; i < 3; ++i) {
|
for (var i = 0; i < 3; ++i) {
|
||||||
var f = function(x) {
|
var f = function(x) {
|
||||||
return 2 * x;
|
return 2 * x;
|
||||||
}
|
};
|
||||||
|
%PrepareFunctionForOptimization(f);
|
||||||
sum += f(i);
|
sum += f(i);
|
||||||
|
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
|
@ -11,6 +11,7 @@ function foo(s) {
|
|||||||
var extern = "internalized dummy";
|
var extern = "internalized dummy";
|
||||||
extern = "1234567890qiaipppiúöäöáœba"+"jalsdjasldjasdlasjdalsdjasldk";
|
extern = "1234567890qiaipppiúöäöáœba"+"jalsdjasldjasdlasjdalsdjasldk";
|
||||||
externalizeString(extern, true /* force two-byte */);
|
externalizeString(extern, true /* force two-byte */);
|
||||||
|
%PrepareFunctionForOptimization(foo);
|
||||||
assertEquals(97, foo(extern));
|
assertEquals(97, foo(extern));
|
||||||
assertEquals(97, foo(extern));
|
assertEquals(97, foo(extern));
|
||||||
%OptimizeFunctionOnNextCall(foo);
|
%OptimizeFunctionOnNextCall(foo);
|
||||||
|
@ -97,6 +97,7 @@ TEST_F(LapContextTest, CurrentContextInLazyAccessorOnPrototype) {
|
|||||||
caller_context->Global()->Set(caller_context, object_key, object).ToChecked();
|
caller_context->Global()->Set(caller_context, object_key, object).ToChecked();
|
||||||
const char script[] =
|
const char script[] =
|
||||||
"function f() { object.property; object.property = 0; } "
|
"function f() { object.property; object.property = 0; } "
|
||||||
|
"%PrepareFunctionForOptimization(f); "
|
||||||
"f(); f(); "
|
"f(); f(); "
|
||||||
"%OptimizeFunctionOnNextCall(f); "
|
"%OptimizeFunctionOnNextCall(f); "
|
||||||
"f();";
|
"f();";
|
||||||
|
Loading…
Reference in New Issue
Block a user