| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| 11 #include "src/regexp-macro-assembler.h" | 11 #include "src/regexp-macro-assembler.h" |
| 12 #include "src/runtime.h" | 12 #include "src/runtime.h" |
| 13 #include "src/stub-cache.h" | 13 #include "src/stub-cache.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 | 18 |
| 19 void FastNewClosureStub::InitializeInterfaceDescriptor( | 19 void FastNewClosureStub::InitializeInterfaceDescriptor( |
| 20 CodeStubInterfaceDescriptor* descriptor) { | 20 CodeStubInterfaceDescriptor* descriptor) { |
| 21 static Register registers[] = { rbx }; | 21 Register registers[] = { rbx }; |
| 22 descriptor->register_param_count_ = 1; | 22 descriptor->Initialize( |
| 23 descriptor->register_params_ = registers; | 23 ARRAY_SIZE(registers), registers, |
| 24 descriptor->deoptimization_handler_ = | 24 Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry); |
| 25 Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry; | |
| 26 } | 25 } |
| 27 | 26 |
| 28 | 27 |
| 29 void FastNewContextStub::InitializeInterfaceDescriptor( | 28 void FastNewContextStub::InitializeInterfaceDescriptor( |
| 30 CodeStubInterfaceDescriptor* descriptor) { | 29 CodeStubInterfaceDescriptor* descriptor) { |
| 31 static Register registers[] = { rdi }; | 30 Register registers[] = { rdi }; |
| 32 descriptor->register_param_count_ = 1; | 31 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
| 33 descriptor->register_params_ = registers; | |
| 34 descriptor->deoptimization_handler_ = NULL; | |
| 35 } | 32 } |
| 36 | 33 |
| 37 | 34 |
| 38 void ToNumberStub::InitializeInterfaceDescriptor( | 35 void ToNumberStub::InitializeInterfaceDescriptor( |
| 39 CodeStubInterfaceDescriptor* descriptor) { | 36 CodeStubInterfaceDescriptor* descriptor) { |
| 40 static Register registers[] = { rax }; | 37 Register registers[] = { rax }; |
| 41 descriptor->register_param_count_ = 1; | 38 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
| 42 descriptor->register_params_ = registers; | |
| 43 descriptor->deoptimization_handler_ = NULL; | |
| 44 } | 39 } |
| 45 | 40 |
| 46 | 41 |
| 47 void NumberToStringStub::InitializeInterfaceDescriptor( | 42 void NumberToStringStub::InitializeInterfaceDescriptor( |
| 48 CodeStubInterfaceDescriptor* descriptor) { | 43 CodeStubInterfaceDescriptor* descriptor) { |
| 49 static Register registers[] = { rax }; | 44 Register registers[] = { rax }; |
| 50 descriptor->register_param_count_ = 1; | 45 descriptor->Initialize( |
| 51 descriptor->register_params_ = registers; | 46 ARRAY_SIZE(registers), registers, |
| 52 descriptor->deoptimization_handler_ = | 47 Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry); |
| 53 Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry; | |
| 54 } | 48 } |
| 55 | 49 |
| 56 | 50 |
| 57 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | 51 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
| 58 CodeStubInterfaceDescriptor* descriptor) { | 52 CodeStubInterfaceDescriptor* descriptor) { |
| 59 static Register registers[] = { rax, rbx, rcx }; | 53 Register registers[] = { rax, rbx, rcx }; |
| 60 descriptor->register_param_count_ = 3; | 54 Representation representations[] = { |
| 61 descriptor->register_params_ = registers; | |
| 62 static Representation representations[] = { | |
| 63 Representation::Tagged(), | 55 Representation::Tagged(), |
| 64 Representation::Smi(), | 56 Representation::Smi(), |
| 65 Representation::Tagged() }; | 57 Representation::Tagged() }; |
| 66 descriptor->register_param_representations_ = representations; | 58 |
| 67 descriptor->deoptimization_handler_ = | 59 descriptor->Initialize( |
| 60 ARRAY_SIZE(registers), registers, |
| 68 Runtime::FunctionForId( | 61 Runtime::FunctionForId( |
| 69 Runtime::kHiddenCreateArrayLiteralStubBailout)->entry; | 62 Runtime::kHiddenCreateArrayLiteralStubBailout)->entry, |
| 63 representations); |
| 70 } | 64 } |
| 71 | 65 |
| 72 | 66 |
| 73 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( | 67 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
| 74 CodeStubInterfaceDescriptor* descriptor) { | 68 CodeStubInterfaceDescriptor* descriptor) { |
| 75 static Register registers[] = { rax, rbx, rcx, rdx }; | 69 Register registers[] = { rax, rbx, rcx, rdx }; |
| 76 descriptor->register_param_count_ = 4; | 70 descriptor->Initialize( |
| 77 descriptor->register_params_ = registers; | 71 ARRAY_SIZE(registers), registers, |
| 78 descriptor->deoptimization_handler_ = | 72 Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry); |
| 79 Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry; | |
| 80 } | 73 } |
| 81 | 74 |
| 82 | 75 |
| 83 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( | 76 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
| 84 CodeStubInterfaceDescriptor* descriptor) { | 77 CodeStubInterfaceDescriptor* descriptor) { |
| 85 static Register registers[] = { rbx, rdx }; | 78 Register registers[] = { rbx, rdx }; |
| 86 descriptor->register_param_count_ = 2; | 79 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
| 87 descriptor->register_params_ = registers; | |
| 88 descriptor->deoptimization_handler_ = NULL; | |
| 89 } | |
| 90 | |
| 91 | |
| 92 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( | |
| 93 CodeStubInterfaceDescriptor* descriptor) { | |
| 94 static Register registers[] = { rdx, rax }; | |
| 95 descriptor->register_param_count_ = 2; | |
| 96 descriptor->register_params_ = registers; | |
| 97 descriptor->deoptimization_handler_ = | |
| 98 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | |
| 99 } | |
| 100 | |
| 101 | |
| 102 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( | |
| 103 CodeStubInterfaceDescriptor* descriptor) { | |
| 104 static Register registers[] = { rdx, rax }; | |
| 105 descriptor->register_param_count_ = 2; | |
| 106 descriptor->register_params_ = registers; | |
| 107 descriptor->deoptimization_handler_ = | |
| 108 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | |
| 109 } | 80 } |
| 110 | 81 |
| 111 | 82 |
| 112 void RegExpConstructResultStub::InitializeInterfaceDescriptor( | 83 void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
| 113 CodeStubInterfaceDescriptor* descriptor) { | 84 CodeStubInterfaceDescriptor* descriptor) { |
| 114 static Register registers[] = { rcx, rbx, rax }; | 85 Register registers[] = { rcx, rbx, rax }; |
| 115 descriptor->register_param_count_ = 3; | 86 descriptor->Initialize( |
| 116 descriptor->register_params_ = registers; | 87 ARRAY_SIZE(registers), registers, |
| 117 descriptor->deoptimization_handler_ = | 88 Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry); |
| 118 Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry; | |
| 119 } | |
| 120 | |
| 121 | |
| 122 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( | |
| 123 CodeStubInterfaceDescriptor* descriptor) { | |
| 124 static Register registers[] = { rdx, rax }; | |
| 125 descriptor->register_param_count_ = 2; | |
| 126 descriptor->register_params_ = registers; | |
| 127 descriptor->deoptimization_handler_ = | |
| 128 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry; | |
| 129 } | 89 } |
| 130 | 90 |
| 131 | 91 |
| 132 void LoadFieldStub::InitializeInterfaceDescriptor( | 92 void LoadFieldStub::InitializeInterfaceDescriptor( |
| 133 CodeStubInterfaceDescriptor* descriptor) { | 93 CodeStubInterfaceDescriptor* descriptor) { |
| 134 static Register registers[] = { rax }; | 94 Register registers[] = { rax }; |
| 135 descriptor->register_param_count_ = 1; | 95 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
| 136 descriptor->register_params_ = registers; | |
| 137 descriptor->deoptimization_handler_ = NULL; | |
| 138 } | 96 } |
| 139 | 97 |
| 140 | 98 |
| 141 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( | 99 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( |
| 142 CodeStubInterfaceDescriptor* descriptor) { | 100 CodeStubInterfaceDescriptor* descriptor) { |
| 143 static Register registers[] = { rdx }; | 101 Register registers[] = { rdx }; |
| 144 descriptor->register_param_count_ = 1; | 102 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
| 145 descriptor->register_params_ = registers; | |
| 146 descriptor->deoptimization_handler_ = NULL; | |
| 147 } | 103 } |
| 148 | 104 |
| 149 | 105 |
| 150 void StringLengthStub::InitializeInterfaceDescriptor( | 106 void StringLengthStub::InitializeInterfaceDescriptor( |
| 151 CodeStubInterfaceDescriptor* descriptor) { | 107 CodeStubInterfaceDescriptor* descriptor) { |
| 152 static Register registers[] = { rax, rcx }; | 108 Register registers[] = { rax, rcx }; |
| 153 descriptor->register_param_count_ = 2; | 109 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
| 154 descriptor->register_params_ = registers; | |
| 155 descriptor->deoptimization_handler_ = NULL; | |
| 156 } | 110 } |
| 157 | 111 |
| 158 | 112 |
| 159 void KeyedStringLengthStub::InitializeInterfaceDescriptor( | 113 void KeyedStringLengthStub::InitializeInterfaceDescriptor( |
| 160 CodeStubInterfaceDescriptor* descriptor) { | 114 CodeStubInterfaceDescriptor* descriptor) { |
| 161 static Register registers[] = { rdx, rax }; | 115 Register registers[] = { rdx, rax }; |
| 162 descriptor->register_param_count_ = 2; | 116 descriptor->Initialize(ARRAY_SIZE(registers), registers); |
| 163 descriptor->register_params_ = registers; | |
| 164 descriptor->deoptimization_handler_ = NULL; | |
| 165 } | 117 } |
| 166 | 118 |
| 167 | 119 |
| 168 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( | 120 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( |
| 169 CodeStubInterfaceDescriptor* descriptor) { | 121 CodeStubInterfaceDescriptor* descriptor) { |
| 170 static Register registers[] = { rdx, rcx, rax }; | 122 Register registers[] = { rdx, rcx, rax }; |
| 171 descriptor->register_param_count_ = 3; | 123 descriptor->Initialize( |
| 172 descriptor->register_params_ = registers; | 124 ARRAY_SIZE(registers), registers, |
| 173 descriptor->deoptimization_handler_ = | 125 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure)); |
| 174 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); | |
| 175 } | 126 } |
| 176 | 127 |
| 177 | 128 |
| 178 void TransitionElementsKindStub::InitializeInterfaceDescriptor( | 129 void TransitionElementsKindStub::InitializeInterfaceDescriptor( |
| 179 CodeStubInterfaceDescriptor* descriptor) { | 130 CodeStubInterfaceDescriptor* descriptor) { |
| 180 static Register registers[] = { rax, rbx }; | 131 Register registers[] = { rax, rbx }; |
| 181 descriptor->register_param_count_ = 2; | 132 descriptor->Initialize( |
| 182 descriptor->register_params_ = registers; | 133 ARRAY_SIZE(registers), registers, |
| 183 descriptor->deoptimization_handler_ = | 134 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry); |
| 184 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | |
| 185 } | 135 } |
| 186 | 136 |
| 187 | 137 |
| 188 static void InitializeArrayConstructorDescriptor( | 138 static void InitializeArrayConstructorDescriptor( |
| 189 CodeStubInterfaceDescriptor* descriptor, | 139 CodeStubInterfaceDescriptor* descriptor, |
| 190 int constant_stack_parameter_count) { | 140 int constant_stack_parameter_count) { |
| 191 // register state | 141 // register state |
| 192 // rax -- number of arguments | 142 // rax -- number of arguments |
| 193 // rdi -- function | 143 // rdi -- function |
| 194 // rbx -- allocation site with elements kind | 144 // rbx -- allocation site with elements kind |
| 195 static Register registers_variable_args[] = { rdi, rbx, rax }; | 145 Address deopt_handler = Runtime::FunctionForId( |
| 196 static Register registers_no_args[] = { rdi, rbx }; | 146 Runtime::kHiddenArrayConstructor)->entry; |
| 197 | 147 |
| 198 if (constant_stack_parameter_count == 0) { | 148 if (constant_stack_parameter_count == 0) { |
| 199 descriptor->register_param_count_ = 2; | 149 Register registers[] = { rdi, rbx }; |
| 200 descriptor->register_params_ = registers_no_args; | 150 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 151 deopt_handler, |
| 152 NULL, |
| 153 constant_stack_parameter_count, |
| 154 JS_FUNCTION_STUB_MODE); |
| 201 } else { | 155 } else { |
| 202 // stack param count needs (constructor pointer, and single argument) | 156 // stack param count needs (constructor pointer, and single argument) |
| 203 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; | 157 Register registers[] = { rdi, rbx, rax }; |
| 204 descriptor->stack_parameter_count_ = rax; | 158 Representation representations[] = { |
| 205 descriptor->register_param_count_ = 3; | |
| 206 static Representation representations[] = { | |
| 207 Representation::Tagged(), | 159 Representation::Tagged(), |
| 208 Representation::Tagged(), | 160 Representation::Tagged(), |
| 209 Representation::Integer32() }; | 161 Representation::Integer32() }; |
| 210 descriptor->register_param_representations_ = representations; | 162 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 211 descriptor->register_params_ = registers_variable_args; | 163 rax, |
| 164 deopt_handler, |
| 165 representations, |
| 166 constant_stack_parameter_count, |
| 167 JS_FUNCTION_STUB_MODE, |
| 168 PASS_ARGUMENTS); |
| 212 } | 169 } |
| 213 | |
| 214 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | |
| 215 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | |
| 216 descriptor->deoptimization_handler_ = | |
| 217 Runtime::FunctionForId(Runtime::kHiddenArrayConstructor)->entry; | |
| 218 } | 170 } |
| 219 | 171 |
| 220 | 172 |
| 221 static void InitializeInternalArrayConstructorDescriptor( | 173 static void InitializeInternalArrayConstructorDescriptor( |
| 222 CodeStubInterfaceDescriptor* descriptor, | 174 CodeStubInterfaceDescriptor* descriptor, |
| 223 int constant_stack_parameter_count) { | 175 int constant_stack_parameter_count) { |
| 224 // register state | 176 // register state |
| 225 // rax -- number of arguments | 177 // rax -- number of arguments |
| 226 // rdi -- constructor function | 178 // rdi -- constructor function |
| 227 static Register registers_variable_args[] = { rdi, rax }; | 179 Address deopt_handler = Runtime::FunctionForId( |
| 228 static Register registers_no_args[] = { rdi }; | 180 Runtime::kHiddenInternalArrayConstructor)->entry; |
| 229 | 181 |
| 230 if (constant_stack_parameter_count == 0) { | 182 if (constant_stack_parameter_count == 0) { |
| 231 descriptor->register_param_count_ = 1; | 183 Register registers[] = { rdi }; |
| 232 descriptor->register_params_ = registers_no_args; | 184 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 185 deopt_handler, |
| 186 NULL, |
| 187 constant_stack_parameter_count, |
| 188 JS_FUNCTION_STUB_MODE); |
| 233 } else { | 189 } else { |
| 234 // stack param count needs (constructor pointer, and single argument) | 190 // stack param count needs (constructor pointer, and single argument) |
| 235 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; | 191 Register registers[] = { rdi, rax }; |
| 236 descriptor->stack_parameter_count_ = rax; | 192 Representation representations[] = { |
| 237 descriptor->register_param_count_ = 2; | |
| 238 descriptor->register_params_ = registers_variable_args; | |
| 239 static Representation representations[] = { | |
| 240 Representation::Tagged(), | 193 Representation::Tagged(), |
| 241 Representation::Integer32() }; | 194 Representation::Integer32() }; |
| 242 descriptor->register_param_representations_ = representations; | 195 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 196 rax, |
| 197 deopt_handler, |
| 198 representations, |
| 199 constant_stack_parameter_count, |
| 200 JS_FUNCTION_STUB_MODE, |
| 201 PASS_ARGUMENTS); |
| 243 } | 202 } |
| 244 | |
| 245 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | |
| 246 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | |
| 247 descriptor->deoptimization_handler_ = | |
| 248 Runtime::FunctionForId(Runtime::kHiddenInternalArrayConstructor)->entry; | |
| 249 } | 203 } |
| 250 | 204 |
| 251 | 205 |
| 252 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 206 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
| 253 CodeStubInterfaceDescriptor* descriptor) { | 207 CodeStubInterfaceDescriptor* descriptor) { |
| 254 InitializeArrayConstructorDescriptor(descriptor, 0); | 208 InitializeArrayConstructorDescriptor(descriptor, 0); |
| 255 } | 209 } |
| 256 | 210 |
| 257 | 211 |
| 258 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 212 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 280 | 234 |
| 281 | 235 |
| 282 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 236 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
| 283 CodeStubInterfaceDescriptor* descriptor) { | 237 CodeStubInterfaceDescriptor* descriptor) { |
| 284 InitializeInternalArrayConstructorDescriptor(descriptor, -1); | 238 InitializeInternalArrayConstructorDescriptor(descriptor, -1); |
| 285 } | 239 } |
| 286 | 240 |
| 287 | 241 |
| 288 void CompareNilICStub::InitializeInterfaceDescriptor( | 242 void CompareNilICStub::InitializeInterfaceDescriptor( |
| 289 CodeStubInterfaceDescriptor* descriptor) { | 243 CodeStubInterfaceDescriptor* descriptor) { |
| 290 static Register registers[] = { rax }; | 244 Register registers[] = { rax }; |
| 291 descriptor->register_param_count_ = 1; | 245 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 292 descriptor->register_params_ = registers; | 246 FUNCTION_ADDR(CompareNilIC_Miss)); |
| 293 descriptor->deoptimization_handler_ = | |
| 294 FUNCTION_ADDR(CompareNilIC_Miss); | |
| 295 descriptor->SetMissHandler( | 247 descriptor->SetMissHandler( |
| 296 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); | 248 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); |
| 297 } | 249 } |
| 298 | 250 |
| 299 | 251 |
| 300 void ToBooleanStub::InitializeInterfaceDescriptor( | 252 void ToBooleanStub::InitializeInterfaceDescriptor( |
| 301 CodeStubInterfaceDescriptor* descriptor) { | 253 CodeStubInterfaceDescriptor* descriptor) { |
| 302 static Register registers[] = { rax }; | 254 Register registers[] = { rax }; |
| 303 descriptor->register_param_count_ = 1; | 255 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 304 descriptor->register_params_ = registers; | 256 FUNCTION_ADDR(ToBooleanIC_Miss)); |
| 305 descriptor->deoptimization_handler_ = | |
| 306 FUNCTION_ADDR(ToBooleanIC_Miss); | |
| 307 descriptor->SetMissHandler( | 257 descriptor->SetMissHandler( |
| 308 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); | 258 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); |
| 309 } | 259 } |
| 310 | 260 |
| 311 | 261 |
| 312 void StoreGlobalStub::InitializeInterfaceDescriptor( | 262 void StoreGlobalStub::InitializeInterfaceDescriptor( |
| 313 CodeStubInterfaceDescriptor* descriptor) { | 263 CodeStubInterfaceDescriptor* descriptor) { |
| 314 static Register registers[] = { rdx, rcx, rax }; | 264 Register registers[] = { rdx, rcx, rax }; |
| 315 descriptor->register_param_count_ = 3; | 265 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 316 descriptor->register_params_ = registers; | 266 FUNCTION_ADDR(StoreIC_MissFromStubFailure)); |
| 317 descriptor->deoptimization_handler_ = | |
| 318 FUNCTION_ADDR(StoreIC_MissFromStubFailure); | |
| 319 } | 267 } |
| 320 | 268 |
| 321 | 269 |
| 322 void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor( | 270 void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor( |
| 323 CodeStubInterfaceDescriptor* descriptor) { | 271 CodeStubInterfaceDescriptor* descriptor) { |
| 324 static Register registers[] = { rax, rbx, rcx, rdx }; | 272 Register registers[] = { rax, rbx, rcx, rdx }; |
| 325 descriptor->register_param_count_ = 4; | 273 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 326 descriptor->register_params_ = registers; | 274 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss)); |
| 327 descriptor->deoptimization_handler_ = | |
| 328 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); | |
| 329 } | 275 } |
| 330 | 276 |
| 331 | 277 |
| 332 void BinaryOpICStub::InitializeInterfaceDescriptor( | 278 void BinaryOpICStub::InitializeInterfaceDescriptor( |
| 333 CodeStubInterfaceDescriptor* descriptor) { | 279 CodeStubInterfaceDescriptor* descriptor) { |
| 334 static Register registers[] = { rdx, rax }; | 280 Register registers[] = { rdx, rax }; |
| 335 descriptor->register_param_count_ = 2; | 281 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 336 descriptor->register_params_ = registers; | 282 FUNCTION_ADDR(BinaryOpIC_Miss)); |
| 337 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); | |
| 338 descriptor->SetMissHandler( | 283 descriptor->SetMissHandler( |
| 339 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); | 284 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); |
| 340 } | 285 } |
| 341 | 286 |
| 342 | 287 |
| 343 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( | 288 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
| 344 CodeStubInterfaceDescriptor* descriptor) { | 289 CodeStubInterfaceDescriptor* descriptor) { |
| 345 static Register registers[] = { rcx, rdx, rax }; | 290 Register registers[] = { rcx, rdx, rax }; |
| 346 descriptor->register_param_count_ = 3; | 291 descriptor->Initialize(ARRAY_SIZE(registers), registers, |
| 347 descriptor->register_params_ = registers; | 292 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); |
| 348 descriptor->deoptimization_handler_ = | |
| 349 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); | |
| 350 } | 293 } |
| 351 | 294 |
| 352 | 295 |
| 353 void StringAddStub::InitializeInterfaceDescriptor( | 296 void StringAddStub::InitializeInterfaceDescriptor( |
| 354 CodeStubInterfaceDescriptor* descriptor) { | 297 CodeStubInterfaceDescriptor* descriptor) { |
| 355 static Register registers[] = { rdx, rax }; | 298 Register registers[] = { rdx, rax }; |
| 356 descriptor->register_param_count_ = 2; | 299 descriptor->Initialize( |
| 357 descriptor->register_params_ = registers; | 300 ARRAY_SIZE(registers), registers, |
| 358 descriptor->deoptimization_handler_ = | 301 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry); |
| 359 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry; | |
| 360 } | 302 } |
| 361 | 303 |
| 362 | 304 |
| 363 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { | 305 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { |
| 364 { | 306 { |
| 365 CallInterfaceDescriptor* descriptor = | 307 CallInterfaceDescriptor* descriptor = |
| 366 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); | 308 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); |
| 367 static Register registers[] = { rdi, // JSFunction | 309 static Register registers[] = { rdi, // JSFunction |
| 368 rsi, // context | 310 rsi, // context |
| 369 rax, // actual number of arguments | 311 rax, // actual number of arguments |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 387 |
| 446 | 388 |
| 447 #define __ ACCESS_MASM(masm) | 389 #define __ ACCESS_MASM(masm) |
| 448 | 390 |
| 449 | 391 |
| 450 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { | 392 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { |
| 451 // Update the static counter each time a new code stub is generated. | 393 // Update the static counter each time a new code stub is generated. |
| 452 isolate()->counters()->code_stubs()->Increment(); | 394 isolate()->counters()->code_stubs()->Increment(); |
| 453 | 395 |
| 454 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(); | 396 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(); |
| 455 int param_count = descriptor->register_param_count_; | 397 int param_count = descriptor->register_param_count(); |
| 456 { | 398 { |
| 457 // Call the runtime system in a fresh internal frame. | 399 // Call the runtime system in a fresh internal frame. |
| 458 FrameScope scope(masm, StackFrame::INTERNAL); | 400 FrameScope scope(masm, StackFrame::INTERNAL); |
| 459 ASSERT(descriptor->register_param_count_ == 0 || | 401 ASSERT(descriptor->register_param_count() == 0 || |
| 460 rax.is(descriptor->register_params_[param_count - 1])); | 402 rax.is(descriptor->GetParameterRegister(param_count - 1))); |
| 461 // Push arguments | 403 // Push arguments |
| 462 for (int i = 0; i < param_count; ++i) { | 404 for (int i = 0; i < param_count; ++i) { |
| 463 __ Push(descriptor->register_params_[i]); | 405 __ Push(descriptor->GetParameterRegister(i)); |
| 464 } | 406 } |
| 465 ExternalReference miss = descriptor->miss_handler(); | 407 ExternalReference miss = descriptor->miss_handler(); |
| 466 __ CallExternalReference(miss, descriptor->register_param_count_); | 408 __ CallExternalReference(miss, descriptor->register_param_count()); |
| 467 } | 409 } |
| 468 | 410 |
| 469 __ Ret(); | 411 __ Ret(); |
| 470 } | 412 } |
| 471 | 413 |
| 472 | 414 |
| 473 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { | 415 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { |
| 474 __ PushCallerSaved(save_doubles_); | 416 __ PushCallerSaved(save_doubles_); |
| 475 const int argument_count = 1; | 417 const int argument_count = 1; |
| 476 __ PrepareCallCFunction(argument_count); | 418 __ PrepareCallCFunction(argument_count); |
| (...skipping 4569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5046 return_value_operand, | 4988 return_value_operand, |
| 5047 NULL); | 4989 NULL); |
| 5048 } | 4990 } |
| 5049 | 4991 |
| 5050 | 4992 |
| 5051 #undef __ | 4993 #undef __ |
| 5052 | 4994 |
| 5053 } } // namespace v8::internal | 4995 } } // namespace v8::internal |
| 5054 | 4996 |
| 5055 #endif // V8_TARGET_ARCH_X64 | 4997 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |