OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 Label* miss_label, | 741 Label* miss_label, |
742 Label* miss_restore_name) { | 742 Label* miss_restore_name) { |
743 // Check that the map of the object hasn't changed. | 743 // Check that the map of the object hasn't changed. |
744 CompareMapMode mode = transition.is_null() ? ALLOW_ELEMENT_TRANSITION_MAPS | 744 CompareMapMode mode = transition.is_null() ? ALLOW_ELEMENT_TRANSITION_MAPS |
745 : REQUIRE_EXACT_MAP; | 745 : REQUIRE_EXACT_MAP; |
746 __ CheckMap(receiver_reg, Handle<Map>(object->map()), | 746 __ CheckMap(receiver_reg, Handle<Map>(object->map()), |
747 miss_label, DO_SMI_CHECK, mode); | 747 miss_label, DO_SMI_CHECK, mode); |
748 | 748 |
749 // Perform global security token check if needed. | 749 // Perform global security token check if needed. |
750 if (object->IsJSGlobalProxy()) { | 750 if (object->IsJSGlobalProxy()) { |
751 __ CheckAccessGlobalProxy(receiver_reg, scratch1, miss_label); | 751 __ CheckAccessGlobalProxy(receiver_reg, scratch1, scratch2, miss_label); |
752 } | 752 } |
753 | 753 |
754 // Check that we are allowed to write this. | 754 // Check that we are allowed to write this. |
755 if (!transition.is_null() && object->GetPrototype()->IsJSObject()) { | 755 if (!transition.is_null() && object->GetPrototype()->IsJSObject()) { |
756 JSObject* holder; | 756 JSObject* holder; |
757 // holder == object indicates that no property was found. | 757 // holder == object indicates that no property was found. |
758 if (lookup->holder() != *object) { | 758 if (lookup->holder() != *object) { |
759 holder = lookup->holder(); | 759 holder = lookup->holder(); |
760 } else { | 760 } else { |
761 // Find the top object. | 761 // Find the top object. |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 965 |
966 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, | 966 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, |
967 scratch1, scratch2); | 967 scratch1, scratch2); |
968 | 968 |
969 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 969 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
970 reg = holder_reg; // From now on the object will be in holder_reg. | 970 reg = holder_reg; // From now on the object will be in holder_reg. |
971 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 971 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
972 } else { | 972 } else { |
973 bool in_new_space = heap()->InNewSpace(*prototype); | 973 bool in_new_space = heap()->InNewSpace(*prototype); |
974 Handle<Map> current_map(current->map()); | 974 Handle<Map> current_map(current->map()); |
975 if (in_new_space) { | |
976 // Save the map in scratch1 for later. | |
977 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | |
978 } | |
979 if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) { | 975 if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) { |
980 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK, | 976 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK, |
981 ALLOW_ELEMENT_TRANSITION_MAPS); | 977 ALLOW_ELEMENT_TRANSITION_MAPS); |
982 } | 978 } |
983 | 979 |
984 // Check access rights to the global object. This has to happen after | 980 // Check access rights to the global object. This has to happen after |
985 // the map check so that we know that the object is actually a global | 981 // the map check so that we know that the object is actually a global |
986 // object. | 982 // object. |
987 if (current->IsJSGlobalProxy()) { | 983 if (current->IsJSGlobalProxy()) { |
988 __ CheckAccessGlobalProxy(reg, scratch2, miss); | 984 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); |
989 } | 985 } |
| 986 |
| 987 if (in_new_space) { |
| 988 // Save the map in scratch1 for later. |
| 989 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 990 } |
| 991 |
990 reg = holder_reg; // From now on the object will be in holder_reg. | 992 reg = holder_reg; // From now on the object will be in holder_reg. |
991 | 993 |
992 if (in_new_space) { | 994 if (in_new_space) { |
993 // The prototype is in new space; we cannot store a reference to it | 995 // The prototype is in new space; we cannot store a reference to it |
994 // in the code. Load it from the map. | 996 // in the code. Load it from the map. |
995 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 997 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
996 } else { | 998 } else { |
997 // The prototype is in old space; load it directly. | 999 // The prototype is in old space; load it directly. |
998 __ mov(reg, prototype); | 1000 __ mov(reg, prototype); |
999 } | 1001 } |
(...skipping 13 matching lines...) Expand all Loading... |
1013 | 1015 |
1014 if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) { | 1016 if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) { |
1015 // Check the holder map. | 1017 // Check the holder map. |
1016 __ CheckMap(reg, Handle<Map>(holder->map()), | 1018 __ CheckMap(reg, Handle<Map>(holder->map()), |
1017 miss, DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); | 1019 miss, DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); |
1018 } | 1020 } |
1019 | 1021 |
1020 // Perform security check for access to the global object. | 1022 // Perform security check for access to the global object. |
1021 ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded()); | 1023 ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded()); |
1022 if (holder->IsJSGlobalProxy()) { | 1024 if (holder->IsJSGlobalProxy()) { |
1023 __ CheckAccessGlobalProxy(reg, scratch1, miss); | 1025 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); |
1024 } | 1026 } |
1025 | 1027 |
1026 // If we've skipped any global objects, it's not enough to verify that | 1028 // If we've skipped any global objects, it's not enough to verify that |
1027 // their maps haven't changed. We also need to check that the property | 1029 // their maps haven't changed. We also need to check that the property |
1028 // cell for the property is still empty. | 1030 // cell for the property is still empty. |
1029 GenerateCheckPropertyCells(masm(), object, holder, name, scratch1, miss); | 1031 GenerateCheckPropertyCells(masm(), object, holder, name, scratch1, miss); |
1030 | 1032 |
1031 // Return the register containing the holder. | 1033 // Return the register containing the holder. |
1032 return reg; | 1034 return reg; |
1033 } | 1035 } |
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 Handle<JSObject> object, | 2652 Handle<JSObject> object, |
2651 Handle<Name> name) { | 2653 Handle<Name> name) { |
2652 Label miss; | 2654 Label miss; |
2653 | 2655 |
2654 // Check that the map of the object hasn't changed. | 2656 // Check that the map of the object hasn't changed. |
2655 __ CheckMap(receiver(), Handle<Map>(object->map()), | 2657 __ CheckMap(receiver(), Handle<Map>(object->map()), |
2656 &miss, DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); | 2658 &miss, DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); |
2657 | 2659 |
2658 // Perform global security token check if needed. | 2660 // Perform global security token check if needed. |
2659 if (object->IsJSGlobalProxy()) { | 2661 if (object->IsJSGlobalProxy()) { |
2660 __ CheckAccessGlobalProxy(edx, ebx, &miss); | 2662 __ CheckAccessGlobalProxy(receiver(), scratch1(), scratch2(), &miss); |
2661 } | 2663 } |
2662 | 2664 |
2663 // Stub never generated for non-global objects that require access | 2665 // Stub never generated for non-global objects that require access |
2664 // checks. | 2666 // checks. |
2665 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 2667 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
2666 | 2668 |
2667 __ pop(scratch1()); // remove the return address | 2669 __ pop(scratch1()); // remove the return address |
2668 __ push(receiver()); | 2670 __ push(receiver()); |
2669 __ push(this->name()); | 2671 __ push(this->name()); |
2670 __ push(value()); | 2672 __ push(value()); |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3627 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3629 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3628 } | 3630 } |
3629 } | 3631 } |
3630 | 3632 |
3631 | 3633 |
3632 #undef __ | 3634 #undef __ |
3633 | 3635 |
3634 } } // namespace v8::internal | 3636 } } // namespace v8::internal |
3635 | 3637 |
3636 #endif // V8_TARGET_ARCH_IA32 | 3638 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |