Index: src/mips64/code-stubs-mips64.cc |
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc |
index bff8717d48dfdbf5ff35d814a98e5fafb8e765c4..49647a42069474f7b959f24c732cbe5198aad776 100644 |
--- a/src/mips64/code-stubs-mips64.cc |
+++ b/src/mips64/code-stubs-mips64.cc |
@@ -3449,6 +3449,38 @@ void ToNumberStub::Generate(MacroAssembler* masm) { |
} |
+void ToStringStub::Generate(MacroAssembler* masm) { |
+ // The ToString stub takes on argument in a0. |
+ Label is_number; |
+ __ JumpIfSmi(a0, &is_number); |
+ |
+ Label not_string; |
+ __ GetObjectType(a0, a1, a1); |
+ // a0: receiver |
+ // a1: receiver instance type |
+ __ Branch(¬_string, ge, a1, Operand(FIRST_NONSTRING_TYPE)); |
+ __ Ret(USE_DELAY_SLOT); |
+ __ mov(v0, a0); |
+ __ bind(¬_string); |
+ |
+ Label not_heap_number; |
+ __ Branch(¬_heap_number, ne, a1, Operand(HEAP_NUMBER_TYPE)); |
+ __ bind(&is_number); |
+ NumberToStringStub stub(isolate()); |
+ __ TailCallStub(&stub); |
+ __ bind(¬_heap_number); |
+ |
+ Label not_oddball; |
+ __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); |
+ __ Ret(USE_DELAY_SLOT); |
+ __ ld(v0, FieldMemOperand(a0, Oddball::kToStringOffset)); |
+ __ bind(¬_oddball); |
+ |
+ __ push(a0); // Push argument. |
+ __ TailCallRuntime(Runtime::kToString, 1, 1); |
+} |
+ |
+ |
void StringHelper::GenerateFlatOneByteStringEquals( |
MacroAssembler* masm, Register left, Register right, Register scratch1, |
Register scratch2, Register scratch3) { |