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

Unified Diff: src/runtime.cc

Issue 118553003: Upgrade Symbol implementation to match current ES6 behavior. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Created 6 years, 12 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
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 713d4501ae5dfe521f6d28d743335366019db7a4..72d6ab2a5e6cabf863c33047938d11365e0d9f0e 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -629,7 +629,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreatePrivateSymbol) {
}
-RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolName) {
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolDescription) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(Symbol, symbol, 0);
@@ -637,6 +637,30 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolName) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolSetSymbolData) {
+ HandleScope shs(isolate);
+ ASSERT(args.length() == 2);
+ CONVERT_ARG_CHECKED(JSObject, wrapper, 0);
+ CONVERT_ARG_CHECKED(Symbol, symbol, 1);
+ Handle<String> key(isolate->factory()->symbol_string());
+ Handle<JSObject> holder(wrapper, isolate);
+ Handle<Symbol> value(symbol, isolate);
+ JSObject::SetHiddenProperty(holder, key, value);
+ return isolate->heap()->undefined_value();
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolGetSymbolData) {
+ HandleScope shs(isolate);
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_CHECKED(JSObject, wrapper, 0);
+ Handle<String> key(isolate->factory()->symbol_string());
+ Handle<Object> result(wrapper->GetHiddenProperty(*key), isolate);
+ if (result->IsTheHole()) return isolate->heap()->undefined_value();
+ return *result;
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
« no previous file with comments | « src/runtime.h ('k') | src/runtime.js » ('j') | test/mjsunit/harmony/symbols.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698