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 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2584 __ TailCallStub(&stub); | 2584 __ TailCallStub(&stub); |
2585 } | 2585 } |
2586 | 2586 |
2587 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { | 2587 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { |
2588 // The NonNumberToNumber stub takes one argument in r3. | 2588 // The NonNumberToNumber stub takes one argument in r3. |
2589 __ AssertNotNumber(r3); | 2589 __ AssertNotNumber(r3); |
2590 | 2590 |
2591 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); | 2591 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); |
2592 // r3: receiver | 2592 // r3: receiver |
2593 // r4: receiver instance type | 2593 // r4: receiver instance type |
2594 StringToNumberStub stub(masm->isolate()); | 2594 __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET, lt); |
2595 __ TailCallStub(&stub, lt); | |
2596 | 2595 |
2597 Label not_oddball; | 2596 Label not_oddball; |
2598 __ cmpi(r4, Operand(ODDBALL_TYPE)); | 2597 __ cmpi(r4, Operand(ODDBALL_TYPE)); |
2599 __ bne(¬_oddball); | 2598 __ bne(¬_oddball); |
2600 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset)); | 2599 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset)); |
2601 __ blr(); | 2600 __ blr(); |
2602 __ bind(¬_oddball); | 2601 __ bind(¬_oddball); |
2603 | 2602 |
2604 __ push(r3); // Push argument. | 2603 __ push(r3); // Push argument. |
2605 __ TailCallRuntime(Runtime::kToNumber); | 2604 __ TailCallRuntime(Runtime::kToNumber); |
2606 } | 2605 } |
2607 | 2606 |
2608 void StringToNumberStub::Generate(MacroAssembler* masm) { | |
2609 // The StringToNumber stub takes one argument in r3. | |
2610 __ AssertString(r3); | |
2611 | |
2612 // Check if string has a cached array index. | |
2613 Label runtime; | |
2614 __ lwz(r5, FieldMemOperand(r3, String::kHashFieldOffset)); | |
2615 __ And(r0, r5, Operand(String::kContainsCachedArrayIndexMask), SetRC); | |
2616 __ bne(&runtime, cr0); | |
2617 __ IndexFromHash(r5, r3); | |
2618 __ blr(); | |
2619 | |
2620 __ bind(&runtime); | |
2621 __ push(r3); // Push argument. | |
2622 __ TailCallRuntime(Runtime::kStringToNumber); | |
2623 } | |
2624 | |
2625 void ToStringStub::Generate(MacroAssembler* masm) { | 2607 void ToStringStub::Generate(MacroAssembler* masm) { |
2626 // The ToString stub takes one argument in r3. | 2608 // The ToString stub takes one argument in r3. |
2627 Label is_number; | 2609 Label is_number; |
2628 __ JumpIfSmi(r3, &is_number); | 2610 __ JumpIfSmi(r3, &is_number); |
2629 | 2611 |
2630 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); | 2612 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); |
2631 // r3: receiver | 2613 // r3: receiver |
2632 // r4: receiver instance type | 2614 // r4: receiver instance type |
2633 __ Ret(lt); | 2615 __ Ret(lt); |
2634 | 2616 |
(...skipping 3057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5692 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5674 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5693 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5675 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5694 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5676 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5695 } | 5677 } |
5696 | 5678 |
5697 #undef __ | 5679 #undef __ |
5698 } // namespace internal | 5680 } // namespace internal |
5699 } // namespace v8 | 5681 } // namespace v8 |
5700 | 5682 |
5701 #endif // V8_TARGET_ARCH_PPC | 5683 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |