OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
11 | 11 |
12 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { | 12 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { |
13 HandleScope scope(isolate); | 13 HandleScope scope(isolate); |
14 DCHECK(args.length() == 1); | 14 DCHECK(args.length() == 1); |
15 CONVERT_SMI_ARG_CHECKED(module_request, 0); | 15 CONVERT_SMI_ARG_CHECKED(module_request, 0); |
16 Handle<Module> module(isolate->context()->module()); | 16 Handle<Module> module(isolate->context()->module()); |
17 return *Module::GetModuleNamespace(module, module_request); | 17 return *Module::GetModuleNamespace(module, module_request); |
18 } | 18 } |
19 | 19 |
20 RUNTIME_FUNCTION(Runtime_LoadModuleExport) { | 20 RUNTIME_FUNCTION(Runtime_LoadModuleVariable) { |
21 HandleScope scope(isolate); | 21 HandleScope scope(isolate); |
22 DCHECK(args.length() == 1); | 22 DCHECK(args.length() == 1); |
23 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 23 CONVERT_SMI_ARG_CHECKED(index, 0); |
24 Handle<Module> module(isolate->context()->module()); | 24 Handle<Module> module(isolate->context()->module()); |
25 return *Module::LoadExport(module, name); | 25 return *Module::LoadVariable(module, index); |
26 } | 26 } |
27 | 27 |
28 RUNTIME_FUNCTION(Runtime_LoadModuleImport) { | 28 RUNTIME_FUNCTION(Runtime_StoreModuleVariable) { |
29 HandleScope scope(isolate); | 29 HandleScope scope(isolate); |
30 DCHECK(args.length() == 2); | 30 DCHECK(args.length() == 2); |
31 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 31 CONVERT_SMI_ARG_CHECKED(index, 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); | 32 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
42 Handle<Module> module(isolate->context()->module()); | 33 Handle<Module> module(isolate->context()->module()); |
43 Module::StoreExport(module, name, value); | 34 Module::StoreVariable(module, index, value); |
44 return isolate->heap()->undefined_value(); | 35 return isolate->heap()->undefined_value(); |
45 } | 36 } |
46 | 37 |
47 } // namespace internal | 38 } // namespace internal |
48 } // namespace v8 | 39 } // namespace v8 |
OLD | NEW |