OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 __ And(r0, r5, Operand(String::kContainsCachedArrayIndexMask), SetRC); | 2747 __ And(r0, r5, Operand(String::kContainsCachedArrayIndexMask), SetRC); |
2748 __ bne(&runtime, cr0); | 2748 __ bne(&runtime, cr0); |
2749 __ IndexFromHash(r5, r3); | 2749 __ IndexFromHash(r5, r3); |
2750 __ blr(); | 2750 __ blr(); |
2751 | 2751 |
2752 __ bind(&runtime); | 2752 __ bind(&runtime); |
2753 __ push(r3); // Push argument. | 2753 __ push(r3); // Push argument. |
2754 __ TailCallRuntime(Runtime::kStringToNumber); | 2754 __ TailCallRuntime(Runtime::kStringToNumber); |
2755 } | 2755 } |
2756 | 2756 |
2757 void ToLengthStub::Generate(MacroAssembler* masm) { | |
2758 // The ToLength stub takes one argument in r3. | |
2759 Label not_smi; | |
2760 __ JumpIfNotSmi(r3, ¬_smi); | |
2761 STATIC_ASSERT(kSmiTag == 0); | |
2762 __ cmpi(r3, Operand::Zero()); | |
2763 if (CpuFeatures::IsSupported(ISELECT)) { | |
2764 __ isel(lt, r3, r0, r3); | |
2765 } else { | |
2766 Label positive; | |
2767 __ bgt(&positive); | |
2768 __ li(r3, Operand::Zero()); | |
2769 __ bind(&positive); | |
2770 } | |
2771 __ Ret(); | |
2772 __ bind(¬_smi); | |
2773 | |
2774 __ push(r3); // Push argument. | |
2775 __ TailCallRuntime(Runtime::kToLength); | |
2776 } | |
2777 | |
2778 | |
2779 void ToStringStub::Generate(MacroAssembler* masm) { | 2757 void ToStringStub::Generate(MacroAssembler* masm) { |
2780 // The ToString stub takes one argument in r3. | 2758 // The ToString stub takes one argument in r3. |
2781 Label is_number; | 2759 Label is_number; |
2782 __ JumpIfSmi(r3, &is_number); | 2760 __ JumpIfSmi(r3, &is_number); |
2783 | 2761 |
2784 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); | 2762 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); |
2785 // r3: receiver | 2763 // r3: receiver |
2786 // r4: receiver instance type | 2764 // r4: receiver instance type |
2787 __ Ret(lt); | 2765 __ Ret(lt); |
2788 | 2766 |
(...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5809 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5787 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5810 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5788 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5811 } | 5789 } |
5812 | 5790 |
5813 | 5791 |
5814 #undef __ | 5792 #undef __ |
5815 } // namespace internal | 5793 } // namespace internal |
5816 } // namespace v8 | 5794 } // namespace v8 |
5817 | 5795 |
5818 #endif // V8_TARGET_ARCH_PPC | 5796 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |