| 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 Handle<Name> name, | 739 Handle<Name> name, |
| 740 Register receiver_reg, | 740 Register receiver_reg, |
| 741 Register name_reg, | 741 Register name_reg, |
| 742 Register value_reg, | 742 Register value_reg, |
| 743 Register scratch1, | 743 Register scratch1, |
| 744 Register scratch2, | 744 Register scratch2, |
| 745 Label* miss_label, | 745 Label* miss_label, |
| 746 Label* miss_restore_name) { | 746 Label* miss_restore_name) { |
| 747 // Check that the map of the object hasn't changed. | 747 // Check that the map of the object hasn't changed. |
| 748 __ CheckMap(receiver_reg, Handle<Map>(object->map()), | 748 __ CheckMap(receiver_reg, Handle<Map>(object->map()), |
| 749 miss_label, DO_SMI_CHECK, REQUIRE_EXACT_MAP); | 749 miss_label, DO_SMI_CHECK); |
| 750 | 750 |
| 751 // Perform global security token check if needed. | 751 // Perform global security token check if needed. |
| 752 if (object->IsJSGlobalProxy()) { | 752 if (object->IsJSGlobalProxy()) { |
| 753 __ CheckAccessGlobalProxy(receiver_reg, scratch1, miss_label); | 753 __ CheckAccessGlobalProxy(receiver_reg, scratch1, miss_label); |
| 754 } | 754 } |
| 755 | 755 |
| 756 // Check that we are allowed to write this. | 756 // Check that we are allowed to write this. |
| 757 if (object->GetPrototype()->IsJSObject()) { | 757 if (object->GetPrototype()->IsJSObject()) { |
| 758 JSObject* holder; | 758 JSObject* holder; |
| 759 // holder == object indicates that no property was found. | 759 // holder == object indicates that no property was found. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 Handle<JSObject> object, | 867 Handle<JSObject> object, |
| 868 LookupResult* lookup, | 868 LookupResult* lookup, |
| 869 Register receiver_reg, | 869 Register receiver_reg, |
| 870 Register name_reg, | 870 Register name_reg, |
| 871 Register value_reg, | 871 Register value_reg, |
| 872 Register scratch1, | 872 Register scratch1, |
| 873 Register scratch2, | 873 Register scratch2, |
| 874 Label* miss_label) { | 874 Label* miss_label) { |
| 875 // Check that the map of the object hasn't changed. | 875 // Check that the map of the object hasn't changed. |
| 876 __ CheckMap(receiver_reg, Handle<Map>(object->map()), | 876 __ CheckMap(receiver_reg, Handle<Map>(object->map()), |
| 877 miss_label, DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); | 877 miss_label, DO_SMI_CHECK); |
| 878 | 878 |
| 879 // Perform global security token check if needed. | 879 // Perform global security token check if needed. |
| 880 if (object->IsJSGlobalProxy()) { | 880 if (object->IsJSGlobalProxy()) { |
| 881 __ CheckAccessGlobalProxy(receiver_reg, scratch1, miss_label); | 881 __ CheckAccessGlobalProxy(receiver_reg, scratch1, miss_label); |
| 882 } | 882 } |
| 883 | 883 |
| 884 // Stub never generated for non-global objects that require access | 884 // Stub never generated for non-global objects that require access |
| 885 // checks. | 885 // checks. |
| 886 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 886 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 887 | 887 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 reg = holder_reg; // From now on the object will be in holder_reg. | 1008 reg = holder_reg; // From now on the object will be in holder_reg. |
| 1009 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); | 1009 __ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); |
| 1010 } else { | 1010 } else { |
| 1011 bool in_new_space = heap()->InNewSpace(*prototype); | 1011 bool in_new_space = heap()->InNewSpace(*prototype); |
| 1012 Handle<Map> current_map(current->map()); | 1012 Handle<Map> current_map(current->map()); |
| 1013 if (in_new_space) { | 1013 if (in_new_space) { |
| 1014 // Save the map in scratch1 for later. | 1014 // Save the map in scratch1 for later. |
| 1015 __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); | 1015 __ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
| 1016 } | 1016 } |
| 1017 if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) { | 1017 if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) { |
| 1018 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK, | 1018 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); |
| 1019 ALLOW_ELEMENT_TRANSITION_MAPS); | |
| 1020 } | 1019 } |
| 1021 | 1020 |
| 1022 // Check access rights to the global object. This has to happen after | 1021 // Check access rights to the global object. This has to happen after |
| 1023 // the map check so that we know that the object is actually a global | 1022 // the map check so that we know that the object is actually a global |
| 1024 // object. | 1023 // object. |
| 1025 if (current->IsJSGlobalProxy()) { | 1024 if (current->IsJSGlobalProxy()) { |
| 1026 __ CheckAccessGlobalProxy(reg, scratch2, miss); | 1025 __ CheckAccessGlobalProxy(reg, scratch2, miss); |
| 1027 } | 1026 } |
| 1028 reg = holder_reg; // From now on the object will be in holder_reg. | 1027 reg = holder_reg; // From now on the object will be in holder_reg. |
| 1029 | 1028 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1044 // Go to the next object in the prototype chain. | 1043 // Go to the next object in the prototype chain. |
| 1045 current = prototype; | 1044 current = prototype; |
| 1046 } | 1045 } |
| 1047 ASSERT(current.is_identical_to(holder)); | 1046 ASSERT(current.is_identical_to(holder)); |
| 1048 | 1047 |
| 1049 // Log the check depth. | 1048 // Log the check depth. |
| 1050 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); | 1049 LOG(isolate(), IntEvent("check-maps-depth", depth + 1)); |
| 1051 | 1050 |
| 1052 if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) { | 1051 if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) { |
| 1053 // Check the holder map. | 1052 // Check the holder map. |
| 1054 __ CheckMap(reg, Handle<Map>(holder->map()), | 1053 __ CheckMap(reg, Handle<Map>(holder->map()), miss, DONT_DO_SMI_CHECK); |
| 1055 miss, DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); | |
| 1056 } | 1054 } |
| 1057 | 1055 |
| 1058 // Perform security check for access to the global object. | 1056 // Perform security check for access to the global object. |
| 1059 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); | 1057 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); |
| 1060 if (current->IsJSGlobalProxy()) { | 1058 if (current->IsJSGlobalProxy()) { |
| 1061 __ CheckAccessGlobalProxy(reg, scratch1, miss); | 1059 __ CheckAccessGlobalProxy(reg, scratch1, miss); |
| 1062 } | 1060 } |
| 1063 | 1061 |
| 1064 // If we've skipped any global objects, it's not enough to verify that | 1062 // If we've skipped any global objects, it's not enough to verify that |
| 1065 // their maps haven't changed. We also need to check that the property | 1063 // their maps haven't changed. We also need to check that the property |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 #undef __ | 2522 #undef __ |
| 2525 #define __ ACCESS_MASM(masm()) | 2523 #define __ ACCESS_MASM(masm()) |
| 2526 | 2524 |
| 2527 | 2525 |
| 2528 Handle<Code> StoreStubCompiler::CompileStoreInterceptor( | 2526 Handle<Code> StoreStubCompiler::CompileStoreInterceptor( |
| 2529 Handle<JSObject> object, | 2527 Handle<JSObject> object, |
| 2530 Handle<Name> name) { | 2528 Handle<Name> name) { |
| 2531 Label miss; | 2529 Label miss; |
| 2532 | 2530 |
| 2533 // Check that the map of the object hasn't changed. | 2531 // Check that the map of the object hasn't changed. |
| 2534 __ CheckMap(receiver(), Handle<Map>(object->map()), &miss, | 2532 __ CheckMap(receiver(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK); |
| 2535 DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); | |
| 2536 | 2533 |
| 2537 // Perform global security token check if needed. | 2534 // Perform global security token check if needed. |
| 2538 if (object->IsJSGlobalProxy()) { | 2535 if (object->IsJSGlobalProxy()) { |
| 2539 __ CheckAccessGlobalProxy(receiver(), scratch1(), &miss); | 2536 __ CheckAccessGlobalProxy(receiver(), scratch1(), &miss); |
| 2540 } | 2537 } |
| 2541 | 2538 |
| 2542 // Stub never generated for non-global objects that require access | 2539 // Stub never generated for non-global objects that require access |
| 2543 // checks. | 2540 // checks. |
| 2544 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 2541 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 2545 | 2542 |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3470 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3467 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
| 3471 } | 3468 } |
| 3472 } | 3469 } |
| 3473 | 3470 |
| 3474 | 3471 |
| 3475 #undef __ | 3472 #undef __ |
| 3476 | 3473 |
| 3477 } } // namespace v8::internal | 3474 } } // namespace v8::internal |
| 3478 | 3475 |
| 3479 #endif // V8_TARGET_ARCH_X64 | 3476 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |