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

Unified Diff: src/collection.js

Issue 299703004: Use SameValueZero for Map and Set (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/collection.js
diff --git a/src/collection.js b/src/collection.js
index fefc7a0499db3c71ea1585ab2eb5a8767af755f9..94125fb89956caf6c7eb0b3f69060962c20fcb8f 100644
--- a/src/collection.js
+++ b/src/collection.js
@@ -11,25 +11,6 @@
var $Set = global.Set;
var $Map = global.Map;
-// Global sentinel to be used instead of undefined keys, which are not
-// supported internally but required for Harmony sets and maps.
-var undefined_sentinel = {};
-
-
-// Map and Set uses SameValueZero which means that +0 and -0 should be treated
-// as the same value.
-function NormalizeKey(key) {
- if (IS_UNDEFINED(key)) {
- return undefined_sentinel;
- }
-
- if (key === 0) {
- return 0;
- }
-
- return key;
-}
-
// -------------------------------------------------------------------
// Harmony Set
@@ -48,7 +29,7 @@ function SetAddJS(key) {
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.add', this]);
}
- return %SetAdd(this, NormalizeKey(key));
+ return %SetAdd(this, key);
}
@@ -57,7 +38,7 @@ function SetHasJS(key) {
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.has', this]);
}
- return %SetHas(this, NormalizeKey(key));
+ return %SetHas(this, key);
}
@@ -66,7 +47,6 @@ function SetDeleteJS(key) {
throw MakeTypeError('incompatible_method_receiver',
['Set.prototype.delete', this]);
}
- key = NormalizeKey(key);
if (%SetHas(this, key)) {
%SetDelete(this, key);
return true;
@@ -154,7 +134,7 @@ function MapGetJS(key) {
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.get', this]);
}
- return %MapGet(this, NormalizeKey(key));
+ return %MapGet(this, key);
}
@@ -163,7 +143,7 @@ function MapSetJS(key, value) {
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.set', this]);
}
- return %MapSet(this, NormalizeKey(key), value);
+ return %MapSet(this, key, value);
}
@@ -172,7 +152,7 @@ function MapHasJS(key) {
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.has', this]);
}
- return %MapHas(this, NormalizeKey(key));
+ return %MapHas(this, key);
}
@@ -181,7 +161,7 @@ function MapDeleteJS(key) {
throw MakeTypeError('incompatible_method_receiver',
['Map.prototype.delete', this]);
}
- return %MapDelete(this, NormalizeKey(key));
+ return %MapDelete(this, key);
}
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698