OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/runtime/runtime-utils.h" |
| 6 |
| 7 #include "src/arguments.h" |
| 8 |
| 9 namespace v8 { |
| 10 namespace internal { |
| 11 |
| 12 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { |
| 13 HandleScope scope(isolate); |
| 14 DCHECK(args.length() == 1); |
| 15 CONVERT_SMI_ARG_CHECKED(module_request, 0); |
| 16 Handle<Module> module(isolate->context()->module()); |
| 17 return *Module::GetModuleNamespace(module, module_request); |
| 18 } |
| 19 |
| 20 RUNTIME_FUNCTION(Runtime_LoadModuleExport) { |
| 21 HandleScope scope(isolate); |
| 22 DCHECK(args.length() == 1); |
| 23 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 24 Handle<Module> module(isolate->context()->module()); |
| 25 return *Module::LoadExport(module, name); |
| 26 } |
| 27 |
| 28 RUNTIME_FUNCTION(Runtime_LoadModuleImport) { |
| 29 HandleScope scope(isolate); |
| 30 DCHECK(args.length() == 2); |
| 31 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 32 CONVERT_SMI_ARG_CHECKED(module_request, 1); |
| 33 Handle<Module> module(isolate->context()->module()); |
| 34 return *Module::LoadImport(module, name, module_request); |
| 35 } |
| 36 |
| 37 RUNTIME_FUNCTION(Runtime_StoreModuleExport) { |
| 38 HandleScope scope(isolate); |
| 39 DCHECK(args.length() == 2); |
| 40 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 41 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 42 Handle<Module> module(isolate->context()->module()); |
| 43 Module::StoreExport(module, name, value); |
| 44 return isolate->heap()->undefined_value(); |
| 45 } |
| 46 |
| 47 } // namespace internal |
| 48 } // namespace v8 |
OLD | NEW |