| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 NameDictionary::kNotFound); | 815 NameDictionary::kNotFound); |
| 816 | 816 |
| 817 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, | 817 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, |
| 818 scratch1, scratch2); | 818 scratch1, scratch2); |
| 819 | 819 |
| 820 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 820 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 821 reg = holder_reg; // From now on the object will be in holder_reg. | 821 reg = holder_reg; // From now on the object will be in holder_reg. |
| 822 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 822 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| 823 } else { | 823 } else { |
| 824 bool in_new_space = heap()->InNewSpace(*prototype); | 824 bool in_new_space = heap()->InNewSpace(*prototype); |
| 825 // Two possible reasons for loading the prototype from the map: |
| 826 // (1) Can't store references to new space in code. |
| 827 // (2) Handler is shared for all receivers with the same prototype |
| 828 // map (but not necessarily the same prototype instance). |
| 829 bool load_prototype_from_map = in_new_space || depth == 1; |
| 825 if (depth != 1 || check == CHECK_ALL_MAPS) { | 830 if (depth != 1 || check == CHECK_ALL_MAPS) { |
| 826 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); | 831 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); |
| 827 } | 832 } |
| 828 | 833 |
| 829 // Check access rights to the global object. This has to happen after | 834 // Check access rights to the global object. This has to happen after |
| 830 // the map check so that we know that the object is actually a global | 835 // the map check so that we know that the object is actually a global |
| 831 // object. | 836 // object. |
| 832 if (current_map->IsJSGlobalProxyMap()) { | 837 if (current_map->IsJSGlobalProxyMap()) { |
| 833 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); | 838 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); |
| 834 } else if (current_map->IsJSGlobalObjectMap()) { | 839 } else if (current_map->IsJSGlobalObjectMap()) { |
| 835 GenerateCheckPropertyCell( | 840 GenerateCheckPropertyCell( |
| 836 masm(), Handle<JSGlobalObject>::cast(current), name, | 841 masm(), Handle<JSGlobalObject>::cast(current), name, |
| 837 scratch2, miss); | 842 scratch2, miss); |
| 838 } | 843 } |
| 839 | 844 |
| 840 if (in_new_space) { | 845 if (load_prototype_from_map) { |
| 841 // Save the map in scratch1 for later. | 846 // Save the map in scratch1 for later. |
| 842 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 847 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 843 } | 848 } |
| 844 | 849 |
| 845 reg = holder_reg; // From now on the object will be in holder_reg. | 850 reg = holder_reg; // From now on the object will be in holder_reg. |
| 846 | 851 |
| 847 if (in_new_space) { | 852 if (load_prototype_from_map) { |
| 848 // The prototype is in new space; we cannot store a reference to it | |
| 849 // in the code. Load it from the map. | |
| 850 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 853 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| 851 } else { | 854 } else { |
| 852 // The prototype is in old space; load it directly. | |
| 853 __ mov(reg, prototype); | 855 __ mov(reg, prototype); |
| 854 } | 856 } |
| 855 } | 857 } |
| 856 | 858 |
| 857 // Go to the next object in the prototype chain. | 859 // Go to the next object in the prototype chain. |
| 858 current = prototype; | 860 current = prototype; |
| 859 current_map = handle(current->map()); | 861 current_map = handle(current->map()); |
| 860 } | 862 } |
| 861 | 863 |
| 862 // Log the check depth. | 864 // Log the check depth. |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 // ----------------------------------- | 1500 // ----------------------------------- |
| 1499 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1501 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1500 } | 1502 } |
| 1501 | 1503 |
| 1502 | 1504 |
| 1503 #undef __ | 1505 #undef __ |
| 1504 | 1506 |
| 1505 } } // namespace v8::internal | 1507 } } // namespace v8::internal |
| 1506 | 1508 |
| 1507 #endif // V8_TARGET_ARCH_X87 | 1509 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |