Commit ab99a74c authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[cleanup] Add %PrepareForOptimization to some more mjsunit tests.

Bug=v8:8801,v8:8394,v8:9183

Change-Id: I5bd3505938a49dab0299f1d1d022e8a31cc806c5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660479
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Auto-Submit: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62178}
parent 7e7c1b10
......@@ -36,6 +36,7 @@ function isLittleEndian() {
// Test that both kinds of NaNs (signaling or quiet) do not signal
function TestAllModes(f) {
%PrepareFunctionForOptimization(f);
f(); // Runtime
f(); // IC
f(); // IC second time
......
......@@ -1053,12 +1053,14 @@ function anotherGetter() { return 222; }
function testGetterOnProto(expected, o) {
assertEquals(expected, o.quebec);
}
%PrepareFunctionForOptimization(testGetterOnProto);
obj1 = {};
Object.defineProperty(obj1, "quebec", { get: getter, configurable: true });
obj2 = Object.create(obj1);
obj3 = Object.create(obj2);
%PrepareFunctionForOptimization(testGetterOnProto);
testGetterOnProto(111, obj3);
testGetterOnProto(111, obj3);
%OptimizeFunctionOnNextCall(testGetterOnProto);
......@@ -1069,6 +1071,7 @@ Object.defineProperty(obj1, "quebec", { get: anotherGetter });
testGetterOnProto(222, obj3);
testGetterOnProto(222, obj3);
%PrepareFunctionForOptimization(testGetterOnProto);
%OptimizeFunctionOnNextCall(testGetterOnProto);
testGetterOnProto(222, obj3);
testGetterOnProto(222, obj3);
......@@ -1083,6 +1086,7 @@ function testSetterOnProto(expected, o) {
o.romeo = 444;
assertEquals(expected, modifyMe);
}
%PrepareFunctionForOptimization(testSetterOnProto);
obj1 = {};
Object.defineProperty(obj1, "romeo", { set: setter, configurable: true });
......@@ -1099,6 +1103,7 @@ Object.defineProperty(obj1, "romeo", { set: anotherSetter });
testSetterOnProto(446, obj3);
testSetterOnProto(446, obj3);
%PrepareFunctionForOptimization(testSetterOnProto);
%OptimizeFunctionOnNextCall(testSetterOnProto);
testSetterOnProto(446, obj3);
testSetterOnProto(446, obj3);
......@@ -1108,6 +1113,7 @@ function testSetterOnProtoStrict(o) {
"use strict";
o.sierra = 12345;
}
%PrepareFunctionForOptimization(testSetterOnProtoStrict);
obj1 = {};
Object.defineProperty(obj1, "sierra",
......@@ -1140,6 +1146,7 @@ assertTrue(exception);
function Assign(o) {
o.blubb = 123;
}
%PrepareFunctionForOptimization(Assign);
function C() {}
......
......@@ -28,6 +28,7 @@
// Flags: --allow-natives-syntax
function runLiteralsTest(fn) {
%PrepareFunctionForOptimization(fn);
// The first run creates an copy directly from the boilerplate decsription.
fn();
// The second run will create the boilerplate.
......@@ -531,6 +532,7 @@ runLiteralsTest(function TestSlowLiteralOptimized() {
function f() {
return {__proto__:null, bar:"barValue"};
}
%PrepareFunctionForOptimization(f);
let obj = f();
assertFalse(%HasFastProperties(obj));
assertEquals(Object.getPrototypeOf(obj), null);
......
......@@ -15,6 +15,7 @@
return v < 2;
});
}
%PrepareFunctionForOptimization(earlyExit);
assertFalse(earlyExit());
earlyExit();
%OptimizeFunctionOnNextCall(earlyExit);
......@@ -35,6 +36,7 @@
return v < 8;
});
}
%PrepareFunctionForOptimization(softyPlusEarlyExit);
assertFalse(softyPlusEarlyExit(false));
softyPlusEarlyExit(false);
%OptimizeFunctionOnNextCall(softyPlusEarlyExit);
......@@ -81,6 +83,7 @@
return true;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
eagerDeoptInCalled();
eagerDeoptInCalled();
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
......@@ -102,6 +105,7 @@
return true;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
assertTrue(eagerDeoptInCalled());
assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], called_values);
eagerDeoptInCalled();
......@@ -125,6 +129,7 @@
return true;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertTrue(lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -144,6 +149,7 @@
return true;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertTrue(lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -164,6 +170,7 @@
return true;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertTrue(lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -184,6 +191,7 @@
return true;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
eagerDeoptInCalled();
eagerDeoptInCalled();
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
......@@ -207,6 +215,7 @@
return true;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -232,6 +241,7 @@
%NeverOptimizeFunction(callback);
a.every(callback);
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -259,6 +269,7 @@
caught = true;
}
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -287,6 +298,7 @@
caught = true;
}
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -318,6 +330,7 @@
}
return result;
}
%PrepareFunctionForOptimization(lazyDeopt);
assertEquals(true, lazyDeopt(false));
assertEquals(true, lazyDeopt(false));
assertEquals("nope", lazyDeopt(true));
......@@ -343,6 +356,7 @@
return true;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -370,6 +384,7 @@
b.every(callback);
return did_assert_error;
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -397,6 +412,7 @@
});
return did_assert_error;
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -420,6 +436,7 @@
return true;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
assertThrows(() => lazyDeopt());
assertThrows(() => lazyDeopt());
try {
......@@ -446,6 +463,7 @@
});
return callback_values;
}
%PrepareFunctionForOptimization(withHoles);
withHoles();
withHoles();
%OptimizeFunctionOnNextCall(withHoles);
......@@ -462,6 +480,7 @@
});
return callback_values;
}
%PrepareFunctionForOptimization(withHoles);
withHoles();
withHoles();
%OptimizeFunctionOnNextCall(withHoles);
......@@ -476,6 +495,7 @@
function unreliable(a, b) {
return a.every(x => true, side_effect(a, b));
}
%PrepareFunctionForOptimization(unreliable);
let a = [1, 2, 3];
unreliable(a, false);
......@@ -492,6 +512,7 @@
function notCallable() {
return a.every(undefined);
}
%PrepareFunctionForOptimization(notCallable);
assertThrows(notCallable, TypeError);
try { notCallable(); } catch(e) { }
......@@ -509,6 +530,7 @@
return true;
});
}
%PrepareFunctionForOptimization(prototypeChanged);
prototypeChanged();
prototypeChanged();
%OptimizeFunctionOnNextCall(prototypeChanged);
......
......@@ -20,6 +20,7 @@
return v === 20;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
eagerDeoptInCalled();
eagerDeoptInCalled();
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
......@@ -41,6 +42,7 @@
return v === 9;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
assertEquals(9, eagerDeoptInCalled());
assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], called_values);
eagerDeoptInCalled();
......@@ -65,6 +67,7 @@
return v > 3;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertEquals(4, lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -84,6 +87,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertEquals(undefined, lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -104,6 +108,7 @@
return v > 3;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertEquals(4, lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -124,6 +129,7 @@
return false;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
eagerDeoptInCalled();
eagerDeoptInCalled();
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
......@@ -147,6 +153,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -172,6 +179,7 @@
%NeverOptimizeFunction(callback);
a.find(callback);
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -199,6 +207,7 @@
caught = true;
}
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -227,6 +236,7 @@
caught = true;
}
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -258,6 +268,7 @@
}
return result;
}
%PrepareFunctionForOptimization(lazyDeopt);
assertEquals(3, lazyDeopt(false));
assertEquals(3, lazyDeopt(false));
assertEquals("nope", lazyDeopt(true));
......@@ -283,6 +294,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -310,6 +322,7 @@
b.find(callback);
return did_assert_error;
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -337,6 +350,7 @@
});
return did_assert_error;
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -360,6 +374,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
assertThrows(() => lazyDeopt());
assertThrows(() => lazyDeopt());
try {
......@@ -385,6 +400,7 @@
return false;
});
}
%PrepareFunctionForOptimization(prototypeChanged);
prototypeChanged();
prototypeChanged();
%OptimizeFunctionOnNextCall(prototypeChanged);
......@@ -406,6 +422,7 @@
});
return callback_values;
}
%PrepareFunctionForOptimization(withHoles);
withHoles();
withHoles();
%OptimizeFunctionOnNextCall(withHoles);
......@@ -422,6 +439,7 @@
});
return callback_values;
}
%PrepareFunctionForOptimization(withHoles);
withHoles();
withHoles();
%OptimizeFunctionOnNextCall(withHoles);
......@@ -436,6 +454,7 @@
function unreliable(a, b) {
return a.find(x => false, side_effect(a, b));
}
%PrepareFunctionForOptimization(unreliable);
let a = [1, 2, 3];
unreliable(a, false);
......@@ -452,6 +471,7 @@
function notCallable() {
return a.find(undefined);
}
%PrepareFunctionForOptimization(notCallable);
assertThrows(notCallable, TypeError);
try { notCallable(); } catch(e) { }
......
......@@ -20,6 +20,7 @@
return v === 20;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
eagerDeoptInCalled();
eagerDeoptInCalled();
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
......@@ -41,6 +42,7 @@
return v === 9;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
assertEquals(8, eagerDeoptInCalled());
assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], called_values);
eagerDeoptInCalled();
......@@ -65,6 +67,7 @@
return v > 3;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertEquals(3, lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -84,6 +87,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertEquals(-1, lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -104,6 +108,7 @@
return v > 3;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertEquals(3, lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -124,6 +129,7 @@
return false;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
eagerDeoptInCalled();
eagerDeoptInCalled();
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
......@@ -147,6 +153,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -172,6 +179,7 @@
%NeverOptimizeFunction(callback);
a.findIndex(callback);
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -199,6 +207,7 @@
caught = true;
}
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -227,6 +236,7 @@
caught = true;
}
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -258,6 +268,7 @@
}
return result;
}
%PrepareFunctionForOptimization(lazyDeopt);
assertEquals(2, lazyDeopt(false));
assertEquals(2, lazyDeopt(false));
assertEquals("nope", lazyDeopt(true));
......@@ -283,6 +294,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -310,6 +322,7 @@
b.findIndex(callback);
return did_assert_error;
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -337,6 +350,7 @@
});
return did_assert_error;
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -360,6 +374,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
assertThrows(() => lazyDeopt());
assertThrows(() => lazyDeopt());
try {
......@@ -385,6 +400,7 @@
return false;
});
}
%PrepareFunctionForOptimization(prototypeChanged);
prototypeChanged();
prototypeChanged();
%OptimizeFunctionOnNextCall(prototypeChanged);
......@@ -406,6 +422,7 @@
});
return callback_values;
}
%PrepareFunctionForOptimization(withHoles);
withHoles();
withHoles();
%OptimizeFunctionOnNextCall(withHoles);
......@@ -422,6 +439,7 @@
});
return callback_values;
}
%PrepareFunctionForOptimization(withHoles);
withHoles();
withHoles();
%OptimizeFunctionOnNextCall(withHoles);
......@@ -436,6 +454,7 @@
function unreliable(a, b) {
return a.findIndex(x => false, side_effect(a, b));
}
%PrepareFunctionForOptimization(unreliable);
let a = [1, 2, 3];
unreliable(a, false);
......@@ -452,6 +471,7 @@
function notCallable() {
return a.findIndex(undefined);
}
%PrepareFunctionForOptimization(notCallable);
assertThrows(notCallable, TypeError);
try { notCallable(); } catch(e) { }
......
......@@ -15,6 +15,7 @@
return v > 2;
});
}
%PrepareFunctionForOptimization(earlyExit);
assertTrue(earlyExit());
earlyExit();
%OptimizeFunctionOnNextCall(earlyExit);
......@@ -35,6 +36,7 @@
return v > 7;
});
}
%PrepareFunctionForOptimization(softyPlusEarlyExit);
assertTrue(softyPlusEarlyExit(false));
softyPlusEarlyExit(false);
%OptimizeFunctionOnNextCall(softyPlusEarlyExit);
......@@ -58,6 +60,7 @@
return v > 7;
});
}
%PrepareFunctionForOptimization(softyPlusEarlyExit);
assertTrue(softyPlusEarlyExit(false));
assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8], called_values);
softyPlusEarlyExit(false);
......@@ -81,6 +84,7 @@
return false;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
eagerDeoptInCalled();
eagerDeoptInCalled();
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
......@@ -102,6 +106,7 @@
return false;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
assertFalse(eagerDeoptInCalled());
assertArrayEquals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], called_values);
eagerDeoptInCalled();
......@@ -125,6 +130,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertFalse(lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -144,6 +150,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertFalse(lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -164,6 +171,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyChanger);
assertFalse(lazyChanger());
lazyChanger();
%OptimizeFunctionOnNextCall(lazyChanger);
......@@ -184,6 +192,7 @@
return false;
});
}
%PrepareFunctionForOptimization(eagerDeoptInCalled);
eagerDeoptInCalled();
eagerDeoptInCalled();
%OptimizeFunctionOnNextCall(eagerDeoptInCalled);
......@@ -207,6 +216,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -232,6 +242,7 @@
%NeverOptimizeFunction(callback);
a.some(callback);
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -259,6 +270,7 @@
caught = true;
}
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -287,6 +299,7 @@
caught = true;
}
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -318,6 +331,7 @@
}
return result;
}
%PrepareFunctionForOptimization(lazyDeopt);
assertEquals(false, lazyDeopt(false));
assertEquals(false, lazyDeopt(false));
assertEquals("nope", lazyDeopt(true));
......@@ -343,6 +357,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -370,6 +385,7 @@
b.some(callback);
return did_assert_error;
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -397,6 +413,7 @@
});
return did_assert_error;
}
%PrepareFunctionForOptimization(lazyDeopt);
lazyDeopt();
lazyDeopt();
%OptimizeFunctionOnNextCall(lazyDeopt);
......@@ -420,6 +437,7 @@
return false;
});
}
%PrepareFunctionForOptimization(lazyDeopt);
assertThrows(() => lazyDeopt());
assertThrows(() => lazyDeopt());
try {
......@@ -445,6 +463,7 @@
return false;
});
}
%PrepareFunctionForOptimization(prototypeChanged);
prototypeChanged();
prototypeChanged();
%OptimizeFunctionOnNextCall(prototypeChanged);
......@@ -466,6 +485,7 @@
});
return callback_values;
}
%PrepareFunctionForOptimization(withHoles);
withHoles();
withHoles();
%OptimizeFunctionOnNextCall(withHoles);
......@@ -482,6 +502,7 @@
});
return callback_values;
}
%PrepareFunctionForOptimization(withHoles);
withHoles();
withHoles();
%OptimizeFunctionOnNextCall(withHoles);
......@@ -494,6 +515,7 @@
function notCallable() {
return a.some(undefined);
}
%PrepareFunctionForOptimization(notCallable);
assertThrows(notCallable, TypeError);
try { notCallable(); } catch(e) { }
......
......@@ -60,6 +60,7 @@ function test_props(a) {
}
}
%PrepareFunctionForOptimization(test_props);
test_props(z);
test_props(z);
%OptimizeFunctionOnNextCall(test_props);
......
......@@ -94,6 +94,7 @@ function test6() {
function test_with_optimization(f) {
// Run tests in a loop to make sure that inlined Array() constructor runs out
// of new space memory and must fall back on runtime impl.
%PrepareFunctionForOptimization(f);
for (i = 0; i < 25000; ++i) f();
%OptimizeFunctionOnNextCall(f);
for (i = 0; i < 25000; ++i) f(); // Make sure GC happens
......
......@@ -45,6 +45,7 @@ function testPolymorphicLoads() {
function load(a, i) {
return a[i];
}
%PrepareFunctionForOptimization(load);
var object_array = new Object;
var sparse_object_array = new Object;
......@@ -110,6 +111,7 @@ function testPolymorphicStores() {
function store(a, i, val) {
a[i] = val;
}
%PrepareFunctionForOptimization(store);
var object_array = new Object;
var sparse_object_array = new Object;
......
......@@ -35,6 +35,7 @@ var deopt_setter = false;
function f_mono(o) {
return 5 + o.x++;
}
%PrepareFunctionForOptimization(f_mono);
var to_deopt = f_mono;
......@@ -75,6 +76,7 @@ assertEquals(3, s);
function f_poly(o) {
return 5 + o.x++;
}
%PrepareFunctionForOptimization(f_poly);
v = 1;
to_deopt = f_poly;
......@@ -93,6 +95,7 @@ assertEquals(8, f_poly(o2));
assertEquals(6, g);
assertEquals(6, s);
%PrepareFunctionForOptimization(f_poly);
%OptimizeFunctionOnNextCall(f_poly);
v = undefined;
assertEquals(NaN, f_poly(o2));
......@@ -102,6 +105,7 @@ assertEquals(7, s);
function f_pre(o) {
return 5 + ++o.x;
}
%PrepareFunctionForOptimization(f_pre);
v = 1;
to_deopt = f_pre;
......@@ -120,6 +124,7 @@ assertEquals(9, f_pre(o2));
assertEquals(10, g);
assertEquals(10, s);
%PrepareFunctionForOptimization(f_pre);
%OptimizeFunctionOnNextCall(f_pre);
v = undefined;
assertEquals(NaN, f_pre(o2));
......@@ -130,6 +135,7 @@ assertEquals(11, s);
function f_get(o) {
return 5 + o.x++;
}
%PrepareFunctionForOptimization(f_get);
v = 1;
to_deopt = f_get;
......@@ -148,6 +154,7 @@ assertEquals(8, f_get(o2));
assertEquals(14, g);
assertEquals(14, s);
%PrepareFunctionForOptimization(f_get);
%OptimizeFunctionOnNextCall(f_get);
v = undefined;
assertEquals(NaN, f_get(o2));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment