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

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

Issue 1477073005: Use new.target in favor of %_IsConstructCall intrinsic (1). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/js/proxy.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
(...skipping 11 matching lines...) Expand all
22 utils.Import(function(from) { 22 utils.Import(function(from) {
23 GetExistingHash = from.GetExistingHash; 23 GetExistingHash = from.GetExistingHash;
24 GetHash = from.GetHash; 24 GetHash = from.GetHash;
25 MakeTypeError = from.MakeTypeError; 25 MakeTypeError = from.MakeTypeError;
26 }); 26 });
27 27
28 // ------------------------------------------------------------------- 28 // -------------------------------------------------------------------
29 // Harmony WeakMap 29 // Harmony WeakMap
30 30
31 function WeakMapConstructor(iterable) { 31 function WeakMapConstructor(iterable) {
32 if (!%_IsConstructCall()) { 32 if (IS_UNDEFINED(new.target)) {
33 throw MakeTypeError(kConstructorNotFunction, "WeakMap"); 33 throw MakeTypeError(kConstructorNotFunction, "WeakMap");
34 } 34 }
35 35
36 %WeakCollectionInitialize(this); 36 %WeakCollectionInitialize(this);
37 37
38 if (!IS_NULL_OR_UNDEFINED(iterable)) { 38 if (!IS_NULL_OR_UNDEFINED(iterable)) {
39 var adder = this.set; 39 var adder = this.set;
40 if (!IS_CALLABLE(adder)) { 40 if (!IS_CALLABLE(adder)) {
41 throw MakeTypeError(kPropertyNotFunction, 'set', this); 41 throw MakeTypeError(kPropertyNotFunction, 'set', this);
42 } 42 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 "get", WeakMapGet, 111 "get", WeakMapGet,
112 "set", WeakMapSet, 112 "set", WeakMapSet,
113 "has", WeakMapHas, 113 "has", WeakMapHas,
114 "delete", WeakMapDelete 114 "delete", WeakMapDelete
115 ]); 115 ]);
116 116
117 // ------------------------------------------------------------------- 117 // -------------------------------------------------------------------
118 // Harmony WeakSet 118 // Harmony WeakSet
119 119
120 function WeakSetConstructor(iterable) { 120 function WeakSetConstructor(iterable) {
121 if (!%_IsConstructCall()) { 121 if (IS_UNDEFINED(new.target)) {
122 throw MakeTypeError(kConstructorNotFunction, "WeakSet"); 122 throw MakeTypeError(kConstructorNotFunction, "WeakSet");
123 } 123 }
124 124
125 %WeakCollectionInitialize(this); 125 %WeakCollectionInitialize(this);
126 126
127 if (!IS_NULL_OR_UNDEFINED(iterable)) { 127 if (!IS_NULL_OR_UNDEFINED(iterable)) {
128 var adder = this.add; 128 var adder = this.add;
129 if (!IS_CALLABLE(adder)) { 129 if (!IS_CALLABLE(adder)) {
130 throw MakeTypeError(kPropertyNotFunction, 'add', this); 130 throw MakeTypeError(kPropertyNotFunction, 'add', this);
131 } 131 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 DONT_ENUM | READ_ONLY); 181 DONT_ENUM | READ_ONLY);
182 182
183 // Set up the non-enumerable functions on the WeakSet prototype object. 183 // Set up the non-enumerable functions on the WeakSet prototype object.
184 utils.InstallFunctions(GlobalWeakSet.prototype, DONT_ENUM, [ 184 utils.InstallFunctions(GlobalWeakSet.prototype, DONT_ENUM, [
185 "add", WeakSetAdd, 185 "add", WeakSetAdd,
186 "has", WeakSetHas, 186 "has", WeakSetHas,
187 "delete", WeakSetDelete 187 "delete", WeakSetDelete
188 ]); 188 ]);
189 189
190 }) 190 })
OLDNEW
« no previous file with comments | « src/js/proxy.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698