Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 952483002: NewError no longer returns a MaybeObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@reland
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/runtime/runtime-utils.h" 10 #include "src/runtime/runtime-utils.h"
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 DCHECK(holder->IsContext()); 898 DCHECK(holder->IsContext());
899 // If the "property" we were looking for is a local variable, the 899 // If the "property" we were looking for is a local variable, the
900 // receiver is the global object; see ECMA-262, 3rd., 10.1.6 and 10.2.3. 900 // receiver is the global object; see ECMA-262, 3rd., 10.1.6 and 10.2.3.
901 Handle<Object> receiver = isolate->factory()->undefined_value(); 901 Handle<Object> receiver = isolate->factory()->undefined_value();
902 Object* value = Context::cast(*holder)->get(index); 902 Object* value = Context::cast(*holder)->get(index);
903 // Check for uninitialized bindings. 903 // Check for uninitialized bindings.
904 switch (binding_flags) { 904 switch (binding_flags) {
905 case MUTABLE_CHECK_INITIALIZED: 905 case MUTABLE_CHECK_INITIALIZED:
906 case IMMUTABLE_CHECK_INITIALIZED_HARMONY: 906 case IMMUTABLE_CHECK_INITIALIZED_HARMONY:
907 if (value->IsTheHole()) { 907 if (value->IsTheHole()) {
908 Handle<Object> error; 908 Handle<Object> error = isolate->factory()->NewReferenceError(
909 MaybeHandle<Object> maybe_error = 909 "not_defined", HandleVector(&name, 1));
910 isolate->factory()->NewReferenceError("not_defined", 910 isolate->Throw(*error);
911 HandleVector(&name, 1));
912 if (maybe_error.ToHandle(&error)) isolate->Throw(*error);
913 return MakePair(isolate->heap()->exception(), NULL); 911 return MakePair(isolate->heap()->exception(), NULL);
914 } 912 }
915 // FALLTHROUGH 913 // FALLTHROUGH
916 case MUTABLE_IS_INITIALIZED: 914 case MUTABLE_IS_INITIALIZED:
917 case IMMUTABLE_IS_INITIALIZED: 915 case IMMUTABLE_IS_INITIALIZED:
918 case IMMUTABLE_IS_INITIALIZED_HARMONY: 916 case IMMUTABLE_IS_INITIALIZED_HARMONY:
919 DCHECK(!value->IsTheHole()); 917 DCHECK(!value->IsTheHole());
920 return MakePair(value, *receiver); 918 return MakePair(value, *receiver);
921 case IMMUTABLE_CHECK_INITIALIZED: 919 case IMMUTABLE_CHECK_INITIALIZED:
922 if (value->IsTheHole()) { 920 if (value->IsTheHole()) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 // GetProperty function. 953 // GetProperty function.
956 Handle<Object> value; 954 Handle<Object> value;
957 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 955 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
958 isolate, value, Object::GetProperty(object, name), 956 isolate, value, Object::GetProperty(object, name),
959 MakePair(isolate->heap()->exception(), NULL)); 957 MakePair(isolate->heap()->exception(), NULL));
960 return MakePair(*value, *receiver_handle); 958 return MakePair(*value, *receiver_handle);
961 } 959 }
962 960
963 if (throw_error) { 961 if (throw_error) {
964 // The property doesn't exist - throw exception. 962 // The property doesn't exist - throw exception.
965 Handle<Object> error; 963 Handle<Object> error = isolate->factory()->NewReferenceError(
966 MaybeHandle<Object> maybe_error = isolate->factory()->NewReferenceError(
967 "not_defined", HandleVector(&name, 1)); 964 "not_defined", HandleVector(&name, 1));
968 if (maybe_error.ToHandle(&error)) isolate->Throw(*error); 965 isolate->Throw(*error);
969 return MakePair(isolate->heap()->exception(), NULL); 966 return MakePair(isolate->heap()->exception(), NULL);
970 } else { 967 } else {
971 // The property doesn't exist - return undefined. 968 // The property doesn't exist - return undefined.
972 return MakePair(isolate->heap()->undefined_value(), 969 return MakePair(isolate->heap()->undefined_value(),
973 isolate->heap()->undefined_value()); 970 isolate->heap()->undefined_value());
974 } 971 }
975 } 972 }
976 973
977 974
978 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlot) { 975 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlot) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 return Smi::FromInt(frame->GetArgumentsLength()); 1122 return Smi::FromInt(frame->GetArgumentsLength());
1126 } 1123 }
1127 1124
1128 1125
1129 RUNTIME_FUNCTION(RuntimeReference_Arguments) { 1126 RUNTIME_FUNCTION(RuntimeReference_Arguments) {
1130 SealHandleScope shs(isolate); 1127 SealHandleScope shs(isolate);
1131 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); 1128 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate);
1132 } 1129 }
1133 } 1130 }
1134 } // namespace v8::internal 1131 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698