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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 DCHECK(current.is_null() || (current->property_dictionary()->FindEntry( | 450 DCHECK(current.is_null() || (current->property_dictionary()->FindEntry( |
451 name) == NameDictionary::kNotFound)); | 451 name) == NameDictionary::kNotFound)); |
452 | 452 |
453 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, | 453 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, scratch1, |
454 scratch2); | 454 scratch2); |
455 | 455 |
456 __ Ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); | 456 __ Ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); |
457 reg = holder_reg; // From now on the object will be in holder_reg. | 457 reg = holder_reg; // From now on the object will be in holder_reg. |
458 __ Ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); | 458 __ Ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); |
459 } else { | 459 } else { |
460 // Two possible reasons for loading the prototype from the map: | |
461 // (1) Can't store references to new space in code. | |
462 // (2) Handler is shared for all receivers with the same prototype | |
463 // map (but not necessarily the same prototype instance). | |
464 bool load_prototype_from_map = | |
465 heap()->InNewSpace(*prototype) || depth == 1; | |
466 Register map_reg = scratch1; | 460 Register map_reg = scratch1; |
467 __ Ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); | 461 __ Ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
468 | 462 |
469 if (depth != 1 || check == CHECK_ALL_MAPS) { | 463 if (depth != 1 || check == CHECK_ALL_MAPS) { |
470 __ CheckMap(map_reg, current_map, miss, DONT_DO_SMI_CHECK); | 464 __ CheckMap(map_reg, current_map, miss, DONT_DO_SMI_CHECK); |
471 } | 465 } |
472 | 466 |
473 // Check access rights to the global object. This has to happen after | 467 // Check access rights to the global object. This has to happen after |
474 // the map check so that we know that the object is actually a global | 468 // the map check so that we know that the object is actually a global |
475 // object. | 469 // object. |
476 // This allows us to install generated handlers for accesses to the | 470 // This allows us to install generated handlers for accesses to the |
477 // global proxy (as opposed to using slow ICs). See corresponding code | 471 // global proxy (as opposed to using slow ICs). See corresponding code |
478 // in LookupForRead(). | 472 // in LookupForRead(). |
479 if (current_map->IsJSGlobalProxyMap()) { | 473 if (current_map->IsJSGlobalProxyMap()) { |
480 UseScratchRegisterScope temps(masm()); | 474 UseScratchRegisterScope temps(masm()); |
481 __ CheckAccessGlobalProxy(reg, scratch2, temps.AcquireX(), miss); | 475 __ CheckAccessGlobalProxy(reg, scratch2, temps.AcquireX(), miss); |
482 } else if (current_map->IsJSGlobalObjectMap()) { | 476 } else if (current_map->IsJSGlobalObjectMap()) { |
483 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), | 477 GenerateCheckPropertyCell(masm(), Handle<JSGlobalObject>::cast(current), |
484 name, scratch2, miss); | 478 name, scratch2, miss); |
485 } | 479 } |
486 | 480 |
487 reg = holder_reg; // From now on the object will be in holder_reg. | 481 reg = holder_reg; // From now on the object will be in holder_reg. |
488 | 482 |
489 if (load_prototype_from_map) { | 483 __ Ldr(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); |
490 __ Ldr(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); | |
491 } else { | |
492 __ Mov(reg, Operand(prototype)); | |
493 } | |
494 } | 484 } |
495 | 485 |
496 // Go to the next object in the prototype chain. | 486 // Go to the next object in the prototype chain. |
497 current = prototype; | 487 current = prototype; |
498 current_map = handle(current->map()); | 488 current_map = handle(current->map()); |
499 } | 489 } |
500 | 490 |
501 // Log the check depth. | 491 // Log the check depth. |
502 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 492 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
503 | 493 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 // Return the generated code. | 693 // Return the generated code. |
704 return GetCode(kind(), Code::FAST, name); | 694 return GetCode(kind(), Code::FAST, name); |
705 } | 695 } |
706 | 696 |
707 | 697 |
708 #undef __ | 698 #undef __ |
709 } | 699 } |
710 } // namespace v8::internal | 700 } // namespace v8::internal |
711 | 701 |
712 #endif // V8_TARGET_ARCH_IA32 | 702 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |