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; |