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

Unified Diff: src/runtime.js

Issue 12330012: ES6 symbols: Allow symbols as property names (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Platform ports Created 7 years, 10 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/runtime.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index 6b487349d25366179dcc7afdfe65c525ea83356a..09b39ffe1d0c857409ed86ceaabda299215f8a40 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -346,7 +346,7 @@ function SHR(y) {
// ECMA-262, section 11.4.1, page 46.
function DELETE(key, strict) {
- return %DeleteProperty(%ToObject(this), %ToString(key), strict);
+ return %DeleteProperty(%ToObject(this), %ToName(key), strict);
}
@@ -356,7 +356,7 @@ function IN(x) {
throw %MakeTypeError('invalid_in_operator_use', [this, x]);
}
return %_IsNonNegativeSmi(this) ?
- %HasElement(x, this) : %HasProperty(x, %ToString(this));
+ %HasElement(x, this) : %HasProperty(x, %ToName(this));
}
@@ -396,7 +396,7 @@ function INSTANCE_OF(F) {
// has a property with the given key; return the key as a string if
// it has. Otherwise returns 0 (smi). Used in for-in statements.
function FILTER_KEY(key) {
- var string = %ToString(key);
+ var string = %ToName(key);
if (%HasProperty(this, string)) return string;
return 0;
}
@@ -563,6 +563,12 @@ function NonStringToString(x) {
}
+// ES6 symbols
+function ToName(x) {
+ return IS_SYMBOL(x) ? x : %ToString(x);
+}
+
+
// ECMA-262, section 9.9, page 36.
function ToObject(x) {
if (IS_STRING(x)) return new $String(x);
« no previous file with comments | « src/runtime.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698