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_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2731 // -- esp[0] : return address | 2731 // -- esp[0] : return address |
2732 // ----------------------------------- | 2732 // ----------------------------------- |
2733 __ PopReturnAddressTo(ecx); | 2733 __ PopReturnAddressTo(ecx); |
2734 __ Push(edx); | 2734 __ Push(edx); |
2735 __ PushReturnAddressFrom(ecx); | 2735 __ PushReturnAddressFrom(ecx); |
2736 __ Move(esi, Smi::FromInt(0)); | 2736 __ Move(esi, Smi::FromInt(0)); |
2737 __ TailCallRuntime(Runtime::kAbort); | 2737 __ TailCallRuntime(Runtime::kAbort); |
2738 } | 2738 } |
2739 | 2739 |
2740 // static | 2740 // static |
2741 void Builtins::Generate_StringToNumber(MacroAssembler* masm) { | |
2742 // The StringToNumber stub takes one argument in eax. | |
2743 __ AssertString(eax); | |
2744 | |
2745 // Check if string has a cached array index. | |
2746 Label runtime; | |
2747 __ test(FieldOperand(eax, String::kHashFieldOffset), | |
2748 Immediate(String::kContainsCachedArrayIndexMask)); | |
2749 __ j(not_zero, &runtime, Label::kNear); | |
2750 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset)); | |
2751 __ IndexFromHash(eax, eax); | |
2752 __ Ret(); | |
2753 | |
2754 __ bind(&runtime); | |
2755 { | |
2756 FrameScope frame(masm, StackFrame::INTERNAL); | |
2757 // Push argument. | |
2758 __ push(eax); | |
2759 // We cannot use a tail call here because this builtin can also be called | |
2760 // from wasm. | |
2761 __ CallRuntime(Runtime::kStringToNumber); | |
2762 } | |
2763 __ Ret(); | |
2764 } | |
2765 | |
2766 // static | |
2767 void Builtins::Generate_ToNumber(MacroAssembler* masm) { | 2741 void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
2768 // The ToNumber stub takes one argument in eax. | 2742 // The ToNumber stub takes one argument in eax. |
2769 Label not_smi; | 2743 Label not_smi; |
2770 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | 2744 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); |
2771 __ Ret(); | 2745 __ Ret(); |
2772 __ bind(¬_smi); | 2746 __ bind(¬_smi); |
2773 | 2747 |
2774 Label not_heap_number; | 2748 Label not_heap_number; |
2775 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | 2749 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); |
2776 __ j(not_equal, ¬_heap_number, Label::kNear); | 2750 __ j(not_equal, ¬_heap_number, Label::kNear); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3051 | 3025 |
3052 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3026 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3053 Generate_OnStackReplacementHelper(masm, true); | 3027 Generate_OnStackReplacementHelper(masm, true); |
3054 } | 3028 } |
3055 | 3029 |
3056 #undef __ | 3030 #undef __ |
3057 } // namespace internal | 3031 } // namespace internal |
3058 } // namespace v8 | 3032 } // namespace v8 |
3059 | 3033 |
3060 #endif // V8_TARGET_ARCH_X87 | 3034 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |