Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index fc75e082baeffe8fc47bb51f9b893156c045f705..0a7b4752656e9c2c589e31d0d338a5d4b9d8c5c3 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -3914,6 +3914,21 @@ void ToNumberStub::Generate(MacroAssembler* masm) { |
} |
+void ToLengthStub::Generate(MacroAssembler* masm) { |
+ // The ToLength stub takes one argument in x0. |
+ Label not_smi; |
+ __ JumpIfNotSmi(x0, ¬_smi); |
+ STATIC_ASSERT(kSmiTag == 0); |
+ __ Tst(x0, x0); |
+ __ Csel(x0, x0, Operand(0), ge); |
+ __ Ret(); |
+ __ Bind(¬_smi); |
+ |
+ __ Push(x0); // Push argument. |
+ __ TailCallRuntime(Runtime::kToLength, 1, 1); |
+} |
+ |
+ |
void ToStringStub::Generate(MacroAssembler* masm) { |
// The ToString stub takes one argument in x0. |
Label is_number; |