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 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2759 Label not_heap_number; | 2759 Label not_heap_number; |
2760 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | 2760 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); |
2761 __ j(not_equal, ¬_heap_number, Label::kNear); | 2761 __ j(not_equal, ¬_heap_number, Label::kNear); |
2762 __ Ret(); | 2762 __ Ret(); |
2763 __ bind(¬_heap_number); | 2763 __ bind(¬_heap_number); |
2764 | 2764 |
2765 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), | 2765 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), |
2766 RelocInfo::CODE_TARGET); | 2766 RelocInfo::CODE_TARGET); |
2767 } | 2767 } |
2768 | 2768 |
2769 // static | |
2770 void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) { | |
2771 // The NonNumberToNumber stub takes one argument in eax. | |
2772 __ AssertNotNumber(eax); | |
2773 | |
2774 Label not_string; | |
2775 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | |
2776 // eax: object | |
2777 // edi: object map | |
2778 __ j(above_equal, ¬_string, Label::kNear); | |
2779 __ Jump(masm->isolate()->builtins()->StringToNumber(), | |
2780 RelocInfo::CODE_TARGET); | |
2781 __ bind(¬_string); | |
2782 | |
2783 Label not_oddball; | |
2784 __ CmpInstanceType(edi, ODDBALL_TYPE); | |
2785 __ j(not_equal, ¬_oddball, Label::kNear); | |
2786 __ mov(eax, FieldOperand(eax, Oddball::kToNumberOffset)); | |
2787 __ Ret(); | |
2788 __ bind(¬_oddball); | |
2789 { | |
2790 FrameScope frame(masm, StackFrame::INTERNAL); | |
2791 // Push argument. | |
2792 __ push(eax); | |
2793 // We cannot use a tail call here because this builtin can also be called | |
2794 // from wasm. | |
2795 __ CallRuntime(Runtime::kToNumber); | |
2796 } | |
2797 __ Ret(); | |
2798 } | |
2799 | |
2800 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2769 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2801 // ----------- S t a t e ------------- | 2770 // ----------- S t a t e ------------- |
2802 // -- eax : actual number of arguments | 2771 // -- eax : actual number of arguments |
2803 // -- ebx : expected number of arguments | 2772 // -- ebx : expected number of arguments |
2804 // -- edx : new target (passed through to callee) | 2773 // -- edx : new target (passed through to callee) |
2805 // -- edi : function (passed through to callee) | 2774 // -- edi : function (passed through to callee) |
2806 // ----------------------------------- | 2775 // ----------------------------------- |
2807 | 2776 |
2808 Label invoke, dont_adapt_arguments, stack_overflow; | 2777 Label invoke, dont_adapt_arguments, stack_overflow; |
2809 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); | 2778 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 | 3015 |
3047 // And "return" to the OSR entry point of the function. | 3016 // And "return" to the OSR entry point of the function. |
3048 __ ret(0); | 3017 __ ret(0); |
3049 } | 3018 } |
3050 | 3019 |
3051 #undef __ | 3020 #undef __ |
3052 } // namespace internal | 3021 } // namespace internal |
3053 } // namespace v8 | 3022 } // namespace v8 |
3054 | 3023 |
3055 #endif // V8_TARGET_ARCH_X87 | 3024 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |