Index: src/x87/code-stubs-x87.cc |
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc |
index efe7645dc53443eb88496b64a5e6ec6af2b4bbcd..cbdb8f97461f2cc709bd1935b23e096e9ec93e06 100644 |
--- a/src/x87/code-stubs-x87.cc |
+++ b/src/x87/code-stubs-x87.cc |
@@ -2902,6 +2902,25 @@ void ToNumberStub::Generate(MacroAssembler* masm) { |
} |
+void ToLengthStub::Generate(MacroAssembler* masm) { |
+ // The ToLength stub takes on argument in eax. |
+ Label not_smi, positive_smi; |
+ __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); |
+ STATIC_ASSERT(kSmiTag == 0); |
+ __ test(eax, eax); |
+ __ j(greater_equal, &positive_smi, Label::kNear); |
+ __ xor_(eax, eax); |
+ __ bind(&positive_smi); |
+ __ Ret(); |
+ __ bind(¬_smi); |
+ |
+ __ pop(ecx); // Pop return address. |
+ __ push(eax); // Push argument. |
+ __ push(ecx); // Push return address. |
+ __ TailCallRuntime(Runtime::kToLength, 1, 1); |
+} |
+ |
+ |
void ToStringStub::Generate(MacroAssembler* masm) { |
// The ToString stub takes one argument in eax. |
Label is_number; |