| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 while (!current_map.is_identical_to(holder_map)) { | 703 while (!current_map.is_identical_to(holder_map)) { |
| 704 ++depth; | 704 ++depth; |
| 705 | 705 |
| 706 // Only global objects and objects that do not require access | 706 // Only global objects and objects that do not require access |
| 707 // checks are allowed in stubs. | 707 // checks are allowed in stubs. |
| 708 DCHECK(current_map->IsJSGlobalProxyMap() || | 708 DCHECK(current_map->IsJSGlobalProxyMap() || |
| 709 !current_map->is_access_check_needed()); | 709 !current_map->is_access_check_needed()); |
| 710 | 710 |
| 711 prototype = handle(JSObject::cast(current_map->prototype())); | 711 prototype = handle(JSObject::cast(current_map->prototype())); |
| 712 if (current_map->is_dictionary_map() && | 712 if (current_map->is_dictionary_map() && |
| 713 !current_map->IsJSGlobalObjectMap() && | 713 !current_map->IsJSGlobalObjectMap()) { |
| 714 !current_map->IsJSGlobalProxyMap()) { | 714 DCHECK(!current_map->IsJSGlobalProxyMap()); // Proxy maps are fast. |
| 715 if (!name->IsUniqueName()) { | 715 if (!name->IsUniqueName()) { |
| 716 DCHECK(name->IsString()); | 716 DCHECK(name->IsString()); |
| 717 name = factory()->InternalizeString(Handle<String>::cast(name)); | 717 name = factory()->InternalizeString(Handle<String>::cast(name)); |
| 718 } | 718 } |
| 719 DCHECK(current.is_null() || | 719 DCHECK(current.is_null() || |
| 720 current->property_dictionary()->FindEntry(name) == | 720 current->property_dictionary()->FindEntry(name) == |
| 721 NameDictionary::kNotFound); | 721 NameDictionary::kNotFound); |
| 722 | 722 |
| 723 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, | 723 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, |
| 724 scratch1, scratch2); | 724 scratch1, scratch2); |
| 725 | 725 |
| 726 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 726 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 727 reg = holder_reg; // From now on the object will be in holder_reg. | 727 reg = holder_reg; // From now on the object will be in holder_reg. |
| 728 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 728 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| 729 } else { | 729 } else { |
| 730 bool in_new_space = heap()->InNewSpace(*prototype); | 730 bool in_new_space = heap()->InNewSpace(*prototype); |
| 731 // Two possible reasons for loading the prototype from the map: | 731 // Two possible reasons for loading the prototype from the map: |
| 732 // (1) Can't store references to new space in code. | 732 // (1) Can't store references to new space in code. |
| 733 // (2) Handler is shared for all receivers with the same prototype | 733 // (2) Handler is shared for all receivers with the same prototype |
| 734 // map (but not necessarily the same prototype instance). | 734 // map (but not necessarily the same prototype instance). |
| 735 bool load_prototype_from_map = in_new_space || depth == 1; | 735 bool load_prototype_from_map = in_new_space || depth == 1; |
| 736 if (depth != 1 || check == CHECK_ALL_MAPS) { | 736 if (depth != 1 || check == CHECK_ALL_MAPS) { |
| 737 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); | 737 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); |
| 738 } | 738 } |
| 739 | 739 |
| 740 // Check access rights to the global object. This has to happen after | 740 // Check access rights to the global object. This has to happen after |
| 741 // the map check so that we know that the object is actually a global | 741 // the map check so that we know that the object is actually a global |
| 742 // object. | 742 // object. |
| 743 // This allows us to install generated handlers for accesses to the |
| 744 // global proxy (as opposed to using slow ICs). See corresponding code |
| 745 // in LookupForRead(). |
| 743 if (current_map->IsJSGlobalProxyMap()) { | 746 if (current_map->IsJSGlobalProxyMap()) { |
| 744 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); | 747 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); |
| 745 } else if (current_map->IsJSGlobalObjectMap()) { | 748 } else if (current_map->IsJSGlobalObjectMap()) { |
| 746 GenerateCheckPropertyCell( | 749 GenerateCheckPropertyCell( |
| 747 masm(), Handle<JSGlobalObject>::cast(current), name, | 750 masm(), Handle<JSGlobalObject>::cast(current), name, |
| 748 scratch2, miss); | 751 scratch2, miss); |
| 749 } | 752 } |
| 750 | 753 |
| 751 if (load_prototype_from_map) { | 754 if (load_prototype_from_map) { |
| 752 // Save the map in scratch1 for later. | 755 // Save the map in scratch1 for later. |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 // ----------------------------------- | 1357 // ----------------------------------- |
| 1355 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1358 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1356 } | 1359 } |
| 1357 | 1360 |
| 1358 | 1361 |
| 1359 #undef __ | 1362 #undef __ |
| 1360 | 1363 |
| 1361 } } // namespace v8::internal | 1364 } } // namespace v8::internal |
| 1362 | 1365 |
| 1363 #endif // V8_TARGET_ARCH_X87 | 1366 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |