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