OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 857 |
858 __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 858 __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
859 reg = holder_reg; // From now on the object will be in holder_reg. | 859 reg = holder_reg; // From now on the object will be in holder_reg. |
860 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 860 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
861 } else { | 861 } else { |
862 bool in_new_space = heap()->InNewSpace(*prototype); | 862 bool in_new_space = heap()->InNewSpace(*prototype); |
863 Handle<Map> current_map(current->map()); | 863 Handle<Map> current_map(current->map()); |
864 if (in_new_space) { | 864 if (in_new_space) { |
865 // Save the map in scratch1 for later. | 865 // Save the map in scratch1 for later. |
866 __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 866 __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 867 __ Cmp(scratch1, current_map); |
| 868 } else { |
| 869 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), current_map); |
867 } | 870 } |
868 __ CheckMap(reg, Handle<Map>(current_map), | 871 // Branch on the result of the map check. |
869 miss, DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); | 872 __ j(not_equal, miss); |
870 | |
871 // Check access rights to the global object. This has to happen after | 873 // Check access rights to the global object. This has to happen after |
872 // the map check so that we know that the object is actually a global | 874 // the map check so that we know that the object is actually a global |
873 // object. | 875 // object. |
874 if (current->IsJSGlobalProxy()) { | 876 if (current->IsJSGlobalProxy()) { |
875 __ CheckAccessGlobalProxy(reg, scratch2, miss); | 877 __ CheckAccessGlobalProxy(reg, scratch2, miss); |
876 } | 878 } |
877 reg = holder_reg; // From now on the object will be in holder_reg. | 879 reg = holder_reg; // From now on the object will be in holder_reg. |
878 | 880 |
879 if (in_new_space) { | 881 if (in_new_space) { |
880 // The prototype is in new space; we cannot store a reference to it | 882 // The prototype is in new space; we cannot store a reference to it |
(...skipping 11 matching lines...) Expand all Loading... |
892 | 894 |
893 // Go to the next object in the prototype chain. | 895 // Go to the next object in the prototype chain. |
894 current = prototype; | 896 current = prototype; |
895 } | 897 } |
896 ASSERT(current.is_identical_to(holder)); | 898 ASSERT(current.is_identical_to(holder)); |
897 | 899 |
898 // Log the check depth. | 900 // Log the check depth. |
899 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 901 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
900 | 902 |
901 // Check the holder map. | 903 // Check the holder map. |
902 __ CheckMap(reg, Handle<Map>(holder->map()), | 904 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), Handle<Map>(holder->map())); |
903 miss, DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); | 905 __ j(not_equal, miss); |
904 | 906 |
905 // Perform security check for access to the global object. | 907 // Perform security check for access to the global object. |
906 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); | 908 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); |
907 if (current->IsJSGlobalProxy()) { | 909 if (current->IsJSGlobalProxy()) { |
908 __ CheckAccessGlobalProxy(reg, scratch1, miss); | 910 __ CheckAccessGlobalProxy(reg, scratch1, miss); |
909 } | 911 } |
910 | 912 |
911 // If we've skipped any global objects, it's not enough to verify that | 913 // If we've skipped any global objects, it's not enough to verify that |
912 // their maps haven't changed. We also need to check that the property | 914 // their maps haven't changed. We also need to check that the property |
913 // cell for the property is still empty. | 915 // cell for the property is still empty. |
(...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3598 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 3600 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
3599 __ jmp(ic_miss, RelocInfo::CODE_TARGET); | 3601 __ jmp(ic_miss, RelocInfo::CODE_TARGET); |
3600 } | 3602 } |
3601 | 3603 |
3602 | 3604 |
3603 #undef __ | 3605 #undef __ |
3604 | 3606 |
3605 } } // namespace v8::internal | 3607 } } // namespace v8::internal |
3606 | 3608 |
3607 #endif // V8_TARGET_ARCH_X64 | 3609 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |