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

Side by Side Diff: test/mjsunit/object-keys.js

Issue 2853393002: [builtins] Migrate Object.keys to CodeStubAssembler builtin. (Closed)
Patch Set: Properly handle the empty case. Created 3 years, 7 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Ensure that mutation of the Object.keys result doesn't affect the
6 // enumeration cache for fast-mode objects.
7 (function() {
8 const a = {x:1, y:2};
9 let k = Object.keys(a);
Camillo Bruni 2017/05/03 08:40:44 You could additionally do: %VerifyHeapObject(k)
Benedikt Meurer 2017/05/17 05:09:19 Done.
10 assertEquals(2, k.length);
11 assertEquals("x", k[0]);
12 assertEquals("y", k[1]);
13 k[0] = "y";
14 k[1] = "x";
15 k = Object.keys(a);
16 assertEquals(2, k.length);
17 assertEquals("x", k[0]);
18 assertEquals("y", k[1]);
19 })();
20
21 // Ensure that the copy-on-write keys are handled properly, even in
22 // the presence of Symbols.
23 (function() {
24 const s = Symbol();
25 const a = {[s]: 1};
26 let k = Object.keys(a);
27 assertEquals(0, k.length);
28 k.shift();
29 assertEquals(0, k.length);
30 })();
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698