Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index 4555a81c5eaa7947b6849d0ed67da08dd147619c..62d68fdb8f9b35042a03c8db03a40469ea771ac3 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -3999,6 +3999,38 @@ void ToNumberStub::Generate(MacroAssembler* masm) { |
} |
+void ToStringStub::Generate(MacroAssembler* masm) { |
+ // The ToString stub takes one argument in x0. |
+ Label is_number; |
+ __ JumpIfSmi(x0, &is_number); |
+ |
+ Label not_string; |
+ __ JumpIfObjectType(x0, x1, x1, FIRST_NONSTRING_TYPE, ¬_string, hs); |
+ // x0: receiver |
+ // x1: receiver instance type |
+ __ Ret(); |
+ __ Bind(¬_string); |
+ |
+ Label not_heap_number; |
+ __ Cmp(x1, HEAP_NUMBER_TYPE); |
+ __ B(ne, ¬_heap_number); |
+ __ Bind(&is_number); |
+ NumberToStringStub stub(isolate()); |
+ __ TailCallStub(&stub); |
+ __ Bind(¬_heap_number); |
+ |
+ Label not_oddball; |
+ __ Cmp(x1, ODDBALL_TYPE); |
+ __ B(ne, ¬_oddball); |
+ __ Ldr(x0, FieldMemOperand(x0, Oddball::kToStringOffset)); |
+ __ Ret(); |
+ __ Bind(¬_oddball); |
+ |
+ __ Push(x0); // Push argument. |
+ __ TailCallRuntime(Runtime::kToString, 1, 1); |
+} |
+ |
+ |
void StringHelper::GenerateFlatOneByteStringEquals( |
MacroAssembler* masm, Register left, Register right, Register scratch1, |
Register scratch2, Register scratch3) { |