| 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 13451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16366 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16377 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16367 static const char* error_messages_[] = { | 16378 static const char* error_messages_[] = { |
| 16368 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16379 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16369 }; | 16380 }; |
| 16370 #undef ERROR_MESSAGES_TEXTS | 16381 #undef ERROR_MESSAGES_TEXTS |
| 16371 return error_messages_[reason]; | 16382 return error_messages_[reason]; |
| 16372 } | 16383 } |
| 16373 | 16384 |
| 16374 | 16385 |
| 16375 } } // namespace v8::internal | 16386 } } // namespace v8::internal |
| OLD | NEW |