| 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 "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 // Determine if we need to assign to the variable if it already | 156 // Determine if we need to assign to the variable if it already |
| 157 // exists (based on the number of arguments). | 157 // exists (based on the number of arguments). |
| 158 RUNTIME_ASSERT(args.length() == 3); | 158 RUNTIME_ASSERT(args.length() == 3); |
| 159 | 159 |
| 160 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 160 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 161 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 1); | 161 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 1); |
| 162 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 162 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
| 163 | 163 |
| 164 Handle<JSGlobalObject> global(isolate->context()->global_object()); | 164 Handle<JSGlobalObject> global(isolate->context()->global_object()); |
| 165 Handle<Object> result; | 165 RETURN_RESULT_OR_FAILURE( |
| 166 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 166 isolate, Object::SetProperty(global, name, value, language_mode)); |
| 167 isolate, result, Object::SetProperty(global, name, value, language_mode)); | |
| 168 return *result; | |
| 169 } | 167 } |
| 170 | 168 |
| 171 | 169 |
| 172 RUNTIME_FUNCTION(Runtime_InitializeConstGlobal) { | 170 RUNTIME_FUNCTION(Runtime_InitializeConstGlobal) { |
| 173 HandleScope handle_scope(isolate); | 171 HandleScope handle_scope(isolate); |
| 174 // All constants are declared with an initial value. The name | 172 // All constants are declared with an initial value. The name |
| 175 // of the constant is the first argument and the initial value | 173 // of the constant is the first argument and the initial value |
| 176 // is the second. | 174 // is the second. |
| 177 RUNTIME_ASSERT(args.length() == 2); | 175 RUNTIME_ASSERT(args.length() == 2); |
| 178 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 176 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 return isolate->factory()->undefined_value(); | 914 return isolate->factory()->undefined_value(); |
| 917 } | 915 } |
| 918 | 916 |
| 919 } // namespace | 917 } // namespace |
| 920 | 918 |
| 921 | 919 |
| 922 RUNTIME_FUNCTION(Runtime_LoadLookupSlot) { | 920 RUNTIME_FUNCTION(Runtime_LoadLookupSlot) { |
| 923 HandleScope scope(isolate); | 921 HandleScope scope(isolate); |
| 924 DCHECK_EQ(1, args.length()); | 922 DCHECK_EQ(1, args.length()); |
| 925 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 923 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 926 Handle<Object> value; | 924 RETURN_RESULT_OR_FAILURE(isolate, |
| 927 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 925 LoadLookupSlot(name, Object::THROW_ON_ERROR)); |
| 928 isolate, value, LoadLookupSlot(name, Object::THROW_ON_ERROR)); | |
| 929 return *value; | |
| 930 } | 926 } |
| 931 | 927 |
| 932 | 928 |
| 933 RUNTIME_FUNCTION(Runtime_LoadLookupSlotInsideTypeof) { | 929 RUNTIME_FUNCTION(Runtime_LoadLookupSlotInsideTypeof) { |
| 934 HandleScope scope(isolate); | 930 HandleScope scope(isolate); |
| 935 DCHECK_EQ(1, args.length()); | 931 DCHECK_EQ(1, args.length()); |
| 936 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 932 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 937 Handle<Object> value; | 933 RETURN_RESULT_OR_FAILURE(isolate, LoadLookupSlot(name, Object::DONT_THROW)); |
| 938 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
| 939 isolate, value, LoadLookupSlot(name, Object::DONT_THROW)); | |
| 940 return *value; | |
| 941 } | 934 } |
| 942 | 935 |
| 943 | 936 |
| 944 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) { | 937 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) { |
| 945 HandleScope scope(isolate); | 938 HandleScope scope(isolate); |
| 946 DCHECK_EQ(1, args.length()); | 939 DCHECK_EQ(1, args.length()); |
| 947 DCHECK(args[0]->IsString()); | 940 DCHECK(args[0]->IsString()); |
| 948 Handle<String> name = args.at<String>(0); | 941 Handle<String> name = args.at<String>(0); |
| 949 Handle<Object> value; | 942 Handle<Object> value; |
| 950 Handle<Object> receiver; | 943 Handle<Object> receiver; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 } | 1007 } |
| 1015 | 1008 |
| 1016 } // namespace | 1009 } // namespace |
| 1017 | 1010 |
| 1018 | 1011 |
| 1019 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Sloppy) { | 1012 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Sloppy) { |
| 1020 HandleScope scope(isolate); | 1013 HandleScope scope(isolate); |
| 1021 DCHECK_EQ(2, args.length()); | 1014 DCHECK_EQ(2, args.length()); |
| 1022 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 1015 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 1023 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 1016 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 1024 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, | 1017 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, SLOPPY)); |
| 1025 StoreLookupSlot(name, value, SLOPPY)); | |
| 1026 return *value; | |
| 1027 } | 1018 } |
| 1028 | 1019 |
| 1029 | 1020 |
| 1030 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 1021 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
| 1031 HandleScope scope(isolate); | 1022 HandleScope scope(isolate); |
| 1032 DCHECK_EQ(2, args.length()); | 1023 DCHECK_EQ(2, args.length()); |
| 1033 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 1024 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 1034 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 1025 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 1035 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, | 1026 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
| 1036 StoreLookupSlot(name, value, STRICT)); | |
| 1037 return *value; | |
| 1038 } | 1027 } |
| 1039 | 1028 |
| 1040 } // namespace internal | 1029 } // namespace internal |
| 1041 } // namespace v8 | 1030 } // namespace v8 |
| OLD | NEW |