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

Side by Side Diff: test/mjsunit/own-symbols.js

Issue 464473002: Add "own" symbols support. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes for 64-bit builds Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/runtime-gen/createprivateownsymbol.js » ('j') | 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 2014 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 // Flags: --allow-natives-syntax
6
7 var s = %CreatePrivateOwnSymbol("s");
8 var s1 = %CreatePrivateOwnSymbol("s1");
9
10 function TestSimple() {
11 var p = {}
12 p[s] = "moo";
13
14 var o = Object.create(p);
15
16 assertEquals(undefined, o[s]);
17 assertEquals("moo", p[s]);
18
19 o[s] = "bow-wow";
20 assertEquals("bow-wow", o[s]);
21 assertEquals("moo", p[s]);
22 }
23
24 TestSimple();
25
26
27 function TestICs() {
28 var p = {}
29 p[s] = "moo";
30
31
32 var o = Object.create(p);
33 o[s1] = "bow-wow";
34 function checkNonOwn(o) {
35 assertEquals(undefined, o[s]);
36 assertEquals("bow-wow", o[s1]);
37 }
38
39 checkNonOwn(o);
40
41 // Test monomorphic/optimized.
42 for (var i = 0; i < 1000; i++) {
43 checkNonOwn(o);
44 }
45
46 // Test non-monomorphic.
47 for (var i = 0; i < 1000; i++) {
48 var oNew = Object.create(p);
49 oNew["s" + i] = i;
50 oNew[s1] = "bow-wow";
51 checkNonOwn(oNew);
52 }
53 }
54
55 TestICs();
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/runtime-gen/createprivateownsymbol.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698