| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic-inl.h" | 10 #include "src/ic-inl.h" |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 (current->property_dictionary()->FindEntry(name) == | 816 (current->property_dictionary()->FindEntry(name) == |
| 817 NameDictionary::kNotFound)); | 817 NameDictionary::kNotFound)); |
| 818 | 818 |
| 819 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, | 819 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, |
| 820 scratch1, scratch2); | 820 scratch1, scratch2); |
| 821 | 821 |
| 822 __ Ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); | 822 __ Ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 823 reg = holder_reg; // From now on the object will be in holder_reg. | 823 reg = holder_reg; // From now on the object will be in holder_reg. |
| 824 __ Ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); | 824 __ Ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); |
| 825 } else { | 825 } else { |
| 826 bool need_map = (depth != 1 || check == CHECK_ALL_MAPS) || | 826 // Two possible reasons for loading the prototype from the map: |
| 827 heap()->InNewSpace(*prototype); | 827 // (1) Can't store references to new space in code. |
| 828 Register map_reg = NoReg; | 828 // (2) Handler is shared for all receivers with the same prototype |
| 829 if (need_map) { | 829 // map (but not necessarily the same prototype instance). |
| 830 map_reg = scratch1; | 830 bool load_prototype_from_map = |
| 831 __ Ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); | 831 heap()->InNewSpace(*prototype) || depth == 1; |
| 832 } | 832 Register map_reg = scratch1; |
| 833 __ Ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 833 | 834 |
| 834 if (depth != 1 || check == CHECK_ALL_MAPS) { | 835 if (depth != 1 || check == CHECK_ALL_MAPS) { |
| 835 __ CheckMap(map_reg, current_map, miss, DONT_DO_SMI_CHECK); | 836 __ CheckMap(map_reg, current_map, miss, DONT_DO_SMI_CHECK); |
| 836 } | 837 } |
| 837 | 838 |
| 838 // Check access rights to the global object. This has to happen after | 839 // Check access rights to the global object. This has to happen after |
| 839 // the map check so that we know that the object is actually a global | 840 // the map check so that we know that the object is actually a global |
| 840 // object. | 841 // object. |
| 841 if (current_map->IsJSGlobalProxyMap()) { | 842 if (current_map->IsJSGlobalProxyMap()) { |
| 842 UseScratchRegisterScope temps(masm()); | 843 UseScratchRegisterScope temps(masm()); |
| 843 __ CheckAccessGlobalProxy(reg, scratch2, temps.AcquireX(), miss); | 844 __ CheckAccessGlobalProxy(reg, scratch2, temps.AcquireX(), miss); |
| 844 } else if (current_map->IsJSGlobalObjectMap()) { | 845 } else if (current_map->IsJSGlobalObjectMap()) { |
| 845 GenerateCheckPropertyCell( | 846 GenerateCheckPropertyCell( |
| 846 masm(), Handle<JSGlobalObject>::cast(current), name, | 847 masm(), Handle<JSGlobalObject>::cast(current), name, |
| 847 scratch2, miss); | 848 scratch2, miss); |
| 848 } | 849 } |
| 849 | 850 |
| 850 reg = holder_reg; // From now on the object will be in holder_reg. | 851 reg = holder_reg; // From now on the object will be in holder_reg. |
| 851 | 852 |
| 852 if (heap()->InNewSpace(*prototype)) { | 853 if (load_prototype_from_map) { |
| 853 // The prototype is in new space; we cannot store a reference to it | |
| 854 // in the code. Load it from the map. | |
| 855 __ Ldr(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); | 854 __ Ldr(reg, FieldMemOperand(map_reg, Map::kPrototypeOffset)); |
| 856 } else { | 855 } else { |
| 857 // The prototype is in old space; load it directly. | |
| 858 __ Mov(reg, Operand(prototype)); | 856 __ Mov(reg, Operand(prototype)); |
| 859 } | 857 } |
| 860 } | 858 } |
| 861 | 859 |
| 862 // Go to the next object in the prototype chain. | 860 // Go to the next object in the prototype chain. |
| 863 current = prototype; | 861 current = prototype; |
| 864 current_map = handle(current->map()); | 862 current_map = handle(current->map()); |
| 865 } | 863 } |
| 866 | 864 |
| 867 // Log the check depth. | 865 // Log the check depth. |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 | 1475 |
| 1478 // Miss case, call the runtime. | 1476 // Miss case, call the runtime. |
| 1479 __ Bind(&miss); | 1477 __ Bind(&miss); |
| 1480 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1478 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1481 } | 1479 } |
| 1482 | 1480 |
| 1483 | 1481 |
| 1484 } } // namespace v8::internal | 1482 } } // namespace v8::internal |
| 1485 | 1483 |
| 1486 #endif // V8_TARGET_ARCH_ARM64 | 1484 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |