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

Unified Diff: src/objects.cc

Issue 1306043003: Move runtime helper for ToName conversion onto Object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-heap-friends
Patch Set: Minor fixup. Created 5 years, 4 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/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 468aca53ec301e552e2510a2902daaddf5c931c3..2d83ac04944882e597320a4f7ae88470a7e3752d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -90,6 +90,18 @@ MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
}
+MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> object) {
+ if (object->IsName()) {
+ return Handle<Name>::cast(object);
+ } else {
+ Handle<Object> converted;
+ ASSIGN_RETURN_ON_EXCEPTION(isolate, converted,
+ Execution::ToString(isolate, object), Name);
+ return Handle<Name>::cast(converted);
+ }
+}
+
+
bool Object::BooleanValue() {
if (IsBoolean()) return IsTrue();
if (IsSmi()) return Smi::cast(this)->value() != 0;
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698