Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 255543003: CodeStubs contain their corresponding Isolate* now. (part 2) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 26 matching lines...) Expand all
37 #include "runtime.h" 37 #include "runtime.h"
38 #include "stub-cache.h" 38 #include "stub-cache.h"
39 #include "codegen.h" 39 #include "codegen.h"
40 #include "runtime.h" 40 #include "runtime.h"
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 45
46 void FastNewClosureStub::InitializeInterfaceDescriptor( 46 void FastNewClosureStub::InitializeInterfaceDescriptor(
47 Isolate* isolate,
48 CodeStubInterfaceDescriptor* descriptor) { 47 CodeStubInterfaceDescriptor* descriptor) {
49 static Register registers[] = { ebx }; 48 static Register registers[] = { ebx };
50 descriptor->register_param_count_ = 1; 49 descriptor->register_param_count_ = 1;
51 descriptor->register_params_ = registers; 50 descriptor->register_params_ = registers;
52 descriptor->deoptimization_handler_ = 51 descriptor->deoptimization_handler_ =
53 Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry; 52 Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry;
54 } 53 }
55 54
56 55
57 void FastNewContextStub::InitializeInterfaceDescriptor( 56 void FastNewContextStub::InitializeInterfaceDescriptor(
58 Isolate* isolate,
59 CodeStubInterfaceDescriptor* descriptor) { 57 CodeStubInterfaceDescriptor* descriptor) {
60 static Register registers[] = { edi }; 58 static Register registers[] = { edi };
61 descriptor->register_param_count_ = 1; 59 descriptor->register_param_count_ = 1;
62 descriptor->register_params_ = registers; 60 descriptor->register_params_ = registers;
63 descriptor->deoptimization_handler_ = NULL; 61 descriptor->deoptimization_handler_ = NULL;
64 } 62 }
65 63
66 64
67 void ToNumberStub::InitializeInterfaceDescriptor( 65 void ToNumberStub::InitializeInterfaceDescriptor(
68 Isolate* isolate,
69 CodeStubInterfaceDescriptor* descriptor) { 66 CodeStubInterfaceDescriptor* descriptor) {
70 static Register registers[] = { eax }; 67 static Register registers[] = { eax };
71 descriptor->register_param_count_ = 1; 68 descriptor->register_param_count_ = 1;
72 descriptor->register_params_ = registers; 69 descriptor->register_params_ = registers;
73 descriptor->deoptimization_handler_ = NULL; 70 descriptor->deoptimization_handler_ = NULL;
74 } 71 }
75 72
76 73
77 void NumberToStringStub::InitializeInterfaceDescriptor( 74 void NumberToStringStub::InitializeInterfaceDescriptor(
78 Isolate* isolate,
79 CodeStubInterfaceDescriptor* descriptor) { 75 CodeStubInterfaceDescriptor* descriptor) {
80 static Register registers[] = { eax }; 76 static Register registers[] = { eax };
81 descriptor->register_param_count_ = 1; 77 descriptor->register_param_count_ = 1;
82 descriptor->register_params_ = registers; 78 descriptor->register_params_ = registers;
83 descriptor->deoptimization_handler_ = 79 descriptor->deoptimization_handler_ =
84 Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry; 80 Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry;
85 } 81 }
86 82
87 83
88 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( 84 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
89 Isolate* isolate,
90 CodeStubInterfaceDescriptor* descriptor) { 85 CodeStubInterfaceDescriptor* descriptor) {
91 static Register registers[] = { eax, ebx, ecx }; 86 static Register registers[] = { eax, ebx, ecx };
92 descriptor->register_param_count_ = 3; 87 descriptor->register_param_count_ = 3;
93 descriptor->register_params_ = registers; 88 descriptor->register_params_ = registers;
94 descriptor->deoptimization_handler_ = 89 descriptor->deoptimization_handler_ =
95 Runtime::FunctionForId( 90 Runtime::FunctionForId(
96 Runtime::kHiddenCreateArrayLiteralStubBailout)->entry; 91 Runtime::kHiddenCreateArrayLiteralStubBailout)->entry;
97 } 92 }
98 93
99 94
100 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( 95 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
101 Isolate* isolate,
102 CodeStubInterfaceDescriptor* descriptor) { 96 CodeStubInterfaceDescriptor* descriptor) {
103 static Register registers[] = { eax, ebx, ecx, edx }; 97 static Register registers[] = { eax, ebx, ecx, edx };
104 descriptor->register_param_count_ = 4; 98 descriptor->register_param_count_ = 4;
105 descriptor->register_params_ = registers; 99 descriptor->register_params_ = registers;
106 descriptor->deoptimization_handler_ = 100 descriptor->deoptimization_handler_ =
107 Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry; 101 Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry;
108 } 102 }
109 103
110 104
111 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( 105 void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
112 Isolate* isolate,
113 CodeStubInterfaceDescriptor* descriptor) { 106 CodeStubInterfaceDescriptor* descriptor) {
114 static Register registers[] = { ebx, edx }; 107 static Register registers[] = { ebx, edx };
115 descriptor->register_param_count_ = 2; 108 descriptor->register_param_count_ = 2;
116 descriptor->register_params_ = registers; 109 descriptor->register_params_ = registers;
117 descriptor->deoptimization_handler_ = NULL; 110 descriptor->deoptimization_handler_ = NULL;
118 } 111 }
119 112
120 113
121 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( 114 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
122 Isolate* isolate,
123 CodeStubInterfaceDescriptor* descriptor) { 115 CodeStubInterfaceDescriptor* descriptor) {
124 static Register registers[] = { edx, ecx }; 116 static Register registers[] = { edx, ecx };
125 descriptor->register_param_count_ = 2; 117 descriptor->register_param_count_ = 2;
126 descriptor->register_params_ = registers; 118 descriptor->register_params_ = registers;
127 descriptor->deoptimization_handler_ = 119 descriptor->deoptimization_handler_ =
128 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 120 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
129 } 121 }
130 122
131 123
132 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( 124 void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor(
133 Isolate* isolate,
134 CodeStubInterfaceDescriptor* descriptor) { 125 CodeStubInterfaceDescriptor* descriptor) {
135 static Register registers[] = { edx, ecx }; 126 static Register registers[] = { edx, ecx };
136 descriptor->register_param_count_ = 2; 127 descriptor->register_param_count_ = 2;
137 descriptor->register_params_ = registers; 128 descriptor->register_params_ = registers;
138 descriptor->deoptimization_handler_ = 129 descriptor->deoptimization_handler_ =
139 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 130 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
140 } 131 }
141 132
142 133
143 void RegExpConstructResultStub::InitializeInterfaceDescriptor( 134 void RegExpConstructResultStub::InitializeInterfaceDescriptor(
144 Isolate* isolate,
145 CodeStubInterfaceDescriptor* descriptor) { 135 CodeStubInterfaceDescriptor* descriptor) {
146 static Register registers[] = { ecx, ebx, eax }; 136 static Register registers[] = { ecx, ebx, eax };
147 descriptor->register_param_count_ = 3; 137 descriptor->register_param_count_ = 3;
148 descriptor->register_params_ = registers; 138 descriptor->register_params_ = registers;
149 descriptor->deoptimization_handler_ = 139 descriptor->deoptimization_handler_ =
150 Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry; 140 Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry;
151 } 141 }
152 142
153 143
154 void LoadFieldStub::InitializeInterfaceDescriptor( 144 void LoadFieldStub::InitializeInterfaceDescriptor(
155 Isolate* isolate,
156 CodeStubInterfaceDescriptor* descriptor) { 145 CodeStubInterfaceDescriptor* descriptor) {
157 static Register registers[] = { edx }; 146 static Register registers[] = { edx };
158 descriptor->register_param_count_ = 1; 147 descriptor->register_param_count_ = 1;
159 descriptor->register_params_ = registers; 148 descriptor->register_params_ = registers;
160 descriptor->deoptimization_handler_ = NULL; 149 descriptor->deoptimization_handler_ = NULL;
161 } 150 }
162 151
163 152
164 void KeyedLoadFieldStub::InitializeInterfaceDescriptor( 153 void KeyedLoadFieldStub::InitializeInterfaceDescriptor(
165 Isolate* isolate,
166 CodeStubInterfaceDescriptor* descriptor) { 154 CodeStubInterfaceDescriptor* descriptor) {
167 static Register registers[] = { edx }; 155 static Register registers[] = { edx };
168 descriptor->register_param_count_ = 1; 156 descriptor->register_param_count_ = 1;
169 descriptor->register_params_ = registers; 157 descriptor->register_params_ = registers;
170 descriptor->deoptimization_handler_ = NULL; 158 descriptor->deoptimization_handler_ = NULL;
171 } 159 }
172 160
173 161
174 void StringLengthStub::InitializeInterfaceDescriptor( 162 void StringLengthStub::InitializeInterfaceDescriptor(
175 Isolate* isolate,
176 CodeStubInterfaceDescriptor* descriptor) { 163 CodeStubInterfaceDescriptor* descriptor) {
177 static Register registers[] = { edx, ecx }; 164 static Register registers[] = { edx, ecx };
178 descriptor->register_param_count_ = 2; 165 descriptor->register_param_count_ = 2;
179 descriptor->register_params_ = registers; 166 descriptor->register_params_ = registers;
180 descriptor->deoptimization_handler_ = NULL; 167 descriptor->deoptimization_handler_ = NULL;
181 } 168 }
182 169
183 170
184 void KeyedStringLengthStub::InitializeInterfaceDescriptor( 171 void KeyedStringLengthStub::InitializeInterfaceDescriptor(
185 Isolate* isolate,
186 CodeStubInterfaceDescriptor* descriptor) { 172 CodeStubInterfaceDescriptor* descriptor) {
187 static Register registers[] = { edx, ecx }; 173 static Register registers[] = { edx, ecx };
188 descriptor->register_param_count_ = 2; 174 descriptor->register_param_count_ = 2;
189 descriptor->register_params_ = registers; 175 descriptor->register_params_ = registers;
190 descriptor->deoptimization_handler_ = NULL; 176 descriptor->deoptimization_handler_ = NULL;
191 } 177 }
192 178
193 179
194 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( 180 void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
195 Isolate* isolate,
196 CodeStubInterfaceDescriptor* descriptor) { 181 CodeStubInterfaceDescriptor* descriptor) {
197 static Register registers[] = { edx, ecx, eax }; 182 static Register registers[] = { edx, ecx, eax };
198 descriptor->register_param_count_ = 3; 183 descriptor->register_param_count_ = 3;
199 descriptor->register_params_ = registers; 184 descriptor->register_params_ = registers;
200 descriptor->deoptimization_handler_ = 185 descriptor->deoptimization_handler_ =
201 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); 186 FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure);
202 } 187 }
203 188
204 189
205 void TransitionElementsKindStub::InitializeInterfaceDescriptor( 190 void TransitionElementsKindStub::InitializeInterfaceDescriptor(
206 Isolate* isolate,
207 CodeStubInterfaceDescriptor* descriptor) { 191 CodeStubInterfaceDescriptor* descriptor) {
208 static Register registers[] = { eax, ebx }; 192 static Register registers[] = { eax, ebx };
209 descriptor->register_param_count_ = 2; 193 descriptor->register_param_count_ = 2;
210 descriptor->register_params_ = registers; 194 descriptor->register_params_ = registers;
211 descriptor->deoptimization_handler_ = 195 descriptor->deoptimization_handler_ =
212 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; 196 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
213 } 197 }
214 198
215 199
216 static void InitializeArrayConstructorDescriptor( 200 static void InitializeArrayConstructorDescriptor(
(...skipping 19 matching lines...) Expand all
236 } 220 }
237 221
238 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 222 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
239 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 223 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
240 descriptor->deoptimization_handler_ = 224 descriptor->deoptimization_handler_ =
241 Runtime::FunctionForId(Runtime::kHiddenArrayConstructor)->entry; 225 Runtime::FunctionForId(Runtime::kHiddenArrayConstructor)->entry;
242 } 226 }
243 227
244 228
245 static void InitializeInternalArrayConstructorDescriptor( 229 static void InitializeInternalArrayConstructorDescriptor(
246 Isolate* isolate,
247 CodeStubInterfaceDescriptor* descriptor, 230 CodeStubInterfaceDescriptor* descriptor,
248 int constant_stack_parameter_count) { 231 int constant_stack_parameter_count) {
249 // register state 232 // register state
250 // eax -- number of arguments 233 // eax -- number of arguments
251 // edi -- constructor function 234 // edi -- constructor function
252 static Register registers_variable_args[] = { edi, eax }; 235 static Register registers_variable_args[] = { edi, eax };
253 static Register registers_no_args[] = { edi }; 236 static Register registers_no_args[] = { edi };
254 237
255 if (constant_stack_parameter_count == 0) { 238 if (constant_stack_parameter_count == 0) {
256 descriptor->register_param_count_ = 1; 239 descriptor->register_param_count_ = 1;
257 descriptor->register_params_ = registers_no_args; 240 descriptor->register_params_ = registers_no_args;
258 } else { 241 } else {
259 // stack param count needs (constructor pointer, and single argument) 242 // stack param count needs (constructor pointer, and single argument)
260 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; 243 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
261 descriptor->stack_parameter_count_ = eax; 244 descriptor->stack_parameter_count_ = eax;
262 descriptor->register_param_count_ = 2; 245 descriptor->register_param_count_ = 2;
263 descriptor->register_params_ = registers_variable_args; 246 descriptor->register_params_ = registers_variable_args;
264 } 247 }
265 248
266 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 249 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
267 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 250 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
268 descriptor->deoptimization_handler_ = 251 descriptor->deoptimization_handler_ =
269 Runtime::FunctionForId(Runtime::kHiddenInternalArrayConstructor)->entry; 252 Runtime::FunctionForId(Runtime::kHiddenInternalArrayConstructor)->entry;
270 } 253 }
271 254
272 255
273 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 256 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
274 Isolate* isolate,
275 CodeStubInterfaceDescriptor* descriptor) { 257 CodeStubInterfaceDescriptor* descriptor) {
276 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); 258 InitializeArrayConstructorDescriptor(isolate(), descriptor, 0);
277 } 259 }
278 260
279 261
280 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( 262 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor(
281 Isolate* isolate,
282 CodeStubInterfaceDescriptor* descriptor) { 263 CodeStubInterfaceDescriptor* descriptor) {
283 InitializeArrayConstructorDescriptor(isolate, descriptor, 1); 264 InitializeArrayConstructorDescriptor(isolate(), descriptor, 1);
284 } 265 }
285 266
286 267
287 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( 268 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor(
288 Isolate* isolate,
289 CodeStubInterfaceDescriptor* descriptor) { 269 CodeStubInterfaceDescriptor* descriptor) {
290 InitializeArrayConstructorDescriptor(isolate, descriptor, -1); 270 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
291 } 271 }
292 272
293 273
294 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 274 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
295 Isolate* isolate,
296 CodeStubInterfaceDescriptor* descriptor) { 275 CodeStubInterfaceDescriptor* descriptor) {
297 InitializeInternalArrayConstructorDescriptor(isolate, descriptor, 0); 276 InitializeInternalArrayConstructorDescriptor(descriptor, 0);
298 } 277 }
299 278
300 279
301 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( 280 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor(
302 Isolate* isolate,
303 CodeStubInterfaceDescriptor* descriptor) { 281 CodeStubInterfaceDescriptor* descriptor) {
304 InitializeInternalArrayConstructorDescriptor(isolate, descriptor, 1); 282 InitializeInternalArrayConstructorDescriptor(descriptor, 1);
305 } 283 }
306 284
307 285
308 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( 286 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor(
309 Isolate* isolate,
310 CodeStubInterfaceDescriptor* descriptor) { 287 CodeStubInterfaceDescriptor* descriptor) {
311 InitializeInternalArrayConstructorDescriptor(isolate, descriptor, -1); 288 InitializeInternalArrayConstructorDescriptor(descriptor, -1);
312 } 289 }
313 290
314 291
315 void CompareNilICStub::InitializeInterfaceDescriptor( 292 void CompareNilICStub::InitializeInterfaceDescriptor(
316 Isolate* isolate,
317 CodeStubInterfaceDescriptor* descriptor) { 293 CodeStubInterfaceDescriptor* descriptor) {
318 static Register registers[] = { eax }; 294 static Register registers[] = { eax };
319 descriptor->register_param_count_ = 1; 295 descriptor->register_param_count_ = 1;
320 descriptor->register_params_ = registers; 296 descriptor->register_params_ = registers;
321 descriptor->deoptimization_handler_ = 297 descriptor->deoptimization_handler_ =
322 FUNCTION_ADDR(CompareNilIC_Miss); 298 FUNCTION_ADDR(CompareNilIC_Miss);
323 descriptor->SetMissHandler( 299 descriptor->SetMissHandler(
324 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate)); 300 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
325 } 301 }
326 302
327 void ToBooleanStub::InitializeInterfaceDescriptor( 303 void ToBooleanStub::InitializeInterfaceDescriptor(
328 Isolate* isolate,
329 CodeStubInterfaceDescriptor* descriptor) { 304 CodeStubInterfaceDescriptor* descriptor) {
330 static Register registers[] = { eax }; 305 static Register registers[] = { eax };
331 descriptor->register_param_count_ = 1; 306 descriptor->register_param_count_ = 1;
332 descriptor->register_params_ = registers; 307 descriptor->register_params_ = registers;
333 descriptor->deoptimization_handler_ = 308 descriptor->deoptimization_handler_ =
334 FUNCTION_ADDR(ToBooleanIC_Miss); 309 FUNCTION_ADDR(ToBooleanIC_Miss);
335 descriptor->SetMissHandler( 310 descriptor->SetMissHandler(
336 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate)); 311 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
337 } 312 }
338 313
339 314
340 void StoreGlobalStub::InitializeInterfaceDescriptor( 315 void StoreGlobalStub::InitializeInterfaceDescriptor(
341 Isolate* isolate,
342 CodeStubInterfaceDescriptor* descriptor) { 316 CodeStubInterfaceDescriptor* descriptor) {
343 static Register registers[] = { edx, ecx, eax }; 317 static Register registers[] = { edx, ecx, eax };
344 descriptor->register_param_count_ = 3; 318 descriptor->register_param_count_ = 3;
345 descriptor->register_params_ = registers; 319 descriptor->register_params_ = registers;
346 descriptor->deoptimization_handler_ = 320 descriptor->deoptimization_handler_ =
347 FUNCTION_ADDR(StoreIC_MissFromStubFailure); 321 FUNCTION_ADDR(StoreIC_MissFromStubFailure);
348 } 322 }
349 323
350 324
351 void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor( 325 void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
352 Isolate* isolate,
353 CodeStubInterfaceDescriptor* descriptor) { 326 CodeStubInterfaceDescriptor* descriptor) {
354 static Register registers[] = { eax, ebx, ecx, edx }; 327 static Register registers[] = { eax, ebx, ecx, edx };
355 descriptor->register_param_count_ = 4; 328 descriptor->register_param_count_ = 4;
356 descriptor->register_params_ = registers; 329 descriptor->register_params_ = registers;
357 descriptor->deoptimization_handler_ = 330 descriptor->deoptimization_handler_ =
358 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); 331 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss);
359 } 332 }
360 333
361 334
362 void BinaryOpICStub::InitializeInterfaceDescriptor( 335 void BinaryOpICStub::InitializeInterfaceDescriptor(
363 Isolate* isolate,
364 CodeStubInterfaceDescriptor* descriptor) { 336 CodeStubInterfaceDescriptor* descriptor) {
365 static Register registers[] = { edx, eax }; 337 static Register registers[] = { edx, eax };
366 descriptor->register_param_count_ = 2; 338 descriptor->register_param_count_ = 2;
367 descriptor->register_params_ = registers; 339 descriptor->register_params_ = registers;
368 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); 340 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss);
369 descriptor->SetMissHandler( 341 descriptor->SetMissHandler(
370 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); 342 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
371 } 343 }
372 344
373 345
374 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( 346 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
375 Isolate* isolate,
376 CodeStubInterfaceDescriptor* descriptor) { 347 CodeStubInterfaceDescriptor* descriptor) {
377 static Register registers[] = { ecx, edx, eax }; 348 static Register registers[] = { ecx, edx, eax };
378 descriptor->register_param_count_ = 3; 349 descriptor->register_param_count_ = 3;
379 descriptor->register_params_ = registers; 350 descriptor->register_params_ = registers;
380 descriptor->deoptimization_handler_ = 351 descriptor->deoptimization_handler_ =
381 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); 352 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite);
382 } 353 }
383 354
384 355
385 void StringAddStub::InitializeInterfaceDescriptor( 356 void StringAddStub::InitializeInterfaceDescriptor(
386 Isolate* isolate,
387 CodeStubInterfaceDescriptor* descriptor) { 357 CodeStubInterfaceDescriptor* descriptor) {
388 static Register registers[] = { edx, eax }; 358 static Register registers[] = { edx, eax };
389 descriptor->register_param_count_ = 2; 359 descriptor->register_param_count_ = 2;
390 descriptor->register_params_ = registers; 360 descriptor->register_params_ = registers;
391 descriptor->deoptimization_handler_ = 361 descriptor->deoptimization_handler_ =
392 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry; 362 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry;
393 } 363 }
394 364
395 365
396 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { 366 void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 447 }
478 448
479 449
480 #define __ ACCESS_MASM(masm) 450 #define __ ACCESS_MASM(masm)
481 451
482 452
483 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { 453 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) {
484 // Update the static counter each time a new code stub is generated. 454 // Update the static counter each time a new code stub is generated.
485 isolate()->counters()->code_stubs()->Increment(); 455 isolate()->counters()->code_stubs()->Increment();
486 456
487 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate()); 457 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor();
488 int param_count = descriptor->register_param_count_; 458 int param_count = descriptor->register_param_count_;
489 { 459 {
490 // Call the runtime system in a fresh internal frame. 460 // Call the runtime system in a fresh internal frame.
491 FrameScope scope(masm, StackFrame::INTERNAL); 461 FrameScope scope(masm, StackFrame::INTERNAL);
492 ASSERT(descriptor->register_param_count_ == 0 || 462 ASSERT(descriptor->register_param_count_ == 0 ||
493 eax.is(descriptor->register_params_[param_count - 1])); 463 eax.is(descriptor->register_params_[param_count - 1]));
494 // Push arguments 464 // Push arguments
495 for (int i = 0; i < param_count; ++i) { 465 for (int i = 0; i < param_count; ++i) {
496 __ push(descriptor->register_params_[i]); 466 __ push(descriptor->register_params_[i]);
497 } 467 }
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 } 2526 }
2557 } 2527 }
2558 2528
2559 2529
2560 void CodeStub::GenerateFPStubs(Isolate* isolate) { 2530 void CodeStub::GenerateFPStubs(Isolate* isolate) {
2561 if (CpuFeatures::IsSupported(SSE2)) { 2531 if (CpuFeatures::IsSupported(SSE2)) {
2562 CEntryStub save_doubles(isolate, 1, kSaveFPRegs); 2532 CEntryStub save_doubles(isolate, 1, kSaveFPRegs);
2563 // Stubs might already be in the snapshot, detect that and don't regenerate, 2533 // Stubs might already be in the snapshot, detect that and don't regenerate,
2564 // which would lead to code stub initialization state being messed up. 2534 // which would lead to code stub initialization state being messed up.
2565 Code* save_doubles_code; 2535 Code* save_doubles_code;
2566 if (!save_doubles.FindCodeInCache(&save_doubles_code, isolate)) { 2536 if (!save_doubles.FindCodeInCache(&save_doubles_code)) {
2567 save_doubles_code = *(save_doubles.GetCode(isolate)); 2537 save_doubles_code = *(save_doubles.GetCode());
2568 } 2538 }
2569 isolate->set_fp_stubs_generated(true); 2539 isolate->set_fp_stubs_generated(true);
2570 } 2540 }
2571 } 2541 }
2572 2542
2573 2543
2574 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { 2544 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) {
2575 CEntryStub stub(isolate, 1, kDontSaveFPRegs); 2545 CEntryStub stub(isolate, 1, kDontSaveFPRegs);
2576 stub.GetCode(isolate); 2546 stub.GetCode();
2577 } 2547 }
2578 2548
2579 2549
2580 void CEntryStub::Generate(MacroAssembler* masm) { 2550 void CEntryStub::Generate(MacroAssembler* masm) {
2581 // eax: number of arguments including receiver 2551 // eax: number of arguments including receiver
2582 // ebx: pointer to C function (C callee-saved) 2552 // ebx: pointer to C function (C callee-saved)
2583 // ebp: frame pointer (restored after C call) 2553 // ebp: frame pointer (restored after C call)
2584 // esp: stack pointer (restored after C call) 2554 // esp: stack pointer (restored after C call)
2585 // esi: current context (C callee-saved) 2555 // esi: current context (C callee-saved)
2586 // edi: JS function of the caller (C callee-saved) 2556 // edi: JS function of the caller (C callee-saved)
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
3771 __ j(not_equal, &maybe_undefined1, Label::kNear); 3741 __ j(not_equal, &maybe_undefined1, Label::kNear);
3772 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), 3742 __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
3773 isolate()->factory()->heap_number_map()); 3743 isolate()->factory()->heap_number_map());
3774 __ j(not_equal, &maybe_undefined2, Label::kNear); 3744 __ j(not_equal, &maybe_undefined2, Label::kNear);
3775 } 3745 }
3776 3746
3777 __ bind(&unordered); 3747 __ bind(&unordered);
3778 __ bind(&generic_stub); 3748 __ bind(&generic_stub);
3779 ICCompareStub stub(isolate(), op_, CompareIC::GENERIC, CompareIC::GENERIC, 3749 ICCompareStub stub(isolate(), op_, CompareIC::GENERIC, CompareIC::GENERIC,
3780 CompareIC::GENERIC); 3750 CompareIC::GENERIC);
3781 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); 3751 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
3782 3752
3783 __ bind(&maybe_undefined1); 3753 __ bind(&maybe_undefined1);
3784 if (Token::IsOrderedRelationalCompareOp(op_)) { 3754 if (Token::IsOrderedRelationalCompareOp(op_)) {
3785 __ cmp(eax, Immediate(isolate()->factory()->undefined_value())); 3755 __ cmp(eax, Immediate(isolate()->factory()->undefined_value()));
3786 __ j(not_equal, &miss); 3756 __ j(not_equal, &miss);
3787 __ JumpIfSmi(edx, &unordered); 3757 __ JumpIfSmi(edx, &unordered);
3788 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, ecx); 3758 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, ecx);
3789 __ j(not_equal, &maybe_undefined2, Label::kNear); 3759 __ j(not_equal, &maybe_undefined2, Label::kNear);
3790 __ jmp(&unordered); 3760 __ jmp(&unordered);
3791 } 3761 }
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
4256 __ bind(&not_in_dictionary); 4226 __ bind(&not_in_dictionary);
4257 __ mov(result_, Immediate(0)); 4227 __ mov(result_, Immediate(0));
4258 __ Drop(1); 4228 __ Drop(1);
4259 __ ret(2 * kPointerSize); 4229 __ ret(2 * kPointerSize);
4260 } 4230 }
4261 4231
4262 4232
4263 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime( 4233 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(
4264 Isolate* isolate) { 4234 Isolate* isolate) {
4265 StoreBufferOverflowStub stub(isolate, kDontSaveFPRegs); 4235 StoreBufferOverflowStub stub(isolate, kDontSaveFPRegs);
4266 stub.GetCode(isolate); 4236 stub.GetCode();
4267 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 4237 if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
4268 StoreBufferOverflowStub stub2(isolate, kSaveFPRegs); 4238 StoreBufferOverflowStub stub2(isolate, kSaveFPRegs);
4269 stub2.GetCode(isolate); 4239 stub2.GetCode();
4270 } 4240 }
4271 } 4241 }
4272 4242
4273 4243
4274 bool CodeStub::CanUseFPRegisters() { 4244 bool CodeStub::CanUseFPRegisters() {
4275 return CpuFeatures::IsSupported(SSE2); 4245 return CpuFeatures::IsSupported(SSE2);
4276 } 4246 }
4277 4247
4278 4248
4279 // Takes the input in 3 registers: address_ value_ and object_. A pointer to 4249 // Takes the input in 3 registers: address_ value_ and object_. A pointer to
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4550 xmm0, 4520 xmm0,
4551 &slow_elements_from_double, 4521 &slow_elements_from_double,
4552 false); 4522 false);
4553 __ pop(edx); 4523 __ pop(edx);
4554 __ ret(0); 4524 __ ret(0);
4555 } 4525 }
4556 4526
4557 4527
4558 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { 4528 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
4559 CEntryStub ces(isolate(), 1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs); 4529 CEntryStub ces(isolate(), 1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs);
4560 __ call(ces.GetCode(isolate()), RelocInfo::CODE_TARGET); 4530 __ call(ces.GetCode(), RelocInfo::CODE_TARGET);
4561 int parameter_count_offset = 4531 int parameter_count_offset =
4562 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; 4532 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
4563 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); 4533 __ mov(ebx, MemOperand(ebp, parameter_count_offset));
4564 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); 4534 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
4565 __ pop(ecx); 4535 __ pop(ecx);
4566 int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE 4536 int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE
4567 ? kPointerSize 4537 ? kPointerSize
4568 : 0; 4538 : 0;
4569 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); 4539 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset));
4570 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. 4540 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
4721 } 4691 }
4722 4692
4723 4693
4724 template<class T> 4694 template<class T>
4725 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { 4695 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
4726 int to_index = GetSequenceIndexFromFastElementsKind( 4696 int to_index = GetSequenceIndexFromFastElementsKind(
4727 TERMINAL_FAST_ELEMENTS_KIND); 4697 TERMINAL_FAST_ELEMENTS_KIND);
4728 for (int i = 0; i <= to_index; ++i) { 4698 for (int i = 0; i <= to_index; ++i) {
4729 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 4699 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
4730 T stub(isolate, kind); 4700 T stub(isolate, kind);
4731 stub.GetCode(isolate); 4701 stub.GetCode();
4732 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { 4702 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
4733 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES); 4703 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES);
4734 stub1.GetCode(isolate); 4704 stub1.GetCode();
4735 } 4705 }
4736 } 4706 }
4737 } 4707 }
4738 4708
4739 4709
4740 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { 4710 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
4741 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 4711 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
4742 isolate); 4712 isolate);
4743 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 4713 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
4744 isolate); 4714 isolate);
4745 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( 4715 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>(
4746 isolate); 4716 isolate);
4747 } 4717 }
4748 4718
4749 4719
4750 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime( 4720 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
4751 Isolate* isolate) { 4721 Isolate* isolate) {
4752 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; 4722 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
4753 for (int i = 0; i < 2; i++) { 4723 for (int i = 0; i < 2; i++) {
4754 // For internal arrays we only need a few things 4724 // For internal arrays we only need a few things
4755 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); 4725 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
4756 stubh1.GetCode(isolate); 4726 stubh1.GetCode();
4757 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); 4727 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
4758 stubh2.GetCode(isolate); 4728 stubh2.GetCode();
4759 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]); 4729 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]);
4760 stubh3.GetCode(isolate); 4730 stubh3.GetCode();
4761 } 4731 }
4762 } 4732 }
4763 4733
4764 4734
4765 void ArrayConstructorStub::GenerateDispatchToArrayStub( 4735 void ArrayConstructorStub::GenerateDispatchToArrayStub(
4766 MacroAssembler* masm, 4736 MacroAssembler* masm,
4767 AllocationSiteOverrideMode mode) { 4737 AllocationSiteOverrideMode mode) {
4768 if (argument_count_ == ANY) { 4738 if (argument_count_ == ANY) {
4769 Label not_zero_case, not_one_case; 4739 Label not_zero_case, not_one_case;
4770 __ test(eax, eax); 4740 __ test(eax, eax);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
5074 Operand(ebp, 7 * kPointerSize), 5044 Operand(ebp, 7 * kPointerSize),
5075 NULL); 5045 NULL);
5076 } 5046 }
5077 5047
5078 5048
5079 #undef __ 5049 #undef __
5080 5050
5081 } } // namespace v8::internal 5051 } } // namespace v8::internal
5082 5052
5083 #endif // V8_TARGET_ARCH_IA32 5053 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698