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

Unified Diff: src/weak-collection.js

Issue 1398733002: Move builtin JavaScript sources into own directory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Also move macros.py file. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8natives.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/weak-collection.js
diff --git a/src/weak-collection.js b/src/weak-collection.js
deleted file mode 100644
index 1c60a2f47a695b19f69b2ea4fc2c1a1486b9002e..0000000000000000000000000000000000000000
--- a/src/weak-collection.js
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-(function(global, utils) {
-
-"use strict";
-
-%CheckIsBootstrapping();
-
-var GlobalObject = global.Object;
-var GlobalWeakMap = global.WeakMap;
-var GlobalWeakSet = global.WeakSet;
-var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
-
-// -------------------------------------------------------------------
-// Harmony WeakMap
-
-function WeakMapConstructor(iterable) {
- if (!%_IsConstructCall()) {
- throw MakeTypeError(kConstructorNotFunction, "WeakMap");
- }
-
- %WeakCollectionInitialize(this);
-
- if (!IS_NULL_OR_UNDEFINED(iterable)) {
- var adder = this.set;
- if (!IS_CALLABLE(adder)) {
- throw MakeTypeError(kPropertyNotFunction, 'set', this);
- }
- for (var nextItem of iterable) {
- if (!IS_SPEC_OBJECT(nextItem)) {
- throw MakeTypeError(kIteratorValueNotAnObject, nextItem);
- }
- %_Call(adder, this, nextItem[0], nextItem[1]);
- }
- }
-}
-
-
-function WeakMapGet(key) {
- if (!IS_WEAKMAP(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- 'WeakMap.prototype.get', this);
- }
- if (!IS_SPEC_OBJECT(key)) return UNDEFINED;
- var hash = $getExistingHash(key);
- if (IS_UNDEFINED(hash)) return UNDEFINED;
- return %WeakCollectionGet(this, key, hash);
-}
-
-
-function WeakMapSet(key, value) {
- if (!IS_WEAKMAP(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- 'WeakMap.prototype.set', this);
- }
- if (!IS_SPEC_OBJECT(key)) throw MakeTypeError(kInvalidWeakMapKey);
- return %WeakCollectionSet(this, key, value, $getHash(key));
-}
-
-
-function WeakMapHas(key) {
- if (!IS_WEAKMAP(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- 'WeakMap.prototype.has', this);
- }
- if (!IS_SPEC_OBJECT(key)) return false;
- var hash = $getExistingHash(key);
- if (IS_UNDEFINED(hash)) return false;
- return %WeakCollectionHas(this, key, hash);
-}
-
-
-function WeakMapDelete(key) {
- if (!IS_WEAKMAP(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- 'WeakMap.prototype.delete', this);
- }
- if (!IS_SPEC_OBJECT(key)) return false;
- var hash = $getExistingHash(key);
- if (IS_UNDEFINED(hash)) return false;
- return %WeakCollectionDelete(this, key, hash);
-}
-
-
-// -------------------------------------------------------------------
-
-%SetCode(GlobalWeakMap, WeakMapConstructor);
-%FunctionSetLength(GlobalWeakMap, 0);
-%FunctionSetPrototype(GlobalWeakMap, new GlobalObject());
-%AddNamedProperty(GlobalWeakMap.prototype, "constructor", GlobalWeakMap,
- DONT_ENUM);
-%AddNamedProperty(GlobalWeakMap.prototype, toStringTagSymbol, "WeakMap",
- DONT_ENUM | READ_ONLY);
-
-// Set up the non-enumerable functions on the WeakMap prototype object.
-utils.InstallFunctions(GlobalWeakMap.prototype, DONT_ENUM, [
- "get", WeakMapGet,
- "set", WeakMapSet,
- "has", WeakMapHas,
- "delete", WeakMapDelete
-]);
-
-// -------------------------------------------------------------------
-// Harmony WeakSet
-
-function WeakSetConstructor(iterable) {
- if (!%_IsConstructCall()) {
- throw MakeTypeError(kConstructorNotFunction, "WeakSet");
- }
-
- %WeakCollectionInitialize(this);
-
- if (!IS_NULL_OR_UNDEFINED(iterable)) {
- var adder = this.add;
- if (!IS_CALLABLE(adder)) {
- throw MakeTypeError(kPropertyNotFunction, 'add', this);
- }
- for (var value of iterable) {
- %_Call(adder, this, value);
- }
- }
-}
-
-
-function WeakSetAdd(value) {
- if (!IS_WEAKSET(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- 'WeakSet.prototype.add', this);
- }
- if (!IS_SPEC_OBJECT(value)) throw MakeTypeError(kInvalidWeakSetValue);
- return %WeakCollectionSet(this, value, true, $getHash(value));
-}
-
-
-function WeakSetHas(value) {
- if (!IS_WEAKSET(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- 'WeakSet.prototype.has', this);
- }
- if (!IS_SPEC_OBJECT(value)) return false;
- var hash = $getExistingHash(value);
- if (IS_UNDEFINED(hash)) return false;
- return %WeakCollectionHas(this, value, hash);
-}
-
-
-function WeakSetDelete(value) {
- if (!IS_WEAKSET(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- 'WeakSet.prototype.delete', this);
- }
- if (!IS_SPEC_OBJECT(value)) return false;
- var hash = $getExistingHash(value);
- if (IS_UNDEFINED(hash)) return false;
- return %WeakCollectionDelete(this, value, hash);
-}
-
-
-// -------------------------------------------------------------------
-
-%SetCode(GlobalWeakSet, WeakSetConstructor);
-%FunctionSetLength(GlobalWeakSet, 0);
-%FunctionSetPrototype(GlobalWeakSet, new GlobalObject());
-%AddNamedProperty(GlobalWeakSet.prototype, "constructor", GlobalWeakSet,
- DONT_ENUM);
-%AddNamedProperty(GlobalWeakSet.prototype, toStringTagSymbol, "WeakSet",
- DONT_ENUM | READ_ONLY);
-
-// Set up the non-enumerable functions on the WeakSet prototype object.
-utils.InstallFunctions(GlobalWeakSet.prototype, DONT_ENUM, [
- "add", WeakSetAdd,
- "has", WeakSetHas,
- "delete", WeakSetDelete
-]);
-
-})
« no previous file with comments | « src/v8natives.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698