Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 60d96c28d9bb98b5588eb44cb72e33dfa5277177..3cf1145a1931b4e3cb4136000a86cfe0c68dd1fd 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -3314,6 +3314,23 @@ void ToNumberStub::Generate(MacroAssembler* masm) { |
} |
+void ToLengthStub::Generate(MacroAssembler* masm) { |
+ // The ToLength stub takes on argument in a0. |
+ Label not_smi, positive_smi; |
+ __ JumpIfNotSmi(a0, ¬_smi); |
+ STATIC_ASSERT(kSmiTag == 0); |
+ __ Branch(&positive_smi, ge, a0, Operand(zero_reg)); |
+ __ mov(a0, zero_reg); |
+ __ bind(&positive_smi); |
+ __ Ret(USE_DELAY_SLOT); |
+ __ mov(v0, a0); |
+ __ bind(¬_smi); |
+ |
+ __ push(a0); // Push argument. |
+ __ TailCallRuntime(Runtime::kToLength, 1, 1); |
+} |
+ |
+ |
void ToStringStub::Generate(MacroAssembler* masm) { |
// The ToString stub takes on argument in a0. |
Label is_number; |