| 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 NameDictionary::kNotFound); | 768 NameDictionary::kNotFound); |
| 769 | 769 |
| 770 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, | 770 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, |
| 771 scratch1, scratch2); | 771 scratch1, scratch2); |
| 772 | 772 |
| 773 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 773 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 774 reg = holder_reg; // From now on the object will be in holder_reg. | 774 reg = holder_reg; // From now on the object will be in holder_reg. |
| 775 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 775 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| 776 } else { | 776 } else { |
| 777 bool in_new_space = heap()->InNewSpace(*prototype); | 777 bool in_new_space = heap()->InNewSpace(*prototype); |
| 778 if (in_new_space) { | 778 // Two possible reasons for loading the prototype from the map: |
| 779 // (1) Can't store references to new space in code. |
| 780 // (2) Handler is shared for all receivers with the same prototype |
| 781 // map (but not necessarily the same prototype instance). |
| 782 bool load_prototype_from_map = in_new_space || depth == 1; |
| 783 if (load_prototype_from_map) { |
| 779 // Save the map in scratch1 for later. | 784 // Save the map in scratch1 for later. |
| 780 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 785 __ movp(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 781 } | 786 } |
| 782 if (depth != 1 || check == CHECK_ALL_MAPS) { | 787 if (depth != 1 || check == CHECK_ALL_MAPS) { |
| 783 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); | 788 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); |
| 784 } | 789 } |
| 785 | 790 |
| 786 // Check access rights to the global object. This has to happen after | 791 // Check access rights to the global object. This has to happen after |
| 787 // the map check so that we know that the object is actually a global | 792 // the map check so that we know that the object is actually a global |
| 788 // object. | 793 // object. |
| 789 if (current_map->IsJSGlobalProxyMap()) { | 794 if (current_map->IsJSGlobalProxyMap()) { |
| 790 __ CheckAccessGlobalProxy(reg, scratch2, miss); | 795 __ CheckAccessGlobalProxy(reg, scratch2, miss); |
| 791 } else if (current_map->IsJSGlobalObjectMap()) { | 796 } else if (current_map->IsJSGlobalObjectMap()) { |
| 792 GenerateCheckPropertyCell( | 797 GenerateCheckPropertyCell( |
| 793 masm(), Handle<JSGlobalObject>::cast(current), name, | 798 masm(), Handle<JSGlobalObject>::cast(current), name, |
| 794 scratch2, miss); | 799 scratch2, miss); |
| 795 } | 800 } |
| 796 reg = holder_reg; // From now on the object will be in holder_reg. | 801 reg = holder_reg; // From now on the object will be in holder_reg. |
| 797 | 802 |
| 798 if (in_new_space) { | 803 if (load_prototype_from_map) { |
| 799 // The prototype is in new space; we cannot store a reference to it | |
| 800 // in the code. Load it from the map. | |
| 801 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 804 __ movp(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| 802 } else { | 805 } else { |
| 803 // The prototype is in old space; load it directly. | |
| 804 __ Move(reg, prototype); | 806 __ Move(reg, prototype); |
| 805 } | 807 } |
| 806 } | 808 } |
| 807 | 809 |
| 808 // Go to the next object in the prototype chain. | 810 // Go to the next object in the prototype chain. |
| 809 current = prototype; | 811 current = prototype; |
| 810 current_map = handle(current->map()); | 812 current_map = handle(current->map()); |
| 811 } | 813 } |
| 812 | 814 |
| 813 // Log the check depth. | 815 // Log the check depth. |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 // ----------------------------------- | 1443 // ----------------------------------- |
| 1442 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1444 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1443 } | 1445 } |
| 1444 | 1446 |
| 1445 | 1447 |
| 1446 #undef __ | 1448 #undef __ |
| 1447 | 1449 |
| 1448 } } // namespace v8::internal | 1450 } } // namespace v8::internal |
| 1449 | 1451 |
| 1450 #endif // V8_TARGET_ARCH_X64 | 1452 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |