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 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 Label not_heap_number; | 2735 Label not_heap_number; |
2736 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | 2736 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); |
2737 __ j(not_equal, ¬_heap_number, Label::kNear); | 2737 __ j(not_equal, ¬_heap_number, Label::kNear); |
2738 __ Ret(); | 2738 __ Ret(); |
2739 __ bind(¬_heap_number); | 2739 __ bind(¬_heap_number); |
2740 | 2740 |
2741 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), | 2741 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), |
2742 RelocInfo::CODE_TARGET); | 2742 RelocInfo::CODE_TARGET); |
2743 } | 2743 } |
2744 | 2744 |
2745 // static | |
2746 void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) { | |
2747 // The NonNumberToNumber stub takes one argument in eax. | |
2748 __ AssertNotNumber(eax); | |
2749 | |
2750 Label not_string; | |
2751 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | |
2752 // eax: object | |
2753 // edi: object map | |
2754 __ j(above_equal, ¬_string, Label::kNear); | |
2755 __ Jump(masm->isolate()->builtins()->StringToNumber(), | |
2756 RelocInfo::CODE_TARGET); | |
2757 __ bind(¬_string); | |
2758 | |
2759 Label not_oddball; | |
2760 __ CmpInstanceType(edi, ODDBALL_TYPE); | |
2761 __ j(not_equal, ¬_oddball, Label::kNear); | |
2762 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset)); | |
2763 __ Ret(); | |
2764 __ bind(¬_oddball); | |
2765 { | |
2766 FrameScope frame(masm, StackFrame::INTERNAL); | |
2767 // Push argument. | |
2768 __ push(eax); | |
2769 // We cannot use a tail call here because this builtin can also be called | |
2770 // from wasm. | |
2771 __ CallRuntime(Runtime::kToNumber); | |
2772 } | |
2773 __ Ret(); | |
2774 } | |
2775 | |
2776 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2745 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2777 // ----------- S t a t e ------------- | 2746 // ----------- S t a t e ------------- |
2778 // -- eax : actual number of arguments | 2747 // -- eax : actual number of arguments |
2779 // -- ebx : expected number of arguments | 2748 // -- ebx : expected number of arguments |
2780 // -- edx : new target (passed through to callee) | 2749 // -- edx : new target (passed through to callee) |
2781 // -- edi : function (passed through to callee) | 2750 // -- edi : function (passed through to callee) |
2782 // ----------------------------------- | 2751 // ----------------------------------- |
2783 | 2752 |
2784 Label invoke, dont_adapt_arguments, stack_overflow; | 2753 Label invoke, dont_adapt_arguments, stack_overflow; |
2785 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); | 2754 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3021 | 2990 |
3022 // And "return" to the OSR entry point of the function. | 2991 // And "return" to the OSR entry point of the function. |
3023 __ ret(0); | 2992 __ ret(0); |
3024 } | 2993 } |
3025 | 2994 |
3026 #undef __ | 2995 #undef __ |
3027 } // namespace internal | 2996 } // namespace internal |
3028 } // namespace v8 | 2997 } // namespace v8 |
3029 | 2998 |
3030 #endif // V8_TARGET_ARCH_IA32 | 2999 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |