OLD | NEW |
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 InlineCacheHolderFlag cache_holder = | 105 InlineCacheHolderFlag cache_holder = |
106 IC::GetCodeCacheForObject(*receiver, *holder); | 106 IC::GetCodeCacheForObject(*receiver, *holder); |
107 return Handle<JSObject>(IC::GetCodeCacheHolder( | 107 return Handle<JSObject>(IC::GetCodeCacheHolder( |
108 isolate_, *receiver, cache_holder)); | 108 isolate_, *receiver, cache_holder)); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 Handle<Code> StubCache::FindIC(Handle<Name> name, | 112 Handle<Code> StubCache::FindIC(Handle<Name> name, |
113 Handle<JSObject> stub_holder, | 113 Handle<JSObject> stub_holder, |
114 Code::Kind kind, | 114 Code::Kind kind, |
115 Code::StubType type) { | 115 Code::StubType type, |
116 Code::Flags flags = Code::ComputeMonomorphicFlags( | 116 Code::ExtraICState extra_ic_state) { |
117 kind, Code::kNoExtraICState, type); | 117 Code::Flags flags = Code::ComputeMonomorphicFlags(kind, extra_ic_state, type); |
118 Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags), | 118 Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags), |
119 isolate_); | 119 isolate_); |
120 if (probe->IsCode()) return Handle<Code>::cast(probe); | 120 if (probe->IsCode()) return Handle<Code>::cast(probe); |
121 return Handle<Code>::null(); | 121 return Handle<Code>::null(); |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 Handle<Code> StubCache::FindStub(Handle<Name> name, | 125 Handle<Code> StubCache::FindHandler(Handle<Name> name, |
126 Handle<JSObject> stub_holder, | 126 Handle<JSObject> stub_holder, |
127 Code::Kind kind, | 127 Code::Kind kind, |
128 Code::StubType type) { | 128 Code::StubType type, |
| 129 Code::ExtraICState extra_ic_state) { |
129 ASSERT(type != Code::NORMAL); | 130 ASSERT(type != Code::NORMAL); |
130 int extra_flags = -1; | |
131 if (kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC) { | |
132 extra_flags = kind; | |
133 kind = Code::STUB; | |
134 } | |
135 Code::Flags flags = Code::ComputeMonomorphicFlags( | 131 Code::Flags flags = Code::ComputeMonomorphicFlags( |
136 kind, Code::kNoExtraICState, type, extra_flags); | 132 Code::STUB, extra_ic_state, type, kind); |
137 Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags), | 133 Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags), |
138 isolate_); | 134 isolate_); |
139 if (probe->IsCode()) return Handle<Code>::cast(probe); | 135 if (probe->IsCode()) return Handle<Code>::cast(probe); |
140 return Handle<Code>::null(); | 136 return Handle<Code>::null(); |
141 } | 137 } |
142 | 138 |
143 | 139 |
144 Handle<Code> StubCache::ComputeMonomorphicIC(Handle<JSObject> receiver, | 140 Handle<Code> StubCache::ComputeMonomorphicIC(Handle<JSObject> receiver, |
145 Handle<Code> handler, | 141 Handle<Code> handler, |
146 Handle<Name> name) { | 142 Handle<Name> name) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 if (current->IsGlobalObject()) { | 186 if (current->IsGlobalObject()) { |
191 global = Handle<GlobalObject>::cast(current); | 187 global = Handle<GlobalObject>::cast(current); |
192 cache_name = name; | 188 cache_name = name; |
193 } else if (!current->HasFastProperties()) { | 189 } else if (!current->HasFastProperties()) { |
194 cache_name = name; | 190 cache_name = name; |
195 } | 191 } |
196 } while (!next->IsNull()); | 192 } while (!next->IsNull()); |
197 | 193 |
198 // Compile the stub that is either shared for all names or | 194 // Compile the stub that is either shared for all names or |
199 // name specific if there are global objects involved. | 195 // name specific if there are global objects involved. |
200 Handle<Code> handler = FindStub( | 196 Handle<Code> handler = FindHandler( |
201 cache_name, receiver, Code::LOAD_IC, Code::NONEXISTENT); | 197 cache_name, receiver, Code::LOAD_IC, Code::NONEXISTENT); |
202 if (!handler.is_null()) return handler; | 198 if (!handler.is_null()) return handler; |
203 | 199 |
204 LoadStubCompiler compiler(isolate_); | 200 LoadStubCompiler compiler(isolate_); |
205 handler = | 201 handler = |
206 compiler.CompileLoadNonexistent(receiver, current, cache_name, global); | 202 compiler.CompileLoadNonexistent(receiver, current, cache_name, global); |
207 JSObject::UpdateMapCodeCache(receiver, cache_name, handler); | 203 JSObject::UpdateMapCodeCache(receiver, cache_name, handler); |
208 return handler; | 204 return handler; |
209 } | 205 } |
210 | 206 |
211 | 207 |
212 Handle<Code> StubCache::ComputeLoadField(Handle<Name> name, | 208 Handle<Code> StubCache::ComputeLoadField(Handle<Name> name, |
213 Handle<JSObject> receiver, | 209 Handle<JSObject> receiver, |
214 Handle<JSObject> holder, | 210 Handle<JSObject> holder, |
215 PropertyIndex field) { | 211 PropertyIndex field) { |
216 if (receiver.is_identical_to(holder)) { | 212 if (receiver.is_identical_to(holder)) { |
217 LoadFieldStub stub(LoadStubCompiler::receiver(), | 213 LoadFieldStub stub(LoadStubCompiler::receiver(), |
218 field.is_inobject(holder), | 214 field.is_inobject(holder), |
219 field.translate(holder)); | 215 field.translate(holder)); |
220 return stub.GetCode(isolate()); | 216 return stub.GetCode(isolate()); |
221 } | 217 } |
222 | 218 |
223 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 219 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
224 Handle<Code> stub = FindStub( | 220 Handle<Code> stub = FindHandler( |
225 name, stub_holder, Code::LOAD_IC, Code::FIELD); | 221 name, stub_holder, Code::LOAD_IC, Code::FIELD); |
226 if (!stub.is_null()) return stub; | 222 if (!stub.is_null()) return stub; |
227 | 223 |
228 LoadStubCompiler compiler(isolate_); | 224 LoadStubCompiler compiler(isolate_); |
229 Handle<Code> handler = | 225 Handle<Code> handler = |
230 compiler.CompileLoadField(receiver, holder, name, field); | 226 compiler.CompileLoadField(receiver, holder, name, field); |
231 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 227 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
232 return handler; | 228 return handler; |
233 } | 229 } |
234 | 230 |
235 | 231 |
236 Handle<Code> StubCache::ComputeLoadCallback( | 232 Handle<Code> StubCache::ComputeLoadCallback( |
237 Handle<Name> name, | 233 Handle<Name> name, |
238 Handle<JSObject> receiver, | 234 Handle<JSObject> receiver, |
239 Handle<JSObject> holder, | 235 Handle<JSObject> holder, |
240 Handle<ExecutableAccessorInfo> callback) { | 236 Handle<ExecutableAccessorInfo> callback) { |
241 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); | 237 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); |
242 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 238 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
243 Handle<Code> stub = FindStub( | 239 Handle<Code> stub = FindHandler( |
244 name, stub_holder, Code::LOAD_IC, Code::CALLBACKS); | 240 name, stub_holder, Code::LOAD_IC, Code::CALLBACKS); |
245 if (!stub.is_null()) return stub; | 241 if (!stub.is_null()) return stub; |
246 | 242 |
247 LoadStubCompiler compiler(isolate_); | 243 LoadStubCompiler compiler(isolate_); |
248 Handle<Code> handler = | 244 Handle<Code> handler = |
249 compiler.CompileLoadCallback(receiver, holder, name, callback); | 245 compiler.CompileLoadCallback(receiver, holder, name, callback); |
250 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 246 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
251 return handler; | 247 return handler; |
252 } | 248 } |
253 | 249 |
254 | 250 |
255 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<Name> name, | 251 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<Name> name, |
256 Handle<JSObject> receiver, | 252 Handle<JSObject> receiver, |
257 Handle<JSObject> holder, | 253 Handle<JSObject> holder, |
258 Handle<JSFunction> getter) { | 254 Handle<JSFunction> getter) { |
259 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 255 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
260 Handle<Code> stub = FindStub( | 256 Handle<Code> stub = FindHandler( |
261 name, stub_holder, Code::LOAD_IC, Code::CALLBACKS); | 257 name, stub_holder, Code::LOAD_IC, Code::CALLBACKS); |
262 if (!stub.is_null()) return stub; | 258 if (!stub.is_null()) return stub; |
263 | 259 |
264 LoadStubCompiler compiler(isolate_); | 260 LoadStubCompiler compiler(isolate_); |
265 Handle<Code> handler = | 261 Handle<Code> handler = |
266 compiler.CompileLoadViaGetter(receiver, holder, name, getter); | 262 compiler.CompileLoadViaGetter(receiver, holder, name, getter); |
267 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 263 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
268 return handler; | 264 return handler; |
269 } | 265 } |
270 | 266 |
271 | 267 |
272 Handle<Code> StubCache::ComputeLoadConstant(Handle<Name> name, | 268 Handle<Code> StubCache::ComputeLoadConstant(Handle<Name> name, |
273 Handle<JSObject> receiver, | 269 Handle<JSObject> receiver, |
274 Handle<JSObject> holder, | 270 Handle<JSObject> holder, |
275 Handle<JSFunction> value) { | 271 Handle<JSFunction> value) { |
276 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 272 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
277 Handle<Code> handler = FindStub( | 273 Handle<Code> handler = FindHandler( |
278 name, stub_holder, Code::LOAD_IC, Code::CONSTANT_FUNCTION); | 274 name, stub_holder, Code::LOAD_IC, Code::CONSTANT_FUNCTION); |
279 if (!handler.is_null()) return handler; | 275 if (!handler.is_null()) return handler; |
280 | 276 |
281 LoadStubCompiler compiler(isolate_); | 277 LoadStubCompiler compiler(isolate_); |
282 handler = compiler.CompileLoadConstant(receiver, holder, name, value); | 278 handler = compiler.CompileLoadConstant(receiver, holder, name, value); |
283 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 279 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
284 | 280 |
285 return handler; | 281 return handler; |
286 } | 282 } |
287 | 283 |
288 | 284 |
289 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<Name> name, | 285 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<Name> name, |
290 Handle<JSObject> receiver, | 286 Handle<JSObject> receiver, |
291 Handle<JSObject> holder) { | 287 Handle<JSObject> holder) { |
292 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 288 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
293 Handle<Code> stub = FindStub( | 289 Handle<Code> stub = FindHandler( |
294 name, stub_holder, Code::LOAD_IC, Code::INTERCEPTOR); | 290 name, stub_holder, Code::LOAD_IC, Code::INTERCEPTOR); |
295 if (!stub.is_null()) return stub; | 291 if (!stub.is_null()) return stub; |
296 | 292 |
297 LoadStubCompiler compiler(isolate_); | 293 LoadStubCompiler compiler(isolate_); |
298 Handle<Code> handler = | 294 Handle<Code> handler = |
299 compiler.CompileLoadInterceptor(receiver, holder, name); | 295 compiler.CompileLoadInterceptor(receiver, holder, name); |
300 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 296 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
301 return handler; | 297 return handler; |
302 } | 298 } |
303 | 299 |
(...skipping 26 matching lines...) Expand all Loading... |
330 Handle<JSObject> holder, | 326 Handle<JSObject> holder, |
331 PropertyIndex field) { | 327 PropertyIndex field) { |
332 if (receiver.is_identical_to(holder)) { | 328 if (receiver.is_identical_to(holder)) { |
333 LoadFieldStub stub(KeyedLoadStubCompiler::receiver(), | 329 LoadFieldStub stub(KeyedLoadStubCompiler::receiver(), |
334 field.is_inobject(holder), | 330 field.is_inobject(holder), |
335 field.translate(holder)); | 331 field.translate(holder)); |
336 return stub.GetCode(isolate()); | 332 return stub.GetCode(isolate()); |
337 } | 333 } |
338 | 334 |
339 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 335 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
340 Handle<Code> stub = FindStub( | 336 Handle<Code> stub = FindHandler( |
341 name, stub_holder, Code::KEYED_LOAD_IC, Code::FIELD); | 337 name, stub_holder, Code::KEYED_LOAD_IC, Code::FIELD); |
342 if (!stub.is_null()) return stub; | 338 if (!stub.is_null()) return stub; |
343 | 339 |
344 KeyedLoadStubCompiler compiler(isolate_); | 340 KeyedLoadStubCompiler compiler(isolate_); |
345 Handle<Code> handler = | 341 Handle<Code> handler = |
346 compiler.CompileLoadField(receiver, holder, name, field); | 342 compiler.CompileLoadField(receiver, holder, name, field); |
347 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 343 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
348 return handler; | 344 return handler; |
349 } | 345 } |
350 | 346 |
351 | 347 |
352 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<Name> name, | 348 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<Name> name, |
353 Handle<JSObject> receiver, | 349 Handle<JSObject> receiver, |
354 Handle<JSObject> holder, | 350 Handle<JSObject> holder, |
355 Handle<JSFunction> value) { | 351 Handle<JSFunction> value) { |
356 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 352 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
357 Handle<Code> handler = FindStub( | 353 Handle<Code> handler = FindHandler( |
358 name, stub_holder, Code::KEYED_LOAD_IC, Code::CONSTANT_FUNCTION); | 354 name, stub_holder, Code::KEYED_LOAD_IC, Code::CONSTANT_FUNCTION); |
359 if (!handler.is_null()) return handler; | 355 if (!handler.is_null()) return handler; |
360 | 356 |
361 KeyedLoadStubCompiler compiler(isolate_); | 357 KeyedLoadStubCompiler compiler(isolate_); |
362 handler = compiler.CompileLoadConstant(receiver, holder, name, value); | 358 handler = compiler.CompileLoadConstant(receiver, holder, name, value); |
363 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 359 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
364 return handler; | 360 return handler; |
365 } | 361 } |
366 | 362 |
367 | 363 |
368 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<Name> name, | 364 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<Name> name, |
369 Handle<JSObject> receiver, | 365 Handle<JSObject> receiver, |
370 Handle<JSObject> holder) { | 366 Handle<JSObject> holder) { |
371 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 367 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
372 Handle<Code> stub = FindStub( | 368 Handle<Code> stub = FindHandler( |
373 name, stub_holder, Code::KEYED_LOAD_IC, Code::INTERCEPTOR); | 369 name, stub_holder, Code::KEYED_LOAD_IC, Code::INTERCEPTOR); |
374 if (!stub.is_null()) return stub; | 370 if (!stub.is_null()) return stub; |
375 | 371 |
376 KeyedLoadStubCompiler compiler(isolate_); | 372 KeyedLoadStubCompiler compiler(isolate_); |
377 Handle<Code> handler = | 373 Handle<Code> handler = |
378 compiler.CompileLoadInterceptor(receiver, holder, name); | 374 compiler.CompileLoadInterceptor(receiver, holder, name); |
379 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 375 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
380 return handler; | 376 return handler; |
381 } | 377 } |
382 | 378 |
383 | 379 |
384 Handle<Code> StubCache::ComputeKeyedLoadCallback( | 380 Handle<Code> StubCache::ComputeKeyedLoadCallback( |
385 Handle<Name> name, | 381 Handle<Name> name, |
386 Handle<JSObject> receiver, | 382 Handle<JSObject> receiver, |
387 Handle<JSObject> holder, | 383 Handle<JSObject> holder, |
388 Handle<ExecutableAccessorInfo> callback) { | 384 Handle<ExecutableAccessorInfo> callback) { |
389 Handle<JSObject> stub_holder = StubHolder(receiver, holder); | 385 Handle<JSObject> stub_holder = StubHolder(receiver, holder); |
390 Handle<Code> stub = FindStub( | 386 Handle<Code> stub = FindHandler( |
391 name, stub_holder, Code::KEYED_LOAD_IC, Code::CALLBACKS); | 387 name, stub_holder, Code::KEYED_LOAD_IC, Code::CALLBACKS); |
392 if (!stub.is_null()) return stub; | 388 if (!stub.is_null()) return stub; |
393 | 389 |
394 KeyedLoadStubCompiler compiler(isolate_); | 390 KeyedLoadStubCompiler compiler(isolate_); |
395 Handle<Code> handler = | 391 Handle<Code> handler = |
396 compiler.CompileLoadCallback(receiver, holder, name, callback); | 392 compiler.CompileLoadCallback(receiver, holder, name, callback); |
397 JSObject::UpdateMapCodeCache(stub_holder, name, handler); | 393 JSObject::UpdateMapCodeCache(stub_holder, name, handler); |
398 return handler; | 394 return handler; |
399 } | 395 } |
400 | 396 |
401 | 397 |
402 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name, | 398 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name, |
403 Handle<JSObject> receiver, | 399 Handle<JSObject> receiver, |
404 int field_index, | 400 int field_index, |
405 Handle<Map> transition, | 401 Handle<Map> transition, |
406 StrictModeFlag strict_mode) { | 402 StrictModeFlag strict_mode) { |
407 Code::StubType type = | 403 Code::StubType type = |
408 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; | 404 transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION; |
409 Code::Flags flags = Code::ComputeMonomorphicFlags( | 405 |
410 Code::STORE_IC, strict_mode, type); | 406 Handle<Code> stub = FindIC( |
411 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), | 407 name, receiver, Code::STORE_IC, type, strict_mode); |
412 isolate_); | 408 if (!stub.is_null()) return stub; |
413 if (probe->IsCode()) return Handle<Code>::cast(probe); | |
414 | 409 |
415 StoreStubCompiler compiler(isolate_, strict_mode); | 410 StoreStubCompiler compiler(isolate_, strict_mode); |
416 Handle<Code> code = | 411 Handle<Code> code = |
417 compiler.CompileStoreField(receiver, field_index, transition, name); | 412 compiler.CompileStoreField(receiver, field_index, transition, name); |
418 JSObject::UpdateMapCodeCache(receiver, name, code); | 413 JSObject::UpdateMapCodeCache(receiver, name, code); |
419 return code; | 414 return code; |
420 } | 415 } |
421 | 416 |
422 | 417 |
423 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { | 418 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 return (strict_mode == kStrictMode) | 461 return (strict_mode == kStrictMode) |
467 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict() | 462 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict() |
468 : isolate_->builtins()->Builtins::StoreIC_Normal(); | 463 : isolate_->builtins()->Builtins::StoreIC_Normal(); |
469 } | 464 } |
470 | 465 |
471 | 466 |
472 Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name, | 467 Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name, |
473 Handle<GlobalObject> receiver, | 468 Handle<GlobalObject> receiver, |
474 Handle<JSGlobalPropertyCell> cell, | 469 Handle<JSGlobalPropertyCell> cell, |
475 StrictModeFlag strict_mode) { | 470 StrictModeFlag strict_mode) { |
476 Code::Flags flags = Code::ComputeMonomorphicFlags( | 471 Handle<Code> stub = FindIC( |
477 Code::STORE_IC, strict_mode); | 472 name, receiver, Code::STORE_IC, Code::NORMAL, strict_mode); |
478 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), | 473 if (!stub.is_null()) return stub; |
479 isolate_); | |
480 if (probe->IsCode()) return Handle<Code>::cast(probe); | |
481 | 474 |
482 StoreStubCompiler compiler(isolate_, strict_mode); | 475 StoreStubCompiler compiler(isolate_, strict_mode); |
483 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); | 476 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); |
484 JSObject::UpdateMapCodeCache(receiver, name, code); | 477 JSObject::UpdateMapCodeCache(receiver, name, code); |
485 return code; | 478 return code; |
486 } | 479 } |
487 | 480 |
488 | 481 |
489 Handle<Code> StubCache::ComputeStoreCallback( | 482 Handle<Code> StubCache::ComputeStoreCallback( |
490 Handle<Name> name, | 483 Handle<Name> name, |
491 Handle<JSObject> receiver, | 484 Handle<JSObject> receiver, |
492 Handle<JSObject> holder, | 485 Handle<JSObject> holder, |
493 Handle<ExecutableAccessorInfo> callback, | 486 Handle<ExecutableAccessorInfo> callback, |
494 StrictModeFlag strict_mode) { | 487 StrictModeFlag strict_mode) { |
495 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 488 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
496 Code::Flags flags = Code::ComputeMonomorphicFlags( | 489 Handle<Code> stub = FindIC( |
497 Code::STORE_IC, strict_mode, Code::CALLBACKS); | 490 name, receiver, Code::STORE_IC, Code::CALLBACKS, strict_mode); |
498 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), | 491 if (!stub.is_null()) return stub; |
499 isolate_); | |
500 if (probe->IsCode()) return Handle<Code>::cast(probe); | |
501 | 492 |
502 StoreStubCompiler compiler(isolate_, strict_mode); | 493 StoreStubCompiler compiler(isolate_, strict_mode); |
503 Handle<Code> code = | 494 Handle<Code> code = |
504 compiler.CompileStoreCallback(name, receiver, holder, callback); | 495 compiler.CompileStoreCallback(name, receiver, holder, callback); |
505 JSObject::UpdateMapCodeCache(receiver, name, code); | 496 JSObject::UpdateMapCodeCache(receiver, name, code); |
506 return code; | 497 return code; |
507 } | 498 } |
508 | 499 |
509 | 500 |
510 Handle<Code> StubCache::ComputeStoreViaSetter(Handle<Name> name, | 501 Handle<Code> StubCache::ComputeStoreViaSetter(Handle<Name> name, |
511 Handle<JSObject> receiver, | 502 Handle<JSObject> receiver, |
512 Handle<JSObject> holder, | 503 Handle<JSObject> holder, |
513 Handle<JSFunction> setter, | 504 Handle<JSFunction> setter, |
514 StrictModeFlag strict_mode) { | 505 StrictModeFlag strict_mode) { |
515 Code::Flags flags = Code::ComputeMonomorphicFlags( | 506 Handle<Code> stub = FindIC( |
516 Code::STORE_IC, strict_mode, Code::CALLBACKS); | 507 name, receiver, Code::STORE_IC, Code::CALLBACKS, strict_mode); |
517 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), | 508 if (!stub.is_null()) return stub; |
518 isolate_); | |
519 if (probe->IsCode()) return Handle<Code>::cast(probe); | |
520 | 509 |
521 StoreStubCompiler compiler(isolate_, strict_mode); | 510 StoreStubCompiler compiler(isolate_, strict_mode); |
522 Handle<Code> code = | 511 Handle<Code> code = |
523 compiler.CompileStoreViaSetter(name, receiver, holder, setter); | 512 compiler.CompileStoreViaSetter(name, receiver, holder, setter); |
524 JSObject::UpdateMapCodeCache(receiver, name, code); | 513 JSObject::UpdateMapCodeCache(receiver, name, code); |
525 return code; | 514 return code; |
526 } | 515 } |
527 | 516 |
528 | 517 |
529 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<Name> name, | 518 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<Name> name, |
530 Handle<JSObject> receiver, | 519 Handle<JSObject> receiver, |
531 StrictModeFlag strict_mode) { | 520 StrictModeFlag strict_mode) { |
532 Code::Flags flags = Code::ComputeMonomorphicFlags( | 521 Handle<Code> stub = FindIC( |
533 Code::STORE_IC, strict_mode, Code::INTERCEPTOR); | 522 name, receiver, Code::STORE_IC, Code::INTERCEPTOR, strict_mode); |
534 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), | 523 if (!stub.is_null()) return stub; |
535 isolate_); | |
536 if (probe->IsCode()) return Handle<Code>::cast(probe); | |
537 | 524 |
538 StoreStubCompiler compiler(isolate_, strict_mode); | 525 StoreStubCompiler compiler(isolate_, strict_mode); |
539 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); | 526 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); |
540 JSObject::UpdateMapCodeCache(receiver, name, code); | 527 JSObject::UpdateMapCodeCache(receiver, name, code); |
541 return code; | 528 return code; |
542 } | 529 } |
543 | 530 |
544 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name, | 531 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name, |
545 Handle<JSObject> receiver, | 532 Handle<JSObject> receiver, |
546 int field_index, | 533 int field_index, |
547 Handle<Map> transition, | 534 Handle<Map> transition, |
548 StrictModeFlag strict_mode) { | 535 StrictModeFlag strict_mode) { |
549 Code::StubType type = | 536 Code::StubType type = |
550 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; | 537 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; |
551 Code::Flags flags = Code::ComputeMonomorphicFlags( | 538 Handle<Code> stub = FindIC( |
552 Code::KEYED_STORE_IC, strict_mode, type); | 539 name, receiver, Code::KEYED_STORE_IC, type, strict_mode); |
553 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), | 540 if (!stub.is_null()) return stub; |
554 isolate_); | |
555 if (probe->IsCode()) return Handle<Code>::cast(probe); | |
556 | 541 |
557 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE); | 542 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE); |
558 Handle<Code> code = | 543 Handle<Code> code = |
559 compiler.CompileStoreField(receiver, field_index, transition, name); | 544 compiler.CompileStoreField(receiver, field_index, transition, name); |
560 JSObject::UpdateMapCodeCache(receiver, name, code); | 545 JSObject::UpdateMapCodeCache(receiver, name, code); |
561 return code; | 546 return code; |
562 } | 547 } |
563 | 548 |
564 | 549 |
565 #define CALL_LOGGER_TAG(kind, type) \ | 550 #define CALL_LOGGER_TAG(kind, type) \ |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 | 1430 |
1446 Handle<Code> BaseLoadStubCompiler::CompileLoadField(Handle<JSObject> object, | 1431 Handle<Code> BaseLoadStubCompiler::CompileLoadField(Handle<JSObject> object, |
1447 Handle<JSObject> holder, | 1432 Handle<JSObject> holder, |
1448 Handle<Name> name, | 1433 Handle<Name> name, |
1449 PropertyIndex field) { | 1434 PropertyIndex field) { |
1450 Label miss; | 1435 Label miss; |
1451 | 1436 |
1452 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss); | 1437 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss); |
1453 | 1438 |
1454 LoadFieldStub stub(reg, field.is_inobject(holder), field.translate(holder)); | 1439 LoadFieldStub stub(reg, field.is_inobject(holder), field.translate(holder)); |
1455 GenerateTailCall(stub.GetCode(isolate())); | 1440 GenerateTailCall(masm(), stub.GetCode(isolate())); |
1456 | 1441 |
1457 __ bind(&miss); | 1442 __ bind(&miss); |
1458 GenerateLoadMiss(masm(), kind()); | 1443 TailCallBuiltin(masm(), MissBuiltin(kind())); |
1459 | 1444 |
1460 // Return the generated code. | 1445 // Return the generated code. |
1461 return GetCode(kind(), Code::FIELD, name); | 1446 return GetCode(kind(), Code::FIELD, name); |
1462 } | 1447 } |
1463 | 1448 |
1464 | 1449 |
| 1450 // Load a fast property out of a holder object (src). In-object properties |
| 1451 // are loaded directly otherwise the property is loaded from the properties |
| 1452 // fixed array. |
| 1453 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm, |
| 1454 Register dst, |
| 1455 Register src, |
| 1456 Handle<JSObject> holder, |
| 1457 PropertyIndex index) { |
| 1458 DoGenerateFastPropertyLoad( |
| 1459 masm, dst, src, index.is_inobject(holder), index.translate(holder)); |
| 1460 } |
| 1461 |
| 1462 |
1465 Handle<Code> BaseLoadStubCompiler::CompileLoadConstant( | 1463 Handle<Code> BaseLoadStubCompiler::CompileLoadConstant( |
1466 Handle<JSObject> object, | 1464 Handle<JSObject> object, |
1467 Handle<JSObject> holder, | 1465 Handle<JSObject> holder, |
1468 Handle<Name> name, | 1466 Handle<Name> name, |
1469 Handle<JSFunction> value) { | 1467 Handle<JSFunction> value) { |
1470 Label success; | 1468 Label success; |
1471 HandlerFrontend(object, receiver(), holder, name, &success); | 1469 HandlerFrontend(object, receiver(), holder, name, &success); |
1472 __ bind(&success); | 1470 __ bind(&success); |
1473 GenerateLoadConstant(value); | 1471 GenerateLoadConstant(value); |
1474 | 1472 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 Handle<Name> name, | 1518 Handle<Name> name, |
1521 LookupResult* lookup) { | 1519 LookupResult* lookup) { |
1522 Label success; | 1520 Label success; |
1523 Handle<JSObject> holder(lookup->holder()); | 1521 Handle<JSObject> holder(lookup->holder()); |
1524 if (lookup->IsField()) { | 1522 if (lookup->IsField()) { |
1525 PropertyIndex field = lookup->GetFieldIndex(); | 1523 PropertyIndex field = lookup->GetFieldIndex(); |
1526 if (interceptor_holder.is_identical_to(holder)) { | 1524 if (interceptor_holder.is_identical_to(holder)) { |
1527 LoadFieldStub stub(interceptor_reg, | 1525 LoadFieldStub stub(interceptor_reg, |
1528 field.is_inobject(holder), | 1526 field.is_inobject(holder), |
1529 field.translate(holder)); | 1527 field.translate(holder)); |
1530 GenerateTailCall(stub.GetCode(isolate())); | 1528 GenerateTailCall(masm(), stub.GetCode(isolate())); |
1531 } else { | 1529 } else { |
1532 // We found FIELD property in prototype chain of interceptor's holder. | 1530 // We found FIELD property in prototype chain of interceptor's holder. |
1533 // Retrieve a field from field's holder. | 1531 // Retrieve a field from field's holder. |
1534 Register reg = HandlerFrontend( | 1532 Register reg = HandlerFrontend( |
1535 interceptor_holder, interceptor_reg, holder, name, &success); | 1533 interceptor_holder, interceptor_reg, holder, name, &success); |
1536 __ bind(&success); | 1534 __ bind(&success); |
1537 GenerateLoadField(reg, holder, field); | 1535 GenerateLoadField(reg, holder, field); |
1538 } | 1536 } |
1539 } else { | 1537 } else { |
1540 // We found CALLBACKS property in prototype chain of interceptor's | 1538 // We found CALLBACKS property in prototype chain of interceptor's |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 HandlerFrontend(object, receiver(), holder, name, &success); | 1572 HandlerFrontend(object, receiver(), holder, name, &success); |
1575 | 1573 |
1576 __ bind(&success); | 1574 __ bind(&success); |
1577 GenerateLoadViaGetter(masm(), getter); | 1575 GenerateLoadViaGetter(masm(), getter); |
1578 | 1576 |
1579 // Return the generated code. | 1577 // Return the generated code. |
1580 return GetCode(kind(), Code::CALLBACKS, name); | 1578 return GetCode(kind(), Code::CALLBACKS, name); |
1581 } | 1579 } |
1582 | 1580 |
1583 | 1581 |
| 1582 Handle<Code> BaseStoreStubCompiler::CompileStoreField(Handle<JSObject> object, |
| 1583 int index, |
| 1584 Handle<Map> transition, |
| 1585 Handle<Name> name) { |
| 1586 Label miss, miss_restore_name; |
| 1587 |
| 1588 GenerateNameCheck(name, this->name(), &miss); |
| 1589 |
| 1590 // Generate store field code. |
| 1591 GenerateStoreField(masm(), |
| 1592 object, |
| 1593 index, |
| 1594 transition, |
| 1595 name, |
| 1596 receiver(), this->name(), value(), scratch1(), scratch2(), |
| 1597 &miss, |
| 1598 &miss_restore_name); |
| 1599 |
| 1600 // Handle store cache miss. |
| 1601 GenerateRestoreName(masm(), &miss_restore_name, name); |
| 1602 __ bind(&miss); |
| 1603 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 1604 |
| 1605 // Return the generated code. |
| 1606 return GetICCode(kind(), |
| 1607 transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION, |
| 1608 name); |
| 1609 } |
| 1610 |
| 1611 |
1584 #undef __ | 1612 #undef __ |
1585 | 1613 |
1586 | 1614 |
| 1615 void StubCompiler::TailCallBuiltin(MacroAssembler* masm, Builtins::Name name) { |
| 1616 Handle<Code> code(masm->isolate()->builtins()->builtin(name)); |
| 1617 GenerateTailCall(masm, code); |
| 1618 } |
| 1619 |
| 1620 |
1587 void LoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) { | 1621 void LoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) { |
1588 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 1622 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
1589 } | 1623 } |
1590 | 1624 |
1591 | 1625 |
1592 void KeyedLoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) { | 1626 void KeyedLoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) { |
1593 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 1627 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
1594 } | 1628 } |
1595 | 1629 |
1596 | 1630 |
| 1631 void StoreStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) { |
| 1632 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
| 1633 } |
| 1634 |
| 1635 |
| 1636 void KeyedStoreStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) { |
| 1637 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); |
| 1638 } |
| 1639 |
| 1640 |
1597 Handle<Code> BaseLoadStubCompiler::GetICCode(Code::Kind kind, | 1641 Handle<Code> BaseLoadStubCompiler::GetICCode(Code::Kind kind, |
1598 Code::StubType type, | 1642 Code::StubType type, |
1599 Handle<Name> name, | 1643 Handle<Name> name, |
1600 InlineCacheState state) { | 1644 InlineCacheState state) { |
1601 Code::Flags flags = Code::ComputeFlags( | 1645 Code::Flags flags = Code::ComputeFlags( |
1602 kind, state, Code::kNoExtraICState, type); | 1646 kind, state, Code::kNoExtraICState, type); |
1603 Handle<Code> code = GetCodeWithFlags(flags, name); | 1647 Handle<Code> code = GetCodeWithFlags(flags, name); |
1604 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); | 1648 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); |
1605 JitEvent(name, code); | 1649 JitEvent(name, code); |
1606 return code; | 1650 return code; |
1607 } | 1651 } |
1608 | 1652 |
1609 | 1653 |
1610 Handle<Code> BaseLoadStubCompiler::GetCode(Code::Kind kind, | 1654 Handle<Code> BaseLoadStubCompiler::GetCode(Code::Kind kind, |
1611 Code::StubType type, | 1655 Code::StubType type, |
1612 Handle<Name> name) { | 1656 Handle<Name> name) { |
1613 ASSERT(type != Code::NORMAL); | 1657 ASSERT(type != Code::NORMAL); |
1614 Code::Flags flags = Code::ComputeFlags( | 1658 Code::Flags flags = Code::ComputeFlags( |
1615 Code::STUB, MONOMORPHIC, Code::kNoExtraICState, type, kind); | 1659 Code::STUB, MONOMORPHIC, Code::kNoExtraICState, type, kind); |
1616 Handle<Code> code = GetCodeWithFlags(flags, name); | 1660 Handle<Code> code = GetCodeWithFlags(flags, name); |
1617 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); | 1661 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); |
1618 JitEvent(name, code); | 1662 JitEvent(name, code); |
1619 return code; | 1663 return code; |
1620 } | 1664 } |
1621 | 1665 |
1622 | 1666 |
| 1667 Handle<Code> BaseStoreStubCompiler::GetICCode(Code::Kind kind, |
| 1668 Code::StubType type, |
| 1669 Handle<Name> name, |
| 1670 InlineCacheState state) { |
| 1671 Code::Flags flags = Code::ComputeFlags( |
| 1672 kind, state, extra_state(), type); |
| 1673 Handle<Code> code = GetCodeWithFlags(flags, name); |
| 1674 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); |
| 1675 JitEvent(name, code); |
| 1676 return code; |
| 1677 } |
| 1678 |
| 1679 |
| 1680 Handle<Code> BaseStoreStubCompiler::GetCode(Code::Kind kind, |
| 1681 Code::StubType type, |
| 1682 Handle<Name> name) { |
| 1683 ASSERT(type != Code::NORMAL); |
| 1684 Code::Flags flags = Code::ComputeFlags( |
| 1685 Code::STUB, MONOMORPHIC, extra_state(), type, kind); |
| 1686 Handle<Code> code = GetCodeWithFlags(flags, name); |
| 1687 PROFILE(isolate(), CodeCreateEvent(log_kind(code), *code, *name)); |
| 1688 JitEvent(name, code); |
| 1689 return code; |
| 1690 } |
| 1691 |
| 1692 |
1623 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps, | 1693 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps, |
1624 CodeHandleList* handlers) { | 1694 CodeHandleList* handlers) { |
1625 for (int i = 0; i < receiver_maps->length(); ++i) { | 1695 for (int i = 0; i < receiver_maps->length(); ++i) { |
1626 Handle<Map> receiver_map = receiver_maps->at(i); | 1696 Handle<Map> receiver_map = receiver_maps->at(i); |
1627 Handle<Code> cached_stub; | 1697 Handle<Code> cached_stub; |
1628 | 1698 |
1629 if ((receiver_map->instance_type() & kNotStringTag) == 0) { | 1699 if ((receiver_map->instance_type() & kNotStringTag) == 0) { |
1630 cached_stub = isolate()->builtins()->KeyedLoadIC_String(); | 1700 cached_stub = isolate()->builtins()->KeyedLoadIC_String(); |
1631 } else { | 1701 } else { |
1632 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1702 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
1633 ElementsKind elements_kind = receiver_map->elements_kind(); | 1703 ElementsKind elements_kind = receiver_map->elements_kind(); |
1634 | 1704 |
1635 if (IsFastElementsKind(elements_kind) || | 1705 if (IsFastElementsKind(elements_kind) || |
1636 IsExternalArrayElementsKind(elements_kind)) { | 1706 IsExternalArrayElementsKind(elements_kind)) { |
1637 cached_stub = | 1707 cached_stub = |
1638 KeyedLoadFastElementStub(is_js_array, | 1708 KeyedLoadFastElementStub(is_js_array, |
1639 elements_kind).GetCode(isolate()); | 1709 elements_kind).GetCode(isolate()); |
1640 } else { | 1710 } else { |
1641 ASSERT(elements_kind == DICTIONARY_ELEMENTS); | 1711 ASSERT(elements_kind == DICTIONARY_ELEMENTS); |
1642 cached_stub = KeyedLoadDictionaryElementStub().GetCode(isolate()); | 1712 cached_stub = KeyedLoadDictionaryElementStub().GetCode(isolate()); |
1643 } | 1713 } |
1644 } | 1714 } |
1645 | 1715 |
1646 handlers->Add(cached_stub); | 1716 handlers->Add(cached_stub); |
1647 } | 1717 } |
1648 } | 1718 } |
1649 | 1719 |
1650 | 1720 |
1651 Handle<Code> StoreStubCompiler::GetCode(Code::StubType type, | |
1652 Handle<Name> name) { | |
1653 Code::Flags flags = Code::ComputeMonomorphicFlags( | |
1654 Code::STORE_IC, strict_mode_, type); | |
1655 Handle<Code> code = GetCodeWithFlags(flags, name); | |
1656 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | |
1657 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | |
1658 return code; | |
1659 } | |
1660 | |
1661 | |
1662 Handle<Code> KeyedStoreStubCompiler::GetCode(Code::StubType type, | |
1663 Handle<Name> name, | |
1664 InlineCacheState state) { | |
1665 Code::ExtraICState extra_state = | |
1666 Code::ComputeExtraICState(store_mode_, strict_mode_); | |
1667 Code::Flags flags = | |
1668 Code::ComputeFlags(Code::KEYED_STORE_IC, state, extra_state, type); | |
1669 Handle<Code> code = GetCodeWithFlags(flags, name); | |
1670 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); | |
1671 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); | |
1672 return code; | |
1673 } | |
1674 | |
1675 | |
1676 Handle<Code> KeyedStoreStubCompiler::CompileStoreElementPolymorphic( | 1721 Handle<Code> KeyedStoreStubCompiler::CompileStoreElementPolymorphic( |
1677 MapHandleList* receiver_maps) { | 1722 MapHandleList* receiver_maps) { |
1678 // Collect MONOMORPHIC stubs for all |receiver_maps|. | 1723 // Collect MONOMORPHIC stubs for all |receiver_maps|. |
1679 CodeHandleList handlers(receiver_maps->length()); | 1724 CodeHandleList handlers(receiver_maps->length()); |
1680 MapHandleList transitioned_maps(receiver_maps->length()); | 1725 MapHandleList transitioned_maps(receiver_maps->length()); |
1681 for (int i = 0; i < receiver_maps->length(); ++i) { | 1726 for (int i = 0; i < receiver_maps->length(); ++i) { |
1682 Handle<Map> receiver_map(receiver_maps->at(i)); | 1727 Handle<Map> receiver_map(receiver_maps->at(i)); |
1683 Handle<Code> cached_stub; | 1728 Handle<Code> cached_stub; |
1684 Handle<Map> transitioned_map = | 1729 Handle<Map> transitioned_map = |
1685 receiver_map->FindTransitionedMap(receiver_maps); | 1730 receiver_map->FindTransitionedMap(receiver_maps); |
1686 | 1731 |
1687 // TODO(mvstanton): The code below is doing pessimistic elements | 1732 // TODO(mvstanton): The code below is doing pessimistic elements |
1688 // transitions. I would like to stop doing that and rely on Allocation Site | 1733 // transitions. I would like to stop doing that and rely on Allocation Site |
1689 // Tracking to do a better job of ensuring the data types are what they need | 1734 // Tracking to do a better job of ensuring the data types are what they need |
1690 // to be. Not all the elements are in place yet, pessimistic elements | 1735 // to be. Not all the elements are in place yet, pessimistic elements |
1691 // transitions are still important for performance. | 1736 // transitions are still important for performance. |
1692 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 1737 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
1693 ElementsKind elements_kind = receiver_map->elements_kind(); | 1738 ElementsKind elements_kind = receiver_map->elements_kind(); |
1694 if (!transitioned_map.is_null()) { | 1739 if (!transitioned_map.is_null()) { |
1695 cached_stub = ElementsTransitionAndStoreStub( | 1740 cached_stub = ElementsTransitionAndStoreStub( |
1696 elements_kind, | 1741 elements_kind, |
1697 transitioned_map->elements_kind(), | 1742 transitioned_map->elements_kind(), |
1698 is_js_array, | 1743 is_js_array, |
1699 strict_mode_, | 1744 strict_mode(), |
1700 store_mode_).GetCode(isolate()); | 1745 store_mode_).GetCode(isolate()); |
1701 } else { | 1746 } else { |
1702 cached_stub = KeyedStoreElementStub( | 1747 cached_stub = KeyedStoreElementStub( |
1703 is_js_array, | 1748 is_js_array, |
1704 elements_kind, | 1749 elements_kind, |
1705 store_mode_).GetCode(isolate()); | 1750 store_mode_).GetCode(isolate()); |
1706 } | 1751 } |
1707 ASSERT(!cached_stub.is_null()); | 1752 ASSERT(!cached_stub.is_null()); |
1708 handlers.Add(cached_stub); | 1753 handlers.Add(cached_stub); |
1709 transitioned_maps.Add(transitioned_map); | 1754 transitioned_maps.Add(transitioned_map); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 Handle<FunctionTemplateInfo>( | 1922 Handle<FunctionTemplateInfo>( |
1878 FunctionTemplateInfo::cast(signature->receiver())); | 1923 FunctionTemplateInfo::cast(signature->receiver())); |
1879 } | 1924 } |
1880 } | 1925 } |
1881 | 1926 |
1882 is_simple_api_call_ = true; | 1927 is_simple_api_call_ = true; |
1883 } | 1928 } |
1884 | 1929 |
1885 | 1930 |
1886 } } // namespace v8::internal | 1931 } } // namespace v8::internal |
OLD | NEW |