Index: src/x87/code-stubs-x87.cc |
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc |
index 9fd6ce68bd3968a75376f25231c1a3e14a9f674d..88bbf07cc88c3c3e59dd2333dd95a6ef95e8aa4e 100644 |
--- a/src/x87/code-stubs-x87.cc |
+++ b/src/x87/code-stubs-x87.cc |
@@ -2868,6 +2868,42 @@ void ToStringStub::Generate(MacroAssembler* masm) { |
} |
+void ToNameStub::Generate(MacroAssembler* masm) { |
+ // The ToName stub takes one argument in eax. |
+ Label is_number; |
+ __ JumpIfSmi(eax, &is_number, Label::kNear); |
+ |
+ Label not_name; |
+ STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); |
+ __ CmpObjectType(eax, LAST_NAME_TYPE, edi); |
+ // eax: receiver |
+ // edi: receiver map |
+ __ j(above, ¬_name, Label::kNear); |
+ __ Ret(); |
+ __ bind(¬_name); |
+ |
+ Label not_heap_number; |
+ __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); |
+ __ j(not_equal, ¬_heap_number, Label::kNear); |
+ __ bind(&is_number); |
+ NumberToStringStub stub(isolate()); |
+ __ TailCallStub(&stub); |
+ __ bind(¬_heap_number); |
+ |
+ Label not_oddball; |
+ __ CmpInstanceType(edi, ODDBALL_TYPE); |
+ __ j(not_equal, ¬_oddball, Label::kNear); |
+ __ mov(eax, FieldOperand(eax, Oddball::kToStringOffset)); |
+ __ Ret(); |
+ __ bind(¬_oddball); |
+ |
+ __ pop(ecx); // Pop return address. |
+ __ push(eax); // Push argument. |
+ __ push(ecx); // Push return address. |
+ __ TailCallRuntime(Runtime::kToName); |
+} |
+ |
+ |
void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
Register left, |
Register right, |