Index: test/mjsunit/for-in-opt.js |
diff --git a/test/mjsunit/for-in-opt.js b/test/mjsunit/for-in-opt.js |
index 996f53979abd17649c701d4977e76f85c2f5f927..e458e1d537806bd8924b88457339ff2349f4d972 100644 |
--- a/test/mjsunit/for-in-opt.js |
+++ b/test/mjsunit/for-in-opt.js |
@@ -17,6 +17,7 @@ function f(o) { |
assertEquals(["0"], f("a")); |
assertEquals(["0"], f("a")); |
+ |
%OptimizeFunctionOnNextCall(f); |
assertEquals(["0","1","2"], f("bla")); |
@@ -27,15 +28,15 @@ var deopt_has = false; |
var deopt_enum = false; |
var handler = { |
- enumerate: function(target) { |
+ enumerate(target) { |
if (deopt_enum) { |
%DeoptimizeFunction(f2); |
deopt_enum = false; |
} |
- return keys; |
+ return keys[Symbol.iterator](); |
}, |
- getPropertyDescriptor: function(k) { |
+ has(target, k) { |
if (deopt_has) { |
%DeoptimizeFunction(f2); |
deopt_has = false; |
@@ -65,10 +66,12 @@ function check_f2() { |
check_f2(); |
check_f2(); |
+ |
// Test lazy deopt after GetPropertyNamesFast |
%OptimizeFunctionOnNextCall(f2); |
deopt_enum = true; |
check_f2(); |
+ |
// Test lazy deopt after FILTER_KEY |
%OptimizeFunctionOnNextCall(f2); |
deopt_has = true; |
@@ -81,13 +84,14 @@ function f3(o) { |
f3({__proto__:{x:1}}); |
f3({__proto__:{x:1}}); |
+ |
%OptimizeFunctionOnNextCall(f3); |
f3(undefined); |
f3(null); |
// Reliable repro for an issue previously flushed out by GC stress. |
var handler2 = { |
- getPropertyDescriptor: function(k) { |
+ getPropertyDescriptor(target, k) { |
has_keys.push(k); |
return {value: 10, configurable: true, writable: false, enumerable: true}; |
} |
@@ -104,14 +108,18 @@ function f4(o, p) { |
} |
return result; |
} |
+ |
function check_f4() { |
assertEquals(keys, f4(o, p)); |
assertEquals(keys, has_keys); |
has_keys.length = 0; |
} |
+ |
check_f4(); |
check_f4(); |
+ |
%OptimizeFunctionOnNextCall(f4); |
+ |
p.y = "y"; // Change map, cause eager deopt. |
check_f4(); |
@@ -128,11 +136,11 @@ function listener(event, exec_state, event_data, data) { |
} |
var handler3 = { |
- enumerate: function(target) { |
- return ["a", "b"]; |
+ enumerate(target) { |
+ return ["a", "b"][Symbol.iterator](); |
}, |
- getPropertyDescriptor: function(k) { |
+ has(target, k) { |
if (k == "a") count++; |
if (x) %ScheduleBreak(); |
return {value: 10, configurable: true, writable: false, enumerable: true}; |