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

Side by Side Diff: test/mjsunit/harmony/reflect-enumerate-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: adding proxy trap strings 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
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 // This is adapted from mjsunit/for-in-opt.js. 5 // This is adapted from mjsunit/for-in-opt.js.
6 6
7 // Flags: --harmony-proxies --harmony-reflect --allow-natives-syntax 7 // Flags: --harmony-proxies --harmony-reflect --allow-natives-syntax
8 8
9 9
10 "use strict"; 10 "use strict";
(...skipping 30 matching lines...) Expand all
41 if (deopt_has) { 41 if (deopt_has) {
42 %DeoptimizeFunction(f2); 42 %DeoptimizeFunction(f2);
43 deopt_has = false; 43 deopt_has = false;
44 } 44 }
45 has_keys.push(k); 45 has_keys.push(k);
46 return {value: 10, configurable: true, writable: false, enumerable: true}; 46 return {value: 10, configurable: true, writable: false, enumerable: true};
47 } 47 }
48 }; 48 };
49 49
50 50
51 var proxy = Proxy.create(handler); 51 var proxy = new Proxy({}, handler);
52 var o = {__proto__: proxy}; 52 var o = {__proto__: proxy};
53 53
54 function f2(o) { 54 function f2(o) {
55 var result = []; 55 var result = [];
56 for (var i of Reflect.enumerate(o)) { 56 for (var i of Reflect.enumerate(o)) {
57 result.push(i); 57 result.push(i);
58 } 58 }
59 return result; 59 return result;
60 } 60 }
61 61
62 function check_f2() { 62 function check_f2() {
63 assertEquals(keys, f2(o)); 63 assertEquals(keys, f2(o));
64 assertEquals(keys, has_keys); 64 assertEquals(keys, has_keys);
65 has_keys.length = 0; 65 has_keys.length = 0;
66 } 66 }
67 67
68 check_f2(); 68 check_f2();
69 check_f2(); 69 check_f2();
70 // Test lazy deopt after GetPropertyNamesFast 70 // Test lazy deopt after GetPropertyNamesFast
71 %OptimizeFunctionOnNextCall(f2); 71 %OptimizeFunctionOnNextCall(f2);
72 deopt_enum = true; 72 deopt_enum = true;
73 check_f2(); 73 check_f2();
74 // Test lazy deopt after FILTER_KEY 74 // Test lazy deopt after FILTER_KEY
75 %OptimizeFunctionOnNextCall(f2); 75 %OptimizeFunctionOnNextCall(f2);
76 deopt_has = true; 76 deopt_has = true;
77 check_f2(); 77 check_f2();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698