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

Side by Side Diff: test/mjsunit/harmony/array-species.js

Issue 1689733002: Optimize @@species based on a global 'protector' cell (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 10 months 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 // Flags: --harmony-species --harmony-proxies 5 // Flags: --harmony-species --harmony-proxies
6 6
7 // Test the ES2015 @@species feature 7 // Test the ES2015 @@species feature
8 8
9 'use strict'; 9 'use strict';
10 10
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 params = undefined; 146 params = undefined;
147 assertEquals(MyObservedArray, 147 assertEquals(MyObservedArray,
148 new MyObservedArray().concat().constructor); 148 new MyObservedArray().concat().constructor);
149 assertEquals(1, count); 149 assertEquals(1, count);
150 assertArrayEquals([0], params); 150 assertArrayEquals([0], params);
151 151
152 count = 0; 152 count = 0;
153 params = undefined; 153 params = undefined;
154 assertEquals(MyObservedArray, 154 assertEquals(MyObservedArray,
155 new MyObservedArray().slice().constructor); 155 new MyObservedArray().slice().constructor);
156 // TODO(littledan): Should be 1 156 assertEquals(1, count);
157 assertEquals(2, count);
158 assertArrayEquals([0], params); 157 assertArrayEquals([0], params);
159 158
160 count = 0; 159 count = 0;
161 params = undefined; 160 params = undefined;
162 assertEquals(MyObservedArray, 161 assertEquals(MyObservedArray,
163 new MyObservedArray().splice().constructor); 162 new MyObservedArray().splice().constructor);
164 // TODO(littledan): Should be 1 163 assertEquals(1, count);
165 assertEquals(2, count);
166 assertArrayEquals([0], params); 164 assertArrayEquals([0], params);
167 165
168 // @@species constructor can be a Proxy, and the realm access doesn't 166 // @@species constructor can be a Proxy, and the realm access doesn't
169 // crash 167 // crash
170 168
171 class MyProxyArray extends Array { } 169 class MyProxyArray extends Array { }
172 let ProxyArray = new Proxy(MyProxyArray, {}); 170 let ProxyArray = new Proxy(MyProxyArray, {});
173 MyProxyArray.constructor = ProxyArray; 171 MyProxyArray.constructor = ProxyArray;
174 172
175 assertEquals(MyProxyArray, new ProxyArray().map(()=>{}).constructor); 173 assertEquals(MyProxyArray, new ProxyArray().map(()=>{}).constructor);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698