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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 __ IndexFromHash(eax, eax); | 2654 __ IndexFromHash(eax, eax); |
2655 __ Ret(); | 2655 __ Ret(); |
2656 | 2656 |
2657 __ bind(&runtime); | 2657 __ bind(&runtime); |
2658 __ PopReturnAddressTo(ecx); // Pop return address. | 2658 __ PopReturnAddressTo(ecx); // Pop return address. |
2659 __ Push(eax); // Push argument. | 2659 __ Push(eax); // Push argument. |
2660 __ PushReturnAddressFrom(ecx); // Push return address. | 2660 __ PushReturnAddressFrom(ecx); // Push return address. |
2661 __ TailCallRuntime(Runtime::kStringToNumber); | 2661 __ TailCallRuntime(Runtime::kStringToNumber); |
2662 } | 2662 } |
2663 | 2663 |
2664 void ToLengthStub::Generate(MacroAssembler* masm) { | |
2665 // The ToLength stub takes on argument in eax. | |
2666 Label not_smi, positive_smi; | |
2667 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | |
2668 STATIC_ASSERT(kSmiTag == 0); | |
2669 __ test(eax, eax); | |
2670 __ j(greater_equal, &positive_smi, Label::kNear); | |
2671 __ xor_(eax, eax); | |
2672 __ bind(&positive_smi); | |
2673 __ Ret(); | |
2674 __ bind(¬_smi); | |
2675 | |
2676 __ pop(ecx); // Pop return address. | |
2677 __ push(eax); // Push argument. | |
2678 __ push(ecx); // Push return address. | |
2679 __ TailCallRuntime(Runtime::kToLength); | |
2680 } | |
2681 | |
2682 | |
2683 void ToStringStub::Generate(MacroAssembler* masm) { | 2664 void ToStringStub::Generate(MacroAssembler* masm) { |
2684 // The ToString stub takes one argument in eax. | 2665 // The ToString stub takes one argument in eax. |
2685 Label is_number; | 2666 Label is_number; |
2686 __ JumpIfSmi(eax, &is_number, Label::kNear); | 2667 __ JumpIfSmi(eax, &is_number, Label::kNear); |
2687 | 2668 |
2688 Label not_string; | 2669 Label not_string; |
2689 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | 2670 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); |
2690 // eax: receiver | 2671 // eax: receiver |
2691 // edi: receiver map | 2672 // edi: receiver map |
2692 __ j(above_equal, ¬_string, Label::kNear); | 2673 __ j(above_equal, ¬_string, Label::kNear); |
(...skipping 3165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5858 return_value_operand, NULL); | 5839 return_value_operand, NULL); |
5859 } | 5840 } |
5860 | 5841 |
5861 | 5842 |
5862 #undef __ | 5843 #undef __ |
5863 | 5844 |
5864 } // namespace internal | 5845 } // namespace internal |
5865 } // namespace v8 | 5846 } // namespace v8 |
5866 | 5847 |
5867 #endif // V8_TARGET_ARCH_IA32 | 5848 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |