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 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 // ----------------------------------- | 2069 // ----------------------------------- |
2070 __ Integer32ToSmi(rdx, rdx); | 2070 __ Integer32ToSmi(rdx, rdx); |
2071 __ PopReturnAddressTo(rcx); | 2071 __ PopReturnAddressTo(rcx); |
2072 __ Push(rdx); | 2072 __ Push(rdx); |
2073 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2073 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
2074 __ PushReturnAddressFrom(rcx); | 2074 __ PushReturnAddressFrom(rcx); |
2075 __ Move(rsi, Smi::FromInt(0)); | 2075 __ Move(rsi, Smi::FromInt(0)); |
2076 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2076 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
2077 } | 2077 } |
2078 | 2078 |
| 2079 void Builtins::Generate_StringToNumber(MacroAssembler* masm) { |
| 2080 // The StringToNumber stub takes one argument in rax. |
| 2081 __ AssertString(rax); |
| 2082 |
| 2083 // Check if string has a cached array index. |
| 2084 Label runtime; |
| 2085 __ testl(FieldOperand(rax, String::kHashFieldOffset), |
| 2086 Immediate(String::kContainsCachedArrayIndexMask)); |
| 2087 __ j(not_zero, &runtime, Label::kNear); |
| 2088 __ movl(rax, FieldOperand(rax, String::kHashFieldOffset)); |
| 2089 __ IndexFromHash(rax, rax); |
| 2090 __ Ret(); |
| 2091 |
| 2092 __ bind(&runtime); |
| 2093 __ PopReturnAddressTo(rcx); // Pop return address. |
| 2094 __ Push(rax); // Push argument. |
| 2095 __ PushReturnAddressFrom(rcx); // Push return address. |
| 2096 __ TailCallRuntime(Runtime::kStringToNumber); |
| 2097 } |
| 2098 |
2079 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2099 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2080 // ----------- S t a t e ------------- | 2100 // ----------- S t a t e ------------- |
2081 // -- rax : actual number of arguments | 2101 // -- rax : actual number of arguments |
2082 // -- rbx : expected number of arguments | 2102 // -- rbx : expected number of arguments |
2083 // -- rdx : new target (passed through to callee) | 2103 // -- rdx : new target (passed through to callee) |
2084 // -- rdi : function (passed through to callee) | 2104 // -- rdi : function (passed through to callee) |
2085 // ----------------------------------- | 2105 // ----------------------------------- |
2086 | 2106 |
2087 Label invoke, dont_adapt_arguments, stack_overflow; | 2107 Label invoke, dont_adapt_arguments, stack_overflow; |
2088 Counters* counters = masm->isolate()->counters(); | 2108 Counters* counters = masm->isolate()->counters(); |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2961 __ ret(0); | 2981 __ ret(0); |
2962 } | 2982 } |
2963 | 2983 |
2964 | 2984 |
2965 #undef __ | 2985 #undef __ |
2966 | 2986 |
2967 } // namespace internal | 2987 } // namespace internal |
2968 } // namespace v8 | 2988 } // namespace v8 |
2969 | 2989 |
2970 #endif // V8_TARGET_ARCH_X64 | 2990 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |