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

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

Issue 1087633005: Start migrating error message templates to the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix windows build Created 5 years, 8 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-scopes.cc ('k') | test/cctest/test-strings.cc » ('j') | 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 "use strict"; 5 "use strict";
6 6
7 // This file relies on the fact that the following declaration has been made 7 // This file relies on the fact that the following declaration has been made
8 // in runtime.js: 8 // in runtime.js:
9 // var $Array = global.Array; 9 // var $Array = global.Array;
10 10
11 var $WeakMap = global.WeakMap; 11 var $WeakMap = global.WeakMap;
12 var $WeakSet = global.WeakSet; 12 var $WeakSet = global.WeakSet;
13 13
14 14
15 // ------------------------------------------------------------------- 15 // -------------------------------------------------------------------
16 // Harmony WeakMap 16 // Harmony WeakMap
17 17
18 function WeakMapConstructor(iterable) { 18 function WeakMapConstructor(iterable) {
19 if (!%_IsConstructCall()) { 19 if (!%_IsConstructCall()) {
20 throw MakeTypeError('constructor_not_function', ['WeakMap']); 20 throw MakeTypeError('constructor_not_function', ['WeakMap']);
21 } 21 }
22 22
23 %WeakCollectionInitialize(this); 23 %WeakCollectionInitialize(this);
24 24
25 if (!IS_NULL_OR_UNDEFINED(iterable)) { 25 if (!IS_NULL_OR_UNDEFINED(iterable)) {
26 var adder = this.set; 26 var adder = this.set;
27 if (!IS_SPEC_FUNCTION(adder)) { 27 if (!IS_SPEC_FUNCTION(adder)) {
28 throw MakeTypeError('property_not_function', ['set', this]); 28 throw MakeTypeError(kPropertyNotFunction, ['set', this]);
29 } 29 }
30 for (var nextItem of iterable) { 30 for (var nextItem of iterable) {
31 if (!IS_SPEC_OBJECT(nextItem)) { 31 if (!IS_SPEC_OBJECT(nextItem)) {
32 throw MakeTypeError('iterator_value_not_an_object', [nextItem]); 32 throw MakeTypeError('iterator_value_not_an_object', [nextItem]);
33 } 33 }
34 %_CallFunction(this, nextItem[0], nextItem[1], adder); 34 %_CallFunction(this, nextItem[0], nextItem[1], adder);
35 } 35 }
36 } 36 }
37 } 37 }
38 38
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 function WeakSetConstructor(iterable) { 109 function WeakSetConstructor(iterable) {
110 if (!%_IsConstructCall()) { 110 if (!%_IsConstructCall()) {
111 throw MakeTypeError('constructor_not_function', ['WeakSet']); 111 throw MakeTypeError('constructor_not_function', ['WeakSet']);
112 } 112 }
113 113
114 %WeakCollectionInitialize(this); 114 %WeakCollectionInitialize(this);
115 115
116 if (!IS_NULL_OR_UNDEFINED(iterable)) { 116 if (!IS_NULL_OR_UNDEFINED(iterable)) {
117 var adder = this.add; 117 var adder = this.add;
118 if (!IS_SPEC_FUNCTION(adder)) { 118 if (!IS_SPEC_FUNCTION(adder)) {
119 throw MakeTypeError('property_not_function', ['add', this]); 119 throw MakeTypeError(kPropertyNotFunction, ['add', this]);
120 } 120 }
121 for (var value of iterable) { 121 for (var value of iterable) {
122 %_CallFunction(this, value, adder); 122 %_CallFunction(this, value, adder);
123 } 123 }
124 } 124 }
125 } 125 }
126 126
127 127
128 function WeakSetAdd(value) { 128 function WeakSetAdd(value) {
129 if (!IS_WEAKSET(this)) { 129 if (!IS_WEAKSET(this)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 // Set up the non-enumerable functions on the WeakSet prototype object. 172 // Set up the non-enumerable functions on the WeakSet prototype object.
173 InstallFunctions($WeakSet.prototype, DONT_ENUM, [ 173 InstallFunctions($WeakSet.prototype, DONT_ENUM, [
174 "add", WeakSetAdd, 174 "add", WeakSetAdd,
175 "has", WeakSetHas, 175 "has", WeakSetHas,
176 "delete", WeakSetDelete 176 "delete", WeakSetDelete
177 ]); 177 ]);
178 } 178 }
179 179
180 SetUpWeakSet(); 180 SetUpWeakSet();
OLDNEW
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698