| 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 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 // -- rdx : message_id as Smi | 2121 // -- rdx : message_id as Smi |
| 2122 // -- rsp[0] : return address | 2122 // -- rsp[0] : return address |
| 2123 // ----------------------------------- | 2123 // ----------------------------------- |
| 2124 __ PopReturnAddressTo(rcx); | 2124 __ PopReturnAddressTo(rcx); |
| 2125 __ Push(rdx); | 2125 __ Push(rdx); |
| 2126 __ PushReturnAddressFrom(rcx); | 2126 __ PushReturnAddressFrom(rcx); |
| 2127 __ Move(rsi, Smi::FromInt(0)); | 2127 __ Move(rsi, Smi::FromInt(0)); |
| 2128 __ TailCallRuntime(Runtime::kAbort); | 2128 __ TailCallRuntime(Runtime::kAbort); |
| 2129 } | 2129 } |
| 2130 | 2130 |
| 2131 void Builtins::Generate_StringToNumber(MacroAssembler* masm) { | |
| 2132 // The StringToNumber stub takes one argument in rax. | |
| 2133 __ AssertString(rax); | |
| 2134 | |
| 2135 // Check if string has a cached array index. | |
| 2136 Label runtime; | |
| 2137 __ testl(FieldOperand(rax, String::kHashFieldOffset), | |
| 2138 Immediate(String::kContainsCachedArrayIndexMask)); | |
| 2139 __ j(not_zero, &runtime, Label::kNear); | |
| 2140 __ movl(rax, FieldOperand(rax, String::kHashFieldOffset)); | |
| 2141 __ IndexFromHash(rax, rax); | |
| 2142 __ Ret(); | |
| 2143 | |
| 2144 __ bind(&runtime); | |
| 2145 { | |
| 2146 FrameScope frame(masm, StackFrame::INTERNAL); | |
| 2147 // Push argument. | |
| 2148 __ Push(rax); | |
| 2149 // We cannot use a tail call here because this builtin can also be called | |
| 2150 // from wasm. | |
| 2151 __ CallRuntime(Runtime::kStringToNumber); | |
| 2152 } | |
| 2153 __ Ret(); | |
| 2154 } | |
| 2155 | |
| 2156 // static | 2131 // static |
| 2157 void Builtins::Generate_ToNumber(MacroAssembler* masm) { | 2132 void Builtins::Generate_ToNumber(MacroAssembler* masm) { |
| 2158 // The ToNumber stub takes one argument in rax. | 2133 // The ToNumber stub takes one argument in rax. |
| 2159 Label not_smi; | 2134 Label not_smi; |
| 2160 __ JumpIfNotSmi(rax, ¬_smi, Label::kNear); | 2135 __ JumpIfNotSmi(rax, ¬_smi, Label::kNear); |
| 2161 __ Ret(); | 2136 __ Ret(); |
| 2162 __ bind(¬_smi); | 2137 __ bind(¬_smi); |
| 2163 | 2138 |
| 2164 Label not_heap_number; | 2139 Label not_heap_number; |
| 2165 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | 2140 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3070 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3045 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 3071 Generate_OnStackReplacementHelper(masm, true); | 3046 Generate_OnStackReplacementHelper(masm, true); |
| 3072 } | 3047 } |
| 3073 | 3048 |
| 3074 #undef __ | 3049 #undef __ |
| 3075 | 3050 |
| 3076 } // namespace internal | 3051 } // namespace internal |
| 3077 } // namespace v8 | 3052 } // namespace v8 |
| 3078 | 3053 |
| 3079 #endif // V8_TARGET_ARCH_X64 | 3054 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |