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