OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2800 StrictMode strict_mode, | 2800 StrictMode strict_mode, |
2801 StoreFromKeyed store_mode) { | 2801 StoreFromKeyed store_mode) { |
2802 LookupIterator it(object, name); | 2802 LookupIterator it(object, name); |
2803 return SetProperty(&it, value, strict_mode, store_mode); | 2803 return SetProperty(&it, value, strict_mode, store_mode); |
2804 } | 2804 } |
2805 | 2805 |
2806 | 2806 |
2807 MaybeHandle<Object> Object::SetProperty(LookupIterator* it, | 2807 MaybeHandle<Object> Object::SetProperty(LookupIterator* it, |
2808 Handle<Object> value, | 2808 Handle<Object> value, |
2809 StrictMode strict_mode, | 2809 StrictMode strict_mode, |
2810 StoreFromKeyed store_mode) { | 2810 StoreFromKeyed store_mode, |
| 2811 StorePropertyMode data_store_mode) { |
2811 // Make sure that the top context does not change when doing callbacks or | 2812 // Make sure that the top context does not change when doing callbacks or |
2812 // interceptor calls. | 2813 // interceptor calls. |
2813 AssertNoContextChange ncc(it->isolate()); | 2814 AssertNoContextChange ncc(it->isolate()); |
2814 | 2815 |
2815 bool done = false; | 2816 bool done = false; |
2816 for (; it->IsFound(); it->Next()) { | 2817 for (; it->IsFound(); it->Next()) { |
2817 switch (it->state()) { | 2818 switch (it->state()) { |
2818 case LookupIterator::NOT_FOUND: | 2819 case LookupIterator::NOT_FOUND: |
2819 UNREACHABLE(); | 2820 UNREACHABLE(); |
2820 | 2821 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 // If the receiver is the JSGlobalObject, the store was contextual. In case | 2896 // If the receiver is the JSGlobalObject, the store was contextual. In case |
2896 // the property did not exist yet on the global object itself, we have to | 2897 // the property did not exist yet on the global object itself, we have to |
2897 // throw a reference error in strict mode. | 2898 // throw a reference error in strict mode. |
2898 if (it->GetReceiver()->IsJSGlobalObject() && strict_mode == STRICT) { | 2899 if (it->GetReceiver()->IsJSGlobalObject() && strict_mode == STRICT) { |
2899 Handle<Object> args[1] = {it->name()}; | 2900 Handle<Object> args[1] = {it->name()}; |
2900 THROW_NEW_ERROR(it->isolate(), | 2901 THROW_NEW_ERROR(it->isolate(), |
2901 NewReferenceError("not_defined", HandleVector(args, 1)), | 2902 NewReferenceError("not_defined", HandleVector(args, 1)), |
2902 Object); | 2903 Object); |
2903 } | 2904 } |
2904 | 2905 |
| 2906 if (data_store_mode == SUPER_PROPERTY) { |
| 2907 if (strict_mode == STRICT) { |
| 2908 Handle<Object> args[1] = {it->name()}; |
| 2909 THROW_NEW_ERROR(it->isolate(), |
| 2910 NewReferenceError("not_defined", HandleVector(args, 1)), |
| 2911 Object); |
| 2912 } |
| 2913 return value; |
| 2914 } |
| 2915 |
2905 return AddDataProperty(it, value, NONE, strict_mode, store_mode); | 2916 return AddDataProperty(it, value, NONE, strict_mode, store_mode); |
2906 } | 2917 } |
2907 | 2918 |
2908 | 2919 |
2909 MaybeHandle<Object> Object::WriteToReadOnlyProperty(LookupIterator* it, | 2920 MaybeHandle<Object> Object::WriteToReadOnlyProperty(LookupIterator* it, |
2910 Handle<Object> value, | 2921 Handle<Object> value, |
2911 StrictMode strict_mode) { | 2922 StrictMode strict_mode) { |
2912 if (strict_mode != STRICT) return value; | 2923 if (strict_mode != STRICT) return value; |
2913 | 2924 |
2914 Handle<Object> args[] = {it->name(), it->GetReceiver()}; | 2925 Handle<Object> args[] = {it->name(), it->GetReceiver()}; |
(...skipping 13448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16363 Handle<DependentCode> codes = | 16374 Handle<DependentCode> codes = |
16364 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16375 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16365 DependentCode::kPropertyCellChangedGroup, | 16376 DependentCode::kPropertyCellChangedGroup, |
16366 info->object_wrapper()); | 16377 info->object_wrapper()); |
16367 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16378 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16368 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16379 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16369 cell, info->zone()); | 16380 cell, info->zone()); |
16370 } | 16381 } |
16371 | 16382 |
16372 } } // namespace v8::internal | 16383 } } // namespace v8::internal |
OLD | NEW |