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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/interface-descriptors.h" | 9 #include "src/interface-descriptors.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 const Register InterfaceDescriptor::ContextRegister() { return rsi; } | 14 const Register InterfaceDescriptor::ContextRegister() { return rsi; } |
15 | 15 |
16 | 16 |
17 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { | 17 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { |
| 18 InitializeForIsolateAllPlatforms(isolate); |
| 19 |
| 20 { |
| 21 CallInterfaceDescriptor* descriptor = |
| 22 isolate->call_descriptor(CallDescriptorKey::FastNewClosureCall); |
| 23 Register registers[] = {rsi, rbx}; |
| 24 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 25 } |
| 26 { |
| 27 CallInterfaceDescriptor* descriptor = |
| 28 isolate->call_descriptor(CallDescriptorKey::FastNewContextCall); |
| 29 Register registers[] = {rsi, rdi}; |
| 30 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 31 } |
| 32 { |
| 33 CallInterfaceDescriptor* descriptor = |
| 34 isolate->call_descriptor(CallDescriptorKey::ToNumberCall); |
| 35 // ToNumberStub invokes a function, and therefore needs a context. |
| 36 Register registers[] = {rsi, rax}; |
| 37 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 38 } |
| 39 { |
| 40 CallInterfaceDescriptor* descriptor = |
| 41 isolate->call_descriptor(CallDescriptorKey::NumberToStringCall); |
| 42 Register registers[] = {rsi, rax}; |
| 43 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 44 } |
| 45 { |
| 46 CallInterfaceDescriptor* descriptor = |
| 47 isolate->call_descriptor(CallDescriptorKey::FastCloneShallowArrayCall); |
| 48 Register registers[] = {rsi, rax, rbx, rcx}; |
| 49 Representation representations[] = { |
| 50 Representation::Tagged(), Representation::Tagged(), |
| 51 Representation::Smi(), Representation::Tagged()}; |
| 52 descriptor->Initialize(arraysize(registers), registers, representations); |
| 53 } |
| 54 { |
| 55 CallInterfaceDescriptor* descriptor = |
| 56 isolate->call_descriptor(CallDescriptorKey::FastCloneShallowObjectCall); |
| 57 Register registers[] = {rsi, rax, rbx, rcx, rdx}; |
| 58 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 59 } |
| 60 { |
| 61 CallInterfaceDescriptor* descriptor = |
| 62 isolate->call_descriptor(CallDescriptorKey::CreateAllocationSiteCall); |
| 63 Register registers[] = {rsi, rbx, rdx}; |
| 64 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 65 } |
| 66 { |
| 67 CallInterfaceDescriptor* descriptor = |
| 68 isolate->call_descriptor(CallDescriptorKey::CallFunctionCall); |
| 69 Register registers[] = {rsi, rdi}; |
| 70 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 71 } |
| 72 { |
| 73 CallInterfaceDescriptor* descriptor = |
| 74 isolate->call_descriptor(CallDescriptorKey::CallConstructCall); |
| 75 // rax : number of arguments |
| 76 // rbx : feedback vector |
| 77 // rdx : (only if rbx is not the megamorphic symbol) slot in feedback |
| 78 // vector (Smi) |
| 79 // rdi : constructor function |
| 80 // TODO(turbofan): So far we don't gather type feedback and hence skip the |
| 81 // slot parameter, but ArrayConstructStub needs the vector to be undefined. |
| 82 Register registers[] = {rsi, rax, rdi, rbx}; |
| 83 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 84 } |
| 85 { |
| 86 CallInterfaceDescriptor* descriptor = |
| 87 isolate->call_descriptor(CallDescriptorKey::RegExpConstructResultCall); |
| 88 Register registers[] = {rsi, rcx, rbx, rax}; |
| 89 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 90 } |
| 91 { |
| 92 CallInterfaceDescriptor* descriptor = |
| 93 isolate->call_descriptor(CallDescriptorKey::TransitionElementsKindCall); |
| 94 Register registers[] = {rsi, rax, rbx}; |
| 95 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 96 } |
| 97 { |
| 98 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( |
| 99 CallDescriptorKey::ArrayConstructorConstantArgCountCall); |
| 100 // register state |
| 101 // rax -- number of arguments |
| 102 // rdi -- function |
| 103 // rbx -- allocation site with elements kind |
| 104 Register registers[] = {rsi, rdi, rbx}; |
| 105 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 106 } |
| 107 { |
| 108 CallInterfaceDescriptor* descriptor = |
| 109 isolate->call_descriptor(CallDescriptorKey::ArrayConstructorCall); |
| 110 // stack param count needs (constructor pointer, and single argument) |
| 111 Register registers[] = {rsi, rdi, rbx, rax}; |
| 112 Representation representations[] = { |
| 113 Representation::Tagged(), Representation::Tagged(), |
| 114 Representation::Tagged(), Representation::Integer32()}; |
| 115 descriptor->Initialize(arraysize(registers), registers, representations); |
| 116 } |
| 117 { |
| 118 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( |
| 119 CallDescriptorKey::InternalArrayConstructorConstantArgCountCall); |
| 120 // register state |
| 121 // rsi -- context |
| 122 // rax -- number of arguments |
| 123 // rdi -- constructor function |
| 124 Register registers[] = {rsi, rdi}; |
| 125 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 126 } |
| 127 { |
| 128 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( |
| 129 CallDescriptorKey::InternalArrayConstructorCall); |
| 130 // stack param count needs (constructor pointer, and single argument) |
| 131 Register registers[] = {rsi, rdi, rax}; |
| 132 Representation representations[] = {Representation::Tagged(), |
| 133 Representation::Tagged(), |
| 134 Representation::Integer32()}; |
| 135 descriptor->Initialize(arraysize(registers), registers, representations); |
| 136 } |
| 137 { |
| 138 CallInterfaceDescriptor* descriptor = |
| 139 isolate->call_descriptor(CallDescriptorKey::CompareNilCall); |
| 140 Register registers[] = {rsi, rax}; |
| 141 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 142 } |
| 143 { |
| 144 CallInterfaceDescriptor* descriptor = |
| 145 isolate->call_descriptor(CallDescriptorKey::ToBooleanCall); |
| 146 Register registers[] = {rsi, rax}; |
| 147 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 148 } |
| 149 { |
| 150 CallInterfaceDescriptor* descriptor = |
| 151 isolate->call_descriptor(CallDescriptorKey::BinaryOpCall); |
| 152 Register registers[] = {rsi, rdx, rax}; |
| 153 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 154 } |
| 155 { |
| 156 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( |
| 157 CallDescriptorKey::BinaryOpWithAllocationSiteCall); |
| 158 Register registers[] = {rsi, rcx, rdx, rax}; |
| 159 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 160 } |
| 161 { |
| 162 CallInterfaceDescriptor* descriptor = |
| 163 isolate->call_descriptor(CallDescriptorKey::StringAddCall); |
| 164 Register registers[] = {rsi, rdx, rax}; |
| 165 descriptor->Initialize(arraysize(registers), registers, NULL); |
| 166 } |
| 167 |
18 { | 168 { |
19 CallInterfaceDescriptor* descriptor = | 169 CallInterfaceDescriptor* descriptor = |
20 isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall); | 170 isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall); |
21 Register registers[] = { | 171 Register registers[] = { |
22 rsi, // context | 172 rsi, // context |
23 rdi, // JSFunction | 173 rdi, // JSFunction |
24 rax, // actual number of arguments | 174 rax, // actual number of arguments |
25 rbx, // expected number of arguments | 175 rbx, // expected number of arguments |
26 }; | 176 }; |
27 Representation representations[] = { | 177 Representation representations[] = { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 Representation::Tagged(), // holder | 238 Representation::Tagged(), // holder |
89 Representation::External(), // api_function_address | 239 Representation::External(), // api_function_address |
90 }; | 240 }; |
91 descriptor->Initialize(arraysize(registers), registers, representations); | 241 descriptor->Initialize(arraysize(registers), registers, representations); |
92 } | 242 } |
93 } | 243 } |
94 } | 244 } |
95 } // namespace v8::internal | 245 } // namespace v8::internal |
96 | 246 |
97 #endif // V8_TARGET_ARCH_X64 | 247 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |