OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); | 2654 STRING_INDEX_IS_NUMBER, RECEIVER_IS_STRING); |
2655 generator.GenerateFast(masm); | 2655 generator.GenerateFast(masm); |
2656 __ Drop(3); | 2656 __ Drop(3); |
2657 __ Ret(); | 2657 __ Ret(); |
2658 generator.SkipSlow(masm, &runtime); | 2658 generator.SkipSlow(masm, &runtime); |
2659 } | 2659 } |
2660 | 2660 |
2661 | 2661 |
2662 void ToNumberStub::Generate(MacroAssembler* masm) { | 2662 void ToNumberStub::Generate(MacroAssembler* masm) { |
2663 // The ToNumber stub takes one argument in r0. | 2663 // The ToNumber stub takes one argument in r0. |
2664 Label not_smi; | 2664 STATIC_ASSERT(kSmiTag == 0); |
2665 __ JumpIfNotSmi(r0, ¬_smi); | 2665 __ tst(r0, Operand(kSmiTagMask)); |
2666 __ Ret(); | 2666 __ Ret(eq); |
2667 __ bind(¬_smi); | |
2668 | 2667 |
2669 __ CompareObjectType(r0, r1, r1, HEAP_NUMBER_TYPE); | 2668 __ CompareObjectType(r0, r1, r1, HEAP_NUMBER_TYPE); |
2670 // r0: receiver | 2669 // r0: receiver |
2671 // r1: receiver instance type | 2670 // r1: receiver instance type |
2672 __ Ret(eq); | 2671 __ Ret(eq); |
2673 | 2672 |
2674 Label not_string, slow_string; | 2673 NonNumberToNumberStub stub(masm->isolate()); |
2675 __ cmp(r1, Operand(FIRST_NONSTRING_TYPE)); | 2674 __ TailCallStub(&stub); |
2676 __ b(hs, ¬_string); | 2675 } |
2677 // Check if string has a cached array index. | 2676 |
2678 __ ldr(r2, FieldMemOperand(r0, String::kHashFieldOffset)); | 2677 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { |
2679 __ tst(r2, Operand(String::kContainsCachedArrayIndexMask)); | 2678 // The NonNumberToNumber stub takes one argument in r0. |
2680 __ b(ne, &slow_string); | 2679 __ AssertNotNumber(r0); |
2681 __ IndexFromHash(r2, r0); | 2680 |
2682 __ Ret(); | 2681 __ CompareObjectType(r0, r1, r1, FIRST_NONSTRING_TYPE); |
2683 __ bind(&slow_string); | 2682 // r0: receiver |
2684 __ push(r0); // Push argument. | 2683 // r1: receiver instance type |
2685 __ TailCallRuntime(Runtime::kStringToNumber); | 2684 StringToNumberStub stub(masm->isolate()); |
2686 __ bind(¬_string); | 2685 __ TailCallStub(&stub, lo); |
2687 | 2686 |
2688 Label not_oddball; | 2687 Label not_oddball; |
2689 __ cmp(r1, Operand(ODDBALL_TYPE)); | 2688 __ cmp(r1, Operand(ODDBALL_TYPE)); |
2690 __ b(ne, ¬_oddball); | 2689 __ b(ne, ¬_oddball); |
2691 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); | 2690 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); |
2692 __ Ret(); | 2691 __ Ret(); |
2693 __ bind(¬_oddball); | 2692 __ bind(¬_oddball); |
2694 | 2693 |
2695 __ push(r0); // Push argument. | 2694 __ Push(r0); // Push argument. |
2696 __ TailCallRuntime(Runtime::kToNumber); | 2695 __ TailCallRuntime(Runtime::kToNumber); |
2697 } | 2696 } |
2698 | 2697 |
| 2698 void StringToNumberStub::Generate(MacroAssembler* masm) { |
| 2699 // The StringToNumber stub takes one argument in r0. |
| 2700 __ AssertString(r0); |
| 2701 |
| 2702 // Check if string has a cached array index. |
| 2703 Label runtime; |
| 2704 __ ldr(r2, FieldMemOperand(r0, String::kHashFieldOffset)); |
| 2705 __ tst(r2, Operand(String::kContainsCachedArrayIndexMask)); |
| 2706 __ b(ne, &runtime); |
| 2707 __ IndexFromHash(r2, r0); |
| 2708 __ Ret(); |
| 2709 |
| 2710 __ bind(&runtime); |
| 2711 __ Push(r0); // Push argument. |
| 2712 __ TailCallRuntime(Runtime::kStringToNumber); |
| 2713 } |
2699 | 2714 |
2700 void ToLengthStub::Generate(MacroAssembler* masm) { | 2715 void ToLengthStub::Generate(MacroAssembler* masm) { |
2701 // The ToLength stub takes one argument in r0. | 2716 // The ToLength stub takes one argument in r0. |
2702 Label not_smi; | 2717 Label not_smi; |
2703 __ JumpIfNotSmi(r0, ¬_smi); | 2718 __ JumpIfNotSmi(r0, ¬_smi); |
2704 STATIC_ASSERT(kSmiTag == 0); | 2719 STATIC_ASSERT(kSmiTag == 0); |
2705 __ tst(r0, r0); | 2720 __ tst(r0, r0); |
2706 __ mov(r0, Operand(0), LeaveCC, lt); | 2721 __ mov(r0, Operand(0), LeaveCC, lt); |
2707 __ Ret(); | 2722 __ Ret(); |
2708 __ bind(¬_smi); | 2723 __ bind(¬_smi); |
(...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5570 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5585 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5571 } | 5586 } |
5572 | 5587 |
5573 | 5588 |
5574 #undef __ | 5589 #undef __ |
5575 | 5590 |
5576 } // namespace internal | 5591 } // namespace internal |
5577 } // namespace v8 | 5592 } // namespace v8 |
5578 | 5593 |
5579 #endif // V8_TARGET_ARCH_ARM | 5594 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |