OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 current->property_dictionary()->FindEntry(name) == | 408 current->property_dictionary()->FindEntry(name) == |
409 NameDictionary::kNotFound); | 409 NameDictionary::kNotFound); |
410 | 410 |
411 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, | 411 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, |
412 scratch2); | 412 scratch2); |
413 | 413 |
414 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 414 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
415 reg = holder_reg; // From now on the object will be in holder_reg. | 415 reg = holder_reg; // From now on the object will be in holder_reg. |
416 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 416 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
417 } else { | 417 } else { |
418 bool in_new_space = heap()->InNewSpace(*prototype); | |
419 // Two possible reasons for loading the prototype from the map: | |
420 // (1) Can't store references to new space in code. | |
421 // (2) Handler is shared for all receivers with the same prototype | |
422 // map (but not necessarily the same prototype instance). | |
423 bool load_prototype_from_map = in_new_space || depth == 1; | |
424 if (depth != 1 || check == CHECK_ALL_MAPS) { | 418 if (depth != 1 || check == CHECK_ALL_MAPS) { |
425 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); | 419 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); |
426 } | 420 } |
427 | 421 |
428 // Check access rights to the global object. This has to happen after | 422 // Check access rights to the global object. This has to happen after |
429 // the map check so that we know that the object is actually a global | 423 // the map check so that we know that the object is actually a global |
430 // object. | 424 // object. |
431 // This allows us to install generated handlers for accesses to the | 425 // This allows us to install generated handlers for accesses to the |
432 // global proxy (as opposed to using slow ICs). See corresponding code | 426 // global proxy (as opposed to using slow ICs). See corresponding code |
433 // in LookupForRead(). | 427 // in LookupForRead(). |
434 if (current_map->IsJSGlobalProxyMap()) { | 428 if (current_map->IsJSGlobalProxyMap()) { |
435 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); | 429 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); |
436 } else if (current_map->IsJSGlobalObjectMap()) { | 430 } else if (current_map->IsJSGlobalObjectMap()) { |
437 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), | 431 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), |
438 name, scratch2, miss); | 432 name, scratch2, miss); |
439 } | 433 } |
440 | 434 |
441 if (load_prototype_from_map) { | 435 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
442 // Save the map in scratch1 for later. | |
443 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | |
444 } | |
445 | |
446 reg = holder_reg; // From now on the object will be in holder_reg. | 436 reg = holder_reg; // From now on the object will be in holder_reg. |
447 | 437 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
448 if (load_prototype_from_map) { | |
449 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | |
450 } else { | |
451 __ mov(reg, prototype); | |
452 } | |
453 } | 438 } |
454 | 439 |
455 // Go to the next object in the prototype chain. | 440 // Go to the next object in the prototype chain. |
456 current = prototype; | 441 current = prototype; |
457 current_map = handle(current->map()); | 442 current_map = handle(current->map()); |
458 } | 443 } |
459 | 444 |
460 // Log the check depth. | 445 // Log the check depth. |
461 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 446 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
462 | 447 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 // Return the generated code. | 698 // Return the generated code. |
714 return GetCode(kind(), Code::NORMAL, name); | 699 return GetCode(kind(), Code::NORMAL, name); |
715 } | 700 } |
716 | 701 |
717 | 702 |
718 #undef __ | 703 #undef __ |
719 } | 704 } |
720 } // namespace v8::internal | 705 } // namespace v8::internal |
721 | 706 |
722 #endif // V8_TARGET_ARCH_IA32 | 707 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |