| 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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 // If the "property" we were looking for is a local variable, the | 904 // If the "property" we were looking for is a local variable, the |
| 905 // receiver is the global object; see ECMA-262, 3rd., 10.1.6 and 10.2.3. | 905 // receiver is the global object; see ECMA-262, 3rd., 10.1.6 and 10.2.3. |
| 906 Handle<Object> receiver = isolate->factory()->undefined_value(); | 906 Handle<Object> receiver = isolate->factory()->undefined_value(); |
| 907 Object* value = Context::cast(*holder)->get(index); | 907 Object* value = Context::cast(*holder)->get(index); |
| 908 // Check for uninitialized bindings. | 908 // Check for uninitialized bindings. |
| 909 switch (binding_flags) { | 909 switch (binding_flags) { |
| 910 case MUTABLE_CHECK_INITIALIZED: | 910 case MUTABLE_CHECK_INITIALIZED: |
| 911 case IMMUTABLE_CHECK_INITIALIZED_HARMONY: | 911 case IMMUTABLE_CHECK_INITIALIZED_HARMONY: |
| 912 if (value->IsTheHole()) { | 912 if (value->IsTheHole()) { |
| 913 Handle<Object> error = isolate->factory()->NewReferenceError( | 913 Handle<Object> error = isolate->factory()->NewReferenceError( |
| 914 "not_defined", HandleVector(&name, 1)); | 914 MessageTemplate::kNotDefined, name); |
| 915 isolate->Throw(*error); | 915 isolate->Throw(*error); |
| 916 return MakePair(isolate->heap()->exception(), NULL); | 916 return MakePair(isolate->heap()->exception(), NULL); |
| 917 } | 917 } |
| 918 // FALLTHROUGH | 918 // FALLTHROUGH |
| 919 case MUTABLE_IS_INITIALIZED: | 919 case MUTABLE_IS_INITIALIZED: |
| 920 case IMMUTABLE_IS_INITIALIZED: | 920 case IMMUTABLE_IS_INITIALIZED: |
| 921 case IMMUTABLE_IS_INITIALIZED_HARMONY: | 921 case IMMUTABLE_IS_INITIALIZED_HARMONY: |
| 922 DCHECK(!value->IsTheHole()); | 922 DCHECK(!value->IsTheHole()); |
| 923 return MakePair(value, *receiver); | 923 return MakePair(value, *receiver); |
| 924 case IMMUTABLE_CHECK_INITIALIZED: | 924 case IMMUTABLE_CHECK_INITIALIZED: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 952 Handle<Object> value; | 952 Handle<Object> value; |
| 953 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 953 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 954 isolate, value, Object::GetProperty(object, name), | 954 isolate, value, Object::GetProperty(object, name), |
| 955 MakePair(isolate->heap()->exception(), NULL)); | 955 MakePair(isolate->heap()->exception(), NULL)); |
| 956 return MakePair(*value, *receiver_handle); | 956 return MakePair(*value, *receiver_handle); |
| 957 } | 957 } |
| 958 | 958 |
| 959 if (throw_error) { | 959 if (throw_error) { |
| 960 // The property doesn't exist - throw exception. | 960 // The property doesn't exist - throw exception. |
| 961 Handle<Object> error = isolate->factory()->NewReferenceError( | 961 Handle<Object> error = isolate->factory()->NewReferenceError( |
| 962 "not_defined", HandleVector(&name, 1)); | 962 MessageTemplate::kNotDefined, name); |
| 963 isolate->Throw(*error); | 963 isolate->Throw(*error); |
| 964 return MakePair(isolate->heap()->exception(), NULL); | 964 return MakePair(isolate->heap()->exception(), NULL); |
| 965 } else { | 965 } else { |
| 966 // The property doesn't exist - return undefined. | 966 // The property doesn't exist - return undefined. |
| 967 return MakePair(isolate->heap()->undefined_value(), | 967 return MakePair(isolate->heap()->undefined_value(), |
| 968 isolate->heap()->undefined_value()); | 968 isolate->heap()->undefined_value()); |
| 969 } | 969 } |
| 970 } | 970 } |
| 971 | 971 |
| 972 | 972 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 // Slow case: The property is not in a context slot. It is either in a | 1014 // Slow case: The property is not in a context slot. It is either in a |
| 1015 // context extension object, a property of the subject of a with, or a | 1015 // context extension object, a property of the subject of a with, or a |
| 1016 // property of the global object. | 1016 // property of the global object. |
| 1017 Handle<JSReceiver> object; | 1017 Handle<JSReceiver> object; |
| 1018 if (attributes != ABSENT) { | 1018 if (attributes != ABSENT) { |
| 1019 // The property exists on the holder. | 1019 // The property exists on the holder. |
| 1020 object = Handle<JSReceiver>::cast(holder); | 1020 object = Handle<JSReceiver>::cast(holder); |
| 1021 } else if (is_strict(language_mode)) { | 1021 } else if (is_strict(language_mode)) { |
| 1022 // If absent in strict mode: throw. | 1022 // If absent in strict mode: throw. |
| 1023 THROW_NEW_ERROR_RETURN_FAILURE( | 1023 THROW_NEW_ERROR_RETURN_FAILURE( |
| 1024 isolate, NewReferenceError("not_defined", HandleVector(&name, 1))); | 1024 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); |
| 1025 } else { | 1025 } else { |
| 1026 // If absent in sloppy mode: add the property to the global object. | 1026 // If absent in sloppy mode: add the property to the global object. |
| 1027 object = Handle<JSReceiver>(context->global_object()); | 1027 object = Handle<JSReceiver>(context->global_object()); |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 RETURN_FAILURE_ON_EXCEPTION( | 1030 RETURN_FAILURE_ON_EXCEPTION( |
| 1031 isolate, Object::SetProperty(object, name, value, language_mode)); | 1031 isolate, Object::SetProperty(object, name, value, language_mode)); |
| 1032 | 1032 |
| 1033 return *value; | 1033 return *value; |
| 1034 } | 1034 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 return Smi::FromInt(frame->GetArgumentsLength()); | 1120 return Smi::FromInt(frame->GetArgumentsLength()); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 | 1123 |
| 1124 RUNTIME_FUNCTION(Runtime_Arguments) { | 1124 RUNTIME_FUNCTION(Runtime_Arguments) { |
| 1125 SealHandleScope shs(isolate); | 1125 SealHandleScope shs(isolate); |
| 1126 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1126 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
| 1127 } | 1127 } |
| 1128 } | 1128 } |
| 1129 } // namespace v8::internal | 1129 } // namespace v8::internal |
| OLD | NEW |