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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 BindingFlags binding_flags; | 1019 BindingFlags binding_flags; |
1020 Handle<Object> holder = | 1020 Handle<Object> holder = |
1021 context->Lookup(name, flags, &index, &attributes, &binding_flags); | 1021 context->Lookup(name, flags, &index, &attributes, &binding_flags); |
1022 if (holder.is_null()) { | 1022 if (holder.is_null()) { |
1023 // In case of JSProxy, an exception might have been thrown. | 1023 // In case of JSProxy, an exception might have been thrown. |
1024 if (isolate->has_pending_exception()) return isolate->heap()->exception(); | 1024 if (isolate->has_pending_exception()) return isolate->heap()->exception(); |
1025 } | 1025 } |
1026 | 1026 |
1027 // The property was found in a context slot. | 1027 // The property was found in a context slot. |
1028 if (index >= 0) { | 1028 if (index >= 0) { |
| 1029 if ((binding_flags == MUTABLE_CHECK_INITIALIZED || |
| 1030 binding_flags == IMMUTABLE_CHECK_INITIALIZED_HARMONY) && |
| 1031 Handle<Context>::cast(holder)->is_the_hole(index)) { |
| 1032 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1033 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); |
| 1034 } |
1029 if ((attributes & READ_ONLY) == 0) { | 1035 if ((attributes & READ_ONLY) == 0) { |
1030 Handle<Context>::cast(holder)->set(index, *value); | 1036 Handle<Context>::cast(holder)->set(index, *value); |
1031 } else if (is_strict(language_mode)) { | 1037 } else if (is_strict(language_mode)) { |
1032 // Setting read only property in strict mode. | 1038 // Setting read only property in strict mode. |
1033 THROW_NEW_ERROR_RETURN_FAILURE( | 1039 THROW_NEW_ERROR_RETURN_FAILURE( |
1034 isolate, NewTypeError(MessageTemplate::kStrictCannotAssign, name)); | 1040 isolate, NewTypeError(MessageTemplate::kStrictCannotAssign, name)); |
1035 } | 1041 } |
1036 return *value; | 1042 return *value; |
1037 } | 1043 } |
1038 | 1044 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 return Smi::FromInt(frame->GetArgumentsLength()); | 1150 return Smi::FromInt(frame->GetArgumentsLength()); |
1145 } | 1151 } |
1146 | 1152 |
1147 | 1153 |
1148 RUNTIME_FUNCTION(Runtime_Arguments) { | 1154 RUNTIME_FUNCTION(Runtime_Arguments) { |
1149 SealHandleScope shs(isolate); | 1155 SealHandleScope shs(isolate); |
1150 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1156 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
1151 } | 1157 } |
1152 } // namespace internal | 1158 } // namespace internal |
1153 } // namespace v8 | 1159 } // namespace v8 |
OLD | NEW |