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

Side by Side Diff: src/weak-collection.js

Issue 1318043002: Native context: do not put public symbols and flags on the js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix and rebase Created 5 years, 3 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/v8natives.js ('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
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11 var GlobalObject = global.Object; 11 var GlobalObject = global.Object;
12 var GlobalWeakMap = global.WeakMap; 12 var GlobalWeakMap = global.WeakMap;
13 var GlobalWeakSet = global.WeakSet; 13 var GlobalWeakSet = global.WeakSet;
14 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
14 15
15 // ------------------------------------------------------------------- 16 // -------------------------------------------------------------------
16 // Harmony WeakMap 17 // Harmony WeakMap
17 18
18 function WeakMapConstructor(iterable) { 19 function WeakMapConstructor(iterable) {
19 if (!%_IsConstructCall()) { 20 if (!%_IsConstructCall()) {
20 throw MakeTypeError(kConstructorNotFunction, "WeakMap"); 21 throw MakeTypeError(kConstructorNotFunction, "WeakMap");
21 } 22 }
22 23
23 %WeakCollectionInitialize(this); 24 %WeakCollectionInitialize(this);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 84 }
84 85
85 86
86 // ------------------------------------------------------------------- 87 // -------------------------------------------------------------------
87 88
88 %SetCode(GlobalWeakMap, WeakMapConstructor); 89 %SetCode(GlobalWeakMap, WeakMapConstructor);
89 %FunctionSetLength(GlobalWeakMap, 0); 90 %FunctionSetLength(GlobalWeakMap, 0);
90 %FunctionSetPrototype(GlobalWeakMap, new GlobalObject()); 91 %FunctionSetPrototype(GlobalWeakMap, new GlobalObject());
91 %AddNamedProperty(GlobalWeakMap.prototype, "constructor", GlobalWeakMap, 92 %AddNamedProperty(GlobalWeakMap.prototype, "constructor", GlobalWeakMap,
92 DONT_ENUM); 93 DONT_ENUM);
93 %AddNamedProperty(GlobalWeakMap.prototype, symbolToStringTag, "WeakMap", 94 %AddNamedProperty(GlobalWeakMap.prototype, toStringTagSymbol, "WeakMap",
94 DONT_ENUM | READ_ONLY); 95 DONT_ENUM | READ_ONLY);
95 96
96 // Set up the non-enumerable functions on the WeakMap prototype object. 97 // Set up the non-enumerable functions on the WeakMap prototype object.
97 utils.InstallFunctions(GlobalWeakMap.prototype, DONT_ENUM, [ 98 utils.InstallFunctions(GlobalWeakMap.prototype, DONT_ENUM, [
98 "get", WeakMapGet, 99 "get", WeakMapGet,
99 "set", WeakMapSet, 100 "set", WeakMapSet,
100 "has", WeakMapHas, 101 "has", WeakMapHas,
101 "delete", WeakMapDelete 102 "delete", WeakMapDelete
102 ]); 103 ]);
103 104
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 158 }
158 159
159 160
160 // ------------------------------------------------------------------- 161 // -------------------------------------------------------------------
161 162
162 %SetCode(GlobalWeakSet, WeakSetConstructor); 163 %SetCode(GlobalWeakSet, WeakSetConstructor);
163 %FunctionSetLength(GlobalWeakSet, 0); 164 %FunctionSetLength(GlobalWeakSet, 0);
164 %FunctionSetPrototype(GlobalWeakSet, new GlobalObject()); 165 %FunctionSetPrototype(GlobalWeakSet, new GlobalObject());
165 %AddNamedProperty(GlobalWeakSet.prototype, "constructor", GlobalWeakSet, 166 %AddNamedProperty(GlobalWeakSet.prototype, "constructor", GlobalWeakSet,
166 DONT_ENUM); 167 DONT_ENUM);
167 %AddNamedProperty(GlobalWeakSet.prototype, symbolToStringTag, "WeakSet", 168 %AddNamedProperty(GlobalWeakSet.prototype, toStringTagSymbol, "WeakSet",
168 DONT_ENUM | READ_ONLY); 169 DONT_ENUM | READ_ONLY);
169 170
170 // Set up the non-enumerable functions on the WeakSet prototype object. 171 // Set up the non-enumerable functions on the WeakSet prototype object.
171 utils.InstallFunctions(GlobalWeakSet.prototype, DONT_ENUM, [ 172 utils.InstallFunctions(GlobalWeakSet.prototype, DONT_ENUM, [
172 "add", WeakSetAdd, 173 "add", WeakSetAdd,
173 "has", WeakSetHas, 174 "has", WeakSetHas,
174 "delete", WeakSetDelete 175 "delete", WeakSetDelete
175 ]); 176 ]);
176 177
177 }) 178 })
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698