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/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 bool success; | 953 bool success; |
954 LookupIterator it = LookupIterator::PropertyOrElement( | 954 LookupIterator it = LookupIterator::PropertyOrElement( |
955 isolate, o, key, &success, LookupIterator::OWN); | 955 isolate, o, key, &success, LookupIterator::OWN); |
956 if (!success) return isolate->heap()->exception(); | 956 if (!success) return isolate->heap()->exception(); |
957 MAYBE_RETURN( | 957 MAYBE_RETURN( |
958 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 958 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
959 isolate->heap()->exception()); | 959 isolate->heap()->exception()); |
960 return *value; | 960 return *value; |
961 } | 961 } |
962 | 962 |
| 963 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { |
| 964 HandleScope scope(isolate); |
| 965 DCHECK(args.length() == 1); |
| 966 CONVERT_SMI_ARG_CHECKED(module_request, 0); |
| 967 Handle<Module> module(isolate->context()->module()); |
| 968 return *Module::GetModuleNamespace(module, module_request); |
| 969 } |
| 970 |
963 RUNTIME_FUNCTION(Runtime_LoadModuleExport) { | 971 RUNTIME_FUNCTION(Runtime_LoadModuleExport) { |
964 HandleScope scope(isolate); | 972 HandleScope scope(isolate); |
965 DCHECK(args.length() == 1); | 973 DCHECK(args.length() == 1); |
966 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 974 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
967 Handle<Module> module(isolate->context()->module()); | 975 Handle<Module> module(isolate->context()->module()); |
968 return *Module::LoadExport(module, name); | 976 return *Module::LoadExport(module, name); |
969 } | 977 } |
970 | 978 |
971 RUNTIME_FUNCTION(Runtime_LoadModuleImport) { | 979 RUNTIME_FUNCTION(Runtime_LoadModuleImport) { |
972 HandleScope scope(isolate); | 980 HandleScope scope(isolate); |
973 DCHECK(args.length() == 2); | 981 DCHECK(args.length() == 2); |
974 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 982 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
975 CONVERT_ARG_HANDLE_CHECKED(Smi, module_request, 1); | 983 CONVERT_SMI_ARG_CHECKED(module_request, 1); |
976 Handle<Module> module(isolate->context()->module()); | 984 Handle<Module> module(isolate->context()->module()); |
977 return *Module::LoadImport(module, name, module_request->value()); | 985 return *Module::LoadImport(module, name, module_request); |
978 } | 986 } |
979 | 987 |
980 RUNTIME_FUNCTION(Runtime_StoreModuleExport) { | 988 RUNTIME_FUNCTION(Runtime_StoreModuleExport) { |
981 HandleScope scope(isolate); | 989 HandleScope scope(isolate); |
982 DCHECK(args.length() == 2); | 990 DCHECK(args.length() == 2); |
983 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 991 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
984 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 992 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
985 Handle<Module> module(isolate->context()->module()); | 993 Handle<Module> module(isolate->context()->module()); |
986 Module::StoreExport(module, name, value); | 994 Module::StoreExport(module, name, value); |
987 return isolate->heap()->undefined_value(); | 995 return isolate->heap()->undefined_value(); |
988 } | 996 } |
989 | 997 |
990 } // namespace internal | 998 } // namespace internal |
991 } // namespace v8 | 999 } // namespace v8 |
OLD | NEW |