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

Unified Diff: src/runtime/runtime-function.cc

Issue 639123009: Classes: Add basic support for properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: git rebase Created 6 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/runtime/runtime-debug.cc ('k') | src/runtime/runtime-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-function.cc
diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc
index a720f812e0352fd046ee2b253f522b259caf8cf6..e25b6592e00130ffb52f7d5157af2048e487bde8 100644
--- a/src/runtime/runtime-function.cc
+++ b/src/runtime/runtime-function.cc
@@ -9,7 +9,6 @@
#include "src/compiler.h"
#include "src/deoptimizer.h"
#include "src/frames.h"
-#include "src/runtime/runtime.h"
#include "src/runtime/runtime-utils.h"
namespace v8 {
@@ -68,13 +67,32 @@ RUNTIME_FUNCTION(Runtime_FunctionGetName) {
}
+static Handle<String> NameToFunctionName(Handle<Name> name) {
+ Handle<String> stringName(name->GetHeap()->empty_string());
+
+ // TODO(caitp): Follow proper rules in section 9.2.11 (SetFunctionName)
+ if (name->IsSymbol()) {
+ Handle<Object> description(Handle<Symbol>::cast(name)->name(),
+ name->GetIsolate());
+ if (description->IsString()) {
+ stringName = Handle<String>::cast(description);
+ }
+ } else {
+ stringName = Handle<String>::cast(name);
+ }
+
+ return stringName;
+}
+
+
RUNTIME_FUNCTION(Runtime_FunctionSetName) {
- SealHandleScope shs(isolate);
+ HandleScope scope(isolate);
DCHECK(args.length() == 2);
- CONVERT_ARG_CHECKED(JSFunction, f, 0);
- CONVERT_ARG_CHECKED(String, name, 1);
- f->shared()->set_name(name);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
+
+ f->shared()->set_name(*NameToFunctionName(name));
return isolate->heap()->undefined_value();
}
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/runtime/runtime-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698