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

Side by Side Diff: test/mjsunit/for-in-opt.js

Issue 1417063011: [runtime] support new Proxy() instead of Proxy.create and install getPrototypeOf trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removing unreachable code Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/es6/regress/regress-cr493566.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-proxies --allow-natives-syntax --expose-debug-as debug 5 // Flags: --harmony-proxies --allow-natives-syntax --expose-debug-as debug
6 6
7 "use strict"; 7 "use strict";
8 8
9 // Test non-JSObject receiver. 9 // Test non-JSObject receiver.
10 function f(o) { 10 function f(o) {
(...skipping 28 matching lines...) Expand all
39 if (deopt_has) { 39 if (deopt_has) {
40 %DeoptimizeFunction(f2); 40 %DeoptimizeFunction(f2);
41 deopt_has = false; 41 deopt_has = false;
42 } 42 }
43 has_keys.push(k); 43 has_keys.push(k);
44 return {value: 10, configurable: true, writable: false, enumerable: true}; 44 return {value: 10, configurable: true, writable: false, enumerable: true};
45 } 45 }
46 }; 46 };
47 47
48 48
49 var proxy = Proxy.create(handler); 49 var proxy = new Proxy({}, handler);
50 var o = {__proto__: proxy}; 50 var o = {__proto__: proxy};
51 51
52 function f2(o) { 52 function f2(o) {
53 var result = []; 53 var result = [];
54 for (var i in o) { 54 for (var i in o) {
55 result.push(i); 55 result.push(i);
56 } 56 }
57 return result; 57 return result;
58 } 58 }
59 59
(...skipping 25 matching lines...) Expand all
85 f3(undefined); 85 f3(undefined);
86 f3(null); 86 f3(null);
87 87
88 // Reliable repro for an issue previously flushed out by GC stress. 88 // Reliable repro for an issue previously flushed out by GC stress.
89 var handler2 = { 89 var handler2 = {
90 getPropertyDescriptor: function(k) { 90 getPropertyDescriptor: function(k) {
91 has_keys.push(k); 91 has_keys.push(k);
92 return {value: 10, configurable: true, writable: false, enumerable: true}; 92 return {value: 10, configurable: true, writable: false, enumerable: true};
93 } 93 }
94 } 94 }
95 var proxy2 = Proxy.create(handler2); 95 var proxy2 = new Proxy({}, handler2);
96 var o2 = {__proto__: proxy2}; 96 var o2 = {__proto__: proxy2};
97 var p = {x: "x"} 97 var p = {x: "x"}
98 98
99 function f4(o, p) { 99 function f4(o, p) {
100 var result = []; 100 var result = [];
101 for (var i in o) { 101 for (var i in o) {
102 var j = p.x + "str"; 102 var j = p.x + "str";
103 result.push(i); 103 result.push(i);
104 } 104 }
105 return result; 105 return result;
(...skipping 26 matching lines...) Expand all
132 return ["a", "b"]; 132 return ["a", "b"];
133 }, 133 },
134 134
135 getPropertyDescriptor: function(k) { 135 getPropertyDescriptor: function(k) {
136 if (k == "a") count++; 136 if (k == "a") count++;
137 if (x) %ScheduleBreak(); 137 if (x) %ScheduleBreak();
138 return {value: 10, configurable: true, writable: false, enumerable: true}; 138 return {value: 10, configurable: true, writable: false, enumerable: true};
139 } 139 }
140 }; 140 };
141 141
142 var proxy3 = Proxy.create(handler3); 142 var proxy3 = new Proxy({}, handler3);
143 var o3 = {__proto__: proxy3}; 143 var o3 = {__proto__: proxy3};
144 144
145 function f5() { 145 function f5() {
146 for (var p in o3) { 146 for (var p in o3) {
147 print(p); 147 print(p);
148 } 148 }
149 } 149 }
150 150
151 x = false; 151 x = false;
152 152
153 f5(); f5(); f5(); 153 f5(); f5(); f5();
154 %OptimizeFunctionOnNextCall(f5); 154 %OptimizeFunctionOnNextCall(f5);
155 x = true; 155 x = true;
156 count = 0; 156 count = 0;
157 Debug.setListener(listener); 157 Debug.setListener(listener);
158 f5(); 158 f5();
159 Debug.setListener(null); 159 Debug.setListener(null);
160 assertEquals(1, count); 160 assertEquals(1, count);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/regress/regress-cr493566.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698