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

Side by Side Diff: src/collection.js

Issue 14165004: Move creation of collection prototypes into JavaScript. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 %SetInitialize(this); 110 %SetInitialize(this);
111 } 111 }
112 112
113 113
114 // ------------------------------------------------------------------- 114 // -------------------------------------------------------------------
115 115
116 function SetUpSet() { 116 function SetUpSet() {
117 %CheckIsBootstrapping(); 117 %CheckIsBootstrapping();
118 118
119 %SetCode($Set, SetConstructor); 119 %SetCode($Set, SetConstructor);
120 %FunctionSetPrototype($Set, new $Object());
120 %SetProperty($Set.prototype, "constructor", $Set, DONT_ENUM); 121 %SetProperty($Set.prototype, "constructor", $Set, DONT_ENUM);
121 122
122 // Set up the non-enumerable functions on the Set prototype object. 123 // Set up the non-enumerable functions on the Set prototype object.
123 InstallGetter($Set.prototype, "size", SetGetSize); 124 InstallGetter($Set.prototype, "size", SetGetSize);
124 InstallFunctions($Set.prototype, DONT_ENUM, $Array( 125 InstallFunctions($Set.prototype, DONT_ENUM, $Array(
125 "add", SetAdd, 126 "add", SetAdd,
126 "has", SetHas, 127 "has", SetHas,
127 "delete", SetDelete, 128 "delete", SetDelete,
128 "clear", SetClear 129 "clear", SetClear
129 )); 130 ));
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 %MapInitialize(this); 211 %MapInitialize(this);
211 } 212 }
212 213
213 214
214 // ------------------------------------------------------------------- 215 // -------------------------------------------------------------------
215 216
216 function SetUpMap() { 217 function SetUpMap() {
217 %CheckIsBootstrapping(); 218 %CheckIsBootstrapping();
218 219
219 %SetCode($Map, MapConstructor); 220 %SetCode($Map, MapConstructor);
221 %FunctionSetPrototype($Map, new $Object());
220 %SetProperty($Map.prototype, "constructor", $Map, DONT_ENUM); 222 %SetProperty($Map.prototype, "constructor", $Map, DONT_ENUM);
221 223
222 // Set up the non-enumerable functions on the Map prototype object. 224 // Set up the non-enumerable functions on the Map prototype object.
223 InstallGetter($Map.prototype, "size", MapGetSize); 225 InstallGetter($Map.prototype, "size", MapGetSize);
224 InstallFunctions($Map.prototype, DONT_ENUM, $Array( 226 InstallFunctions($Map.prototype, DONT_ENUM, $Array(
225 "get", MapGet, 227 "get", MapGet,
226 "set", MapSet, 228 "set", MapSet,
227 "has", MapHas, 229 "has", MapHas,
228 "delete", MapDelete, 230 "delete", MapDelete,
229 "clear", MapClear 231 "clear", MapClear
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return %WeakMapDelete(this, key); 294 return %WeakMapDelete(this, key);
293 } 295 }
294 296
295 297
296 // ------------------------------------------------------------------- 298 // -------------------------------------------------------------------
297 299
298 function SetUpWeakMap() { 300 function SetUpWeakMap() {
299 %CheckIsBootstrapping(); 301 %CheckIsBootstrapping();
300 302
301 %SetCode($WeakMap, WeakMapConstructor); 303 %SetCode($WeakMap, WeakMapConstructor);
304 %FunctionSetPrototype($WeakMap, new $Object());
302 %SetProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); 305 %SetProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM);
303 306
304 // Set up the non-enumerable functions on the WeakMap prototype object. 307 // Set up the non-enumerable functions on the WeakMap prototype object.
305 InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array( 308 InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array(
306 "get", WeakMapGet, 309 "get", WeakMapGet,
307 "set", WeakMapSet, 310 "set", WeakMapSet,
308 "has", WeakMapHas, 311 "has", WeakMapHas,
309 "delete", WeakMapDelete 312 "delete", WeakMapDelete
310 )); 313 ));
311 } 314 }
312 315
313 SetUpWeakMap(); 316 SetUpWeakMap();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698