__ CompareObjectType(r0, r1, r1, LAST_NAME_TYPE);
__ b(ls, &done_convert);
__ bind(&convert);
- ToStringStub stub(isolate());
- __ CallStub(&stub);
+ __ Push(r0);
+ __ CallRuntime(Runtime::kToName, 1);
__ bind(&done_convert);
context()->Plug(r0);
}
STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE);
__ JumpIfObjectType(x0, x1, x1, LAST_NAME_TYPE, &done_convert, ls);
__ Bind(&convert);
- ToStringStub stub(isolate());
- __ CallStub(&stub);
+ __ Push(x0);
+ __ CallRuntime(Runtime::kToName, 1);
__ Bind(&done_convert);
context()->Plug(x0);
}
__ CmpObjectType(eax, LAST_NAME_TYPE, ecx);
__ j(below_equal, &done_convert, Label::kNear);
__ bind(&convert);
- ToStringStub stub(isolate());
- __ CallStub(&stub);
+ __ Push(eax);
+ __ CallRuntime(Runtime::kToName, 1);
__ bind(&done_convert);
context()->Plug(eax);
}
__ GetObjectType(v0, a1, a1);
__ Branch(&done_convert, le, a1, Operand(LAST_NAME_TYPE));
__ bind(&convert);
- ToStringStub stub(isolate());
- __ mov(a0, v0);
- __ CallStub(&stub);
+ __ Push(v0);
+ __ CallRuntime(Runtime::kToName, 1);
__ bind(&done_convert);
context()->Plug(v0);
}
__ GetObjectType(v0, a1, a1);
__ Branch(&done_convert, le, a1, Operand(LAST_NAME_TYPE));
__ bind(&convert);
- ToStringStub stub(isolate());
- __ mov(a0, v0);
- __ CallStub(&stub);
+ __ Push(v0);
+ __ CallRuntime(Runtime::kToName, 1);
__ bind(&done_convert);
context()->Plug(v0);
}
__ CmpObjectType(rax, LAST_NAME_TYPE, rcx);
__ j(below_equal, &done_convert, Label::kNear);
__ bind(&convert);
- ToStringStub stub(isolate());
- __ CallStub(&stub);
+ __ Push(rax);
+ __ CallRuntime(Runtime::kToName, 1);
__ bind(&done_convert);
context()->Plug(rax);
}
}
-// static
-MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> input) {
- if (input->IsName()) return Handle<Name>::cast(input);
- return ToString(isolate, input);
-}
-
-
// static
MaybeHandle<Object> Object::ToPrimitive(Handle<Object> input,
ToPrimitiveHint hint) {
}
+// static
+MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> input) {
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate, input, Object::ToPrimitive(input, ToPrimitiveHint::kString),
+ Name);
+ if (input->IsName()) return Handle<Name>::cast(input);
+ return ToString(isolate, input);
+}
+
+
// static
MaybeHandle<Object> Object::ToNumber(Handle<Object> input) {
while (true) {
Isolate* isolate, Handle<Object> object, Handle<Context> context);
// ES6 section 7.1.14 ToPropertyKey
- MUST_USE_RESULT static inline MaybeHandle<Name> ToName(Isolate* isolate,
- Handle<Object> input);
+ MUST_USE_RESULT static MaybeHandle<Name> ToName(Isolate* isolate,
+ Handle<Object> input);
// ES6 section 7.1.1 ToPrimitive
MUST_USE_RESULT static inline MaybeHandle<Object> ToPrimitive(