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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 2152 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
2153 Heap::kHeapNumberMapRootIndex); | 2153 Heap::kHeapNumberMapRootIndex); |
2154 __ j(not_equal, ¬_heap_number, Label::kNear); | 2154 __ j(not_equal, ¬_heap_number, Label::kNear); |
2155 __ Ret(); | 2155 __ Ret(); |
2156 __ bind(¬_heap_number); | 2156 __ bind(¬_heap_number); |
2157 | 2157 |
2158 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), | 2158 __ Jump(masm->isolate()->builtins()->NonNumberToNumber(), |
2159 RelocInfo::CODE_TARGET); | 2159 RelocInfo::CODE_TARGET); |
2160 } | 2160 } |
2161 | 2161 |
2162 // static | |
2163 void Builtins::Generate_NonNumberToNumber(MacroAssembler* masm) { | |
2164 // The NonNumberToNumber stub takes one argument in rax. | |
2165 __ AssertNotNumber(rax); | |
2166 | |
2167 Label not_string; | |
2168 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdi); | |
2169 // rax: object | |
2170 // rdi: object map | |
2171 __ j(above_equal, ¬_string, Label::kNear); | |
2172 __ Jump(masm->isolate()->builtins()->StringToNumber(), | |
2173 RelocInfo::CODE_TARGET); | |
2174 __ bind(¬_string); | |
2175 | |
2176 Label not_oddball; | |
2177 __ CmpInstanceType(rdi, ODDBALL_TYPE); | |
2178 __ j(not_equal, ¬_oddball, Label::kNear); | |
2179 __ movp(rax, FieldOperand(rax, Oddball::kToNumberOffset)); | |
2180 __ Ret(); | |
2181 __ bind(¬_oddball); | |
2182 { | |
2183 FrameScope frame(masm, StackFrame::INTERNAL); | |
2184 // Push argument. | |
2185 __ Push(rax); | |
2186 // We cannot use a tail call here because this builtin can also be called | |
2187 // from wasm. | |
2188 __ CallRuntime(Runtime::kToNumber); | |
2189 } | |
2190 __ Ret(); | |
2191 } | |
2192 | |
2193 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2162 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2194 // ----------- S t a t e ------------- | 2163 // ----------- S t a t e ------------- |
2195 // -- rax : actual number of arguments | 2164 // -- rax : actual number of arguments |
2196 // -- rbx : expected number of arguments | 2165 // -- rbx : expected number of arguments |
2197 // -- rdx : new target (passed through to callee) | 2166 // -- rdx : new target (passed through to callee) |
2198 // -- rdi : function (passed through to callee) | 2167 // -- rdi : function (passed through to callee) |
2199 // ----------------------------------- | 2168 // ----------------------------------- |
2200 | 2169 |
2201 Label invoke, dont_adapt_arguments, stack_overflow; | 2170 Label invoke, dont_adapt_arguments, stack_overflow; |
2202 Counters* counters = masm->isolate()->counters(); | 2171 Counters* counters = masm->isolate()->counters(); |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3065 // And "return" to the OSR entry point of the function. | 3034 // And "return" to the OSR entry point of the function. |
3066 __ ret(0); | 3035 __ ret(0); |
3067 } | 3036 } |
3068 | 3037 |
3069 #undef __ | 3038 #undef __ |
3070 | 3039 |
3071 } // namespace internal | 3040 } // namespace internal |
3072 } // namespace v8 | 3041 } // namespace v8 |
3073 | 3042 |
3074 #endif // V8_TARGET_ARCH_X64 | 3043 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |