Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: test/mjsunit/for-in-opt.js

Issue 1516843002: [proxy] fixing harmony/proxy.js tests and improving error messages + some drive-by fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/for-in-opt.js
diff --git a/test/mjsunit/for-in-opt.js b/test/mjsunit/for-in-opt.js
deleted file mode 100644
index 996f53979abd17649c701d4977e76f85c2f5f927..0000000000000000000000000000000000000000
--- a/test/mjsunit/for-in-opt.js
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2015 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-proxies --allow-natives-syntax --expose-debug-as debug
-
-"use strict";
-
-// Test non-JSObject receiver.
-function f(o) {
- var result = [];
- for (var i in o) {
- result.push(i);
- }
- return result;
-}
-
-assertEquals(["0"], f("a"));
Jakob Kummerow 2015/12/10 15:35:03 What's wrong with this? (I mean the entire file.)
neis 2015/12/10 16:08:13 I tried to figure out what it was testing (in orde
Camillo Bruni 2015/12/10 20:22:13 enabled it again (for in + proxies + prototype wal
-assertEquals(["0"], f("a"));
-%OptimizeFunctionOnNextCall(f);
-assertEquals(["0","1","2"], f("bla"));
-
-// Test the lazy deopt points.
-var keys = ["a", "b", "c", "d"];
-var has_keys = [];
-var deopt_has = false;
-var deopt_enum = false;
-
-var handler = {
- enumerate: function(target) {
- if (deopt_enum) {
- %DeoptimizeFunction(f2);
- deopt_enum = false;
- }
- return keys;
- },
-
- getPropertyDescriptor: function(k) {
- if (deopt_has) {
- %DeoptimizeFunction(f2);
- deopt_has = false;
- }
- has_keys.push(k);
- return {value: 10, configurable: true, writable: false, enumerable: true};
- }
-};
-
-
-var proxy = new Proxy({}, handler);
-var o = {__proto__: proxy};
-
-function f2(o) {
- var result = [];
- for (var i in o) {
- result.push(i);
- }
- return result;
-}
-
-function check_f2() {
- assertEquals(keys, f2(o));
- assertEquals(keys, has_keys);
- has_keys.length = 0;
-}
-
-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;
-check_f2();
-
-function f3(o) {
- for (var i in 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) {
- has_keys.push(k);
- return {value: 10, configurable: true, writable: false, enumerable: true};
- }
-}
-var proxy2 = new Proxy({}, handler2);
-var o2 = {__proto__: proxy2};
-var p = {x: "x"}
-
-function f4(o, p) {
- var result = [];
- for (var i in o) {
- var j = p.x + "str";
- result.push(i);
- }
- 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();
-
-// Repro for Turbofan equivalent.
-var x;
-var count = 0;
-
-var Debug = debug.Debug;
-
-function listener(event, exec_state, event_data, data) {
- if (event == Debug.DebugEvent.Break) {
- %DeoptimizeFunction(f5);
- }
-}
-
-var handler3 = {
- enumerate: function(target) {
- return ["a", "b"];
- },
-
- getPropertyDescriptor: function(k) {
- if (k == "a") count++;
- if (x) %ScheduleBreak();
- return {value: 10, configurable: true, writable: false, enumerable: true};
- }
-};
-
-var proxy3 = new Proxy({}, handler3);
-var o3 = {__proto__: proxy3};
-
-function f5() {
- for (var p in o3) {
- print(p);
- }
-}
-
-x = false;
-
-f5(); f5(); f5();
-%OptimizeFunctionOnNextCall(f5);
-x = true;
-count = 0;
-Debug.setListener(listener);
-f5();
-Debug.setListener(null);
-assertEquals(1, count);

Powered by Google App Engine
This is Rietveld 408576698