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

Side by Side Diff: src/collection.js

Issue 1127543003: Revert of Reland "Wrap v8natives.js into a function." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/bootstrapper.cc ('k') | src/collection-iterator.js » ('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 (function() { 5 (function() {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11 var GlobalMap = global.Map; 11 var GlobalMap = global.Map;
12 var GlobalObject = global.Object; 12 var GlobalObject = global.Object;
13 var GlobalSet = global.Set; 13 var GlobalSet = global.Set;
14 14
15 // ------------------------------------------------------------------- 15 // -------------------------------------------------------------------
16 16
17 function HashToEntry(table, hash, numBuckets) { 17 function HashToEntry(table, hash, numBuckets) {
18 var bucket = ORDERED_HASH_TABLE_HASH_TO_BUCKET(hash, numBuckets); 18 var bucket = ORDERED_HASH_TABLE_HASH_TO_BUCKET(hash, numBuckets);
19 return ORDERED_HASH_TABLE_BUCKET_AT(table, bucket); 19 return ORDERED_HASH_TABLE_BUCKET_AT(table, bucket);
20 } 20 }
21 %SetInlineBuiltinFlag(HashToEntry); 21 %SetInlineBuiltinFlag(HashToEntry);
22 22
23 23
24 function SetFindEntry(table, numBuckets, key, hash) { 24 function SetFindEntry(table, numBuckets, key, hash) {
25 var keyIsNaN = $numberIsNaN(key); 25 var keyIsNaN = NumberIsNaN(key);
26 for (var entry = HashToEntry(table, hash, numBuckets); 26 for (var entry = HashToEntry(table, hash, numBuckets);
27 entry !== NOT_FOUND; 27 entry !== NOT_FOUND;
28 entry = ORDERED_HASH_SET_CHAIN_AT(table, entry, numBuckets)) { 28 entry = ORDERED_HASH_SET_CHAIN_AT(table, entry, numBuckets)) {
29 var candidate = ORDERED_HASH_SET_KEY_AT(table, entry, numBuckets); 29 var candidate = ORDERED_HASH_SET_KEY_AT(table, entry, numBuckets);
30 if (key === candidate) { 30 if (key === candidate) {
31 return entry; 31 return entry;
32 } 32 }
33 if (keyIsNaN && $numberIsNaN(candidate)) { 33 if (keyIsNaN && NumberIsNaN(candidate)) {
34 return entry; 34 return entry;
35 } 35 }
36 } 36 }
37 return NOT_FOUND; 37 return NOT_FOUND;
38 } 38 }
39 %SetInlineBuiltinFlag(SetFindEntry); 39 %SetInlineBuiltinFlag(SetFindEntry);
40 40
41 41
42 function MapFindEntry(table, numBuckets, key, hash) { 42 function MapFindEntry(table, numBuckets, key, hash) {
43 var keyIsNaN = $numberIsNaN(key); 43 var keyIsNaN = NumberIsNaN(key);
44 for (var entry = HashToEntry(table, hash, numBuckets); 44 for (var entry = HashToEntry(table, hash, numBuckets);
45 entry !== NOT_FOUND; 45 entry !== NOT_FOUND;
46 entry = ORDERED_HASH_MAP_CHAIN_AT(table, entry, numBuckets)) { 46 entry = ORDERED_HASH_MAP_CHAIN_AT(table, entry, numBuckets)) {
47 var candidate = ORDERED_HASH_MAP_KEY_AT(table, entry, numBuckets); 47 var candidate = ORDERED_HASH_MAP_KEY_AT(table, entry, numBuckets);
48 if (key === candidate) { 48 if (key === candidate) {
49 return entry; 49 return entry;
50 } 50 }
51 if (keyIsNaN && $numberIsNaN(candidate)) { 51 if (keyIsNaN && NumberIsNaN(candidate)) {
52 return entry; 52 return entry;
53 } 53 }
54 } 54 }
55 return NOT_FOUND; 55 return NOT_FOUND;
56 } 56 }
57 %SetInlineBuiltinFlag(MapFindEntry); 57 %SetInlineBuiltinFlag(MapFindEntry);
58 58
59 59
60 function ComputeIntegerHash(key, seed) { 60 function ComputeIntegerHash(key, seed) {
61 var hash = key; 61 var hash = key;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 %SetCode(GlobalSet, SetConstructor); 232 %SetCode(GlobalSet, SetConstructor);
233 %FunctionSetLength(GlobalSet, 0); 233 %FunctionSetLength(GlobalSet, 0);
234 %FunctionSetPrototype(GlobalSet, new GlobalObject()); 234 %FunctionSetPrototype(GlobalSet, new GlobalObject());
235 %AddNamedProperty(GlobalSet.prototype, "constructor", GlobalSet, DONT_ENUM); 235 %AddNamedProperty(GlobalSet.prototype, "constructor", GlobalSet, DONT_ENUM);
236 %AddNamedProperty(GlobalSet.prototype, symbolToStringTag, "Set", 236 %AddNamedProperty(GlobalSet.prototype, symbolToStringTag, "Set",
237 DONT_ENUM | READ_ONLY); 237 DONT_ENUM | READ_ONLY);
238 238
239 %FunctionSetLength(SetForEach, 1); 239 %FunctionSetLength(SetForEach, 1);
240 240
241 // Set up the non-enumerable functions on the Set prototype object. 241 // Set up the non-enumerable functions on the Set prototype object.
242 $installGetter(GlobalSet.prototype, "size", SetGetSize); 242 InstallGetter(GlobalSet.prototype, "size", SetGetSize);
243 $installFunctions(GlobalSet.prototype, DONT_ENUM, [ 243 InstallFunctions(GlobalSet.prototype, DONT_ENUM, [
244 "add", SetAdd, 244 "add", SetAdd,
245 "has", SetHas, 245 "has", SetHas,
246 "delete", SetDelete, 246 "delete", SetDelete,
247 "clear", SetClearJS, 247 "clear", SetClearJS,
248 "forEach", SetForEach 248 "forEach", SetForEach
249 ]); 249 ]);
250 250
251 251
252 // ------------------------------------------------------------------- 252 // -------------------------------------------------------------------
253 // Harmony Map 253 // Harmony Map
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 %SetCode(GlobalMap, MapConstructor); 420 %SetCode(GlobalMap, MapConstructor);
421 %FunctionSetLength(GlobalMap, 0); 421 %FunctionSetLength(GlobalMap, 0);
422 %FunctionSetPrototype(GlobalMap, new GlobalObject()); 422 %FunctionSetPrototype(GlobalMap, new GlobalObject());
423 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM); 423 %AddNamedProperty(GlobalMap.prototype, "constructor", GlobalMap, DONT_ENUM);
424 %AddNamedProperty( 424 %AddNamedProperty(
425 GlobalMap.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY); 425 GlobalMap.prototype, symbolToStringTag, "Map", DONT_ENUM | READ_ONLY);
426 426
427 %FunctionSetLength(MapForEach, 1); 427 %FunctionSetLength(MapForEach, 1);
428 428
429 // Set up the non-enumerable functions on the Map prototype object. 429 // Set up the non-enumerable functions on the Map prototype object.
430 $installGetter(GlobalMap.prototype, "size", MapGetSize); 430 InstallGetter(GlobalMap.prototype, "size", MapGetSize);
431 $installFunctions(GlobalMap.prototype, DONT_ENUM, [ 431 InstallFunctions(GlobalMap.prototype, DONT_ENUM, [
432 "get", MapGet, 432 "get", MapGet,
433 "set", MapSet, 433 "set", MapSet,
434 "has", MapHas, 434 "has", MapHas,
435 "delete", MapDelete, 435 "delete", MapDelete,
436 "clear", MapClearJS, 436 "clear", MapClearJS,
437 "forEach", MapForEach 437 "forEach", MapForEach
438 ]); 438 ]);
439 439
440 })(); 440 })();
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/collection-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698