Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 8ca8d58a45bddbedc6efdb218b398301da4c0a28..b103ccfbce7d4232a24d227adeb29c10b1e22d3b 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -684,8 +684,22 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { |
RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { |
NoHandleAllocation ha(isolate); |
- ASSERT(args.length() == 0); |
- return isolate->heap()->AllocateSymbol(); |
+ ASSERT(args.length() == 1); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); |
+ RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); |
+ Symbol* symbol; |
+ MaybeObject* maybe = isolate->heap()->AllocateSymbol(); |
+ if (!maybe->To(&symbol)) return maybe; |
+ if (name->IsString()) symbol->set_name(*name); |
+ return symbol; |
+} |
+ |
+ |
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolName) { |
+ NoHandleAllocation ha(isolate); |
+ ASSERT(args.length() == 1); |
+ CONVERT_ARG_CHECKED(Symbol, symbol, 0); |
+ return symbol->name(); |
} |