OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 Handle<Object> holder = | 896 Handle<Object> holder = |
897 context->Lookup(name, FOLLOW_CHAINS, &index, &attributes, &flag, &mode); | 897 context->Lookup(name, FOLLOW_CHAINS, &index, &attributes, &flag, &mode); |
898 if (holder.is_null()) { | 898 if (holder.is_null()) { |
899 // In case of JSProxy, an exception might have been thrown. | 899 // In case of JSProxy, an exception might have been thrown. |
900 if (isolate->has_pending_exception()) return MaybeHandle<Object>(); | 900 if (isolate->has_pending_exception()) return MaybeHandle<Object>(); |
901 } | 901 } |
902 | 902 |
903 // The property was found in a context slot. | 903 // The property was found in a context slot. |
904 if (index != Context::kNotFound) { | 904 if (index != Context::kNotFound) { |
905 if (flag == kNeedsInitialization && | 905 if (flag == kNeedsInitialization && |
906 Handle<Context>::cast(holder)->is_the_hole(index)) { | 906 Handle<Context>::cast(holder)->is_the_hole(isolate, index)) { |
907 THROW_NEW_ERROR(isolate, | 907 THROW_NEW_ERROR(isolate, |
908 NewReferenceError(MessageTemplate::kNotDefined, name), | 908 NewReferenceError(MessageTemplate::kNotDefined, name), |
909 Object); | 909 Object); |
910 } | 910 } |
911 if ((attributes & READ_ONLY) == 0) { | 911 if ((attributes & READ_ONLY) == 0) { |
912 Handle<Context>::cast(holder)->set(index, *value); | 912 Handle<Context>::cast(holder)->set(index, *value); |
913 } else if (is_strict(language_mode)) { | 913 } else if (is_strict(language_mode)) { |
914 // Setting read only property in strict mode. | 914 // Setting read only property in strict mode. |
915 THROW_NEW_ERROR(isolate, | 915 THROW_NEW_ERROR(isolate, |
916 NewTypeError(MessageTemplate::kStrictCannotAssign, name), | 916 NewTypeError(MessageTemplate::kStrictCannotAssign, name), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 956 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
957 HandleScope scope(isolate); | 957 HandleScope scope(isolate); |
958 DCHECK_EQ(2, args.length()); | 958 DCHECK_EQ(2, args.length()); |
959 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 959 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
960 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 960 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
961 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 961 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
962 } | 962 } |
963 | 963 |
964 } // namespace internal | 964 } // namespace internal |
965 } // namespace v8 | 965 } // namespace v8 |
OLD | NEW |