Index: src/ppc/code-stubs-ppc.cc |
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc |
index 02177e2b8c9ce636c78e3391bb2e29acde20cbfe..e98639e372c8d6880846c62548dbdd98ef28694f 100644 |
--- a/src/ppc/code-stubs-ppc.cc |
+++ b/src/ppc/code-stubs-ppc.cc |
@@ -3334,6 +3334,28 @@ void ToNumberStub::Generate(MacroAssembler* masm) { |
} |
+void ToLengthStub::Generate(MacroAssembler* masm) { |
+ // The ToLength stub takes one argument in r3. |
+ Label not_smi; |
+ __ JumpIfNotSmi(r3, ¬_smi); |
+ STATIC_ASSERT(kSmiTag == 0); |
+ __ cmpi(r3, Operand::Zero()); |
+ if (CpuFeatures::IsSupported(ISELECT)) { |
+ __ isel(lt, r3, r0, r3); |
+ } else { |
+ Label positive; |
+ __ bgt(&positive); |
+ __ li(r3, Operand::Zero()); |
+ __ bind(&positive); |
+ } |
+ __ Ret(); |
+ __ bind(¬_smi); |
+ |
+ __ push(r3); // Push argument. |
+ __ TailCallRuntime(Runtime::kToLength, 1, 1); |
+} |
+ |
+ |
void ToStringStub::Generate(MacroAssembler* masm) { |
// The ToString stub takes one argument in r3. |
Label is_number; |