| 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-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 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2707 // -- esp[0] : return address | 2707 // -- esp[0] : return address |
| 2708 // ----------------------------------- | 2708 // ----------------------------------- |
| 2709 __ PopReturnAddressTo(ecx); | 2709 __ PopReturnAddressTo(ecx); |
| 2710 __ Push(edx); | 2710 __ Push(edx); |
| 2711 __ PushReturnAddressFrom(ecx); | 2711 __ PushReturnAddressFrom(ecx); |
| 2712 __ Move(esi, Smi::FromInt(0)); | 2712 __ Move(esi, Smi::FromInt(0)); |
| 2713 __ TailCallRuntime(Runtime::kAbort); | 2713 __ TailCallRuntime(Runtime::kAbort); |
| 2714 } | 2714 } |
| 2715 | 2715 |
| 2716 // static | 2716 // static |
| 2717 void Builtins::Generate_StringToNumber(MacroAssembler* masm) { | |
| 2718 // The StringToNumber stub takes one argument in eax. | |
| 2719 __ AssertString(eax); | |
| 2720 | |
| 2721 // Check if string has a cached array index. | |
| 2722 Label runtime; | |
| 2723 __ test(FieldOperand(eax, String::kHashFieldOffset), | |
| 2724 Immediate(String::kContainsCachedArrayIndexMask)); | |
| 2725 __ j(not_zero, &runtime, Label::kNear); | |
| 2726 __ mov(eax, FieldOperand(eax, String::kHashFieldOffset)); | |
| 2727 __ IndexFromHash(eax, eax); | |
| 2728 __ Ret(); | |
| 2729 | |
| 2730 __ bind(&runtime); | |
| 2731 { | |
| 2732 FrameScope frame(masm, StackFrame::INTERNAL); | |
| 2733 // Push argument. | |
| 2734 __ push(eax); | |
| 2735 // We cannot use a tail call here because this builtin can also be called | |
| 2736 // from wasm. | |
| 2737 __ CallRuntime(Runtime::kStringToNumber); | |
| 2738 } | |
| 2739 __ Ret(); | |
| 2740 } | |
| 2741 | |
| 2742 // static | |
| 2743 void Builtins::Generate_ToNumber(MacroAssembler* masm) { | 2717 void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
| 2744 // The ToNumber stub takes one argument in eax. | 2718 // The ToNumber stub takes one argument in eax. |
| 2745 Label not_smi; | 2719 Label not_smi; |
| 2746 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | 2720 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); |
| 2747 __ Ret(); | 2721 __ Ret(); |
| 2748 __ bind(¬_smi); | 2722 __ bind(¬_smi); |
| 2749 | 2723 |
| 2750 Label not_heap_number; | 2724 Label not_heap_number; |
| 2751 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | 2725 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); |
| 2752 __ j(not_equal, ¬_heap_number, Label::kNear); | 2726 __ j(not_equal, ¬_heap_number, Label::kNear); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3026 | 3000 |
| 3027 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3001 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 3028 Generate_OnStackReplacementHelper(masm, true); | 3002 Generate_OnStackReplacementHelper(masm, true); |
| 3029 } | 3003 } |
| 3030 | 3004 |
| 3031 #undef __ | 3005 #undef __ |
| 3032 } // namespace internal | 3006 } // namespace internal |
| 3033 } // namespace v8 | 3007 } // namespace v8 |
| 3034 | 3008 |
| 3035 #endif // V8_TARGET_ARCH_IA32 | 3009 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |