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 #include "src/counters.h" | 8 #include "src/counters.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 RUNTIME_FUNCTION(Runtime_DynamicImportCall) { | 14 RUNTIME_FUNCTION(Runtime_DynamicImportCall) { |
15 HandleScope scope(isolate); | 15 HandleScope scope(isolate); |
16 DCHECK_EQ(1, args.length()); | 16 DCHECK_EQ(2, args.length()); |
17 // TODO(gsathya): Implement ImportCall. | 17 CONVERT_ARG_HANDLE_CHECKED(String, source_url, 0); |
18 return isolate->heap()->undefined_value(); | 18 CONVERT_ARG_HANDLE_CHECKED(Object, specifier, 1); |
| 19 Handle<String> specifier_str; |
| 20 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, specifier_str, |
| 21 Object::ToString(isolate, specifier)); |
| 22 Handle<JSPromise> promise = isolate->factory()->NewJSPromise(); |
| 23 isolate->RunHostImportModuleDynamicallyCallback(source_url, specifier_str, |
| 24 promise); |
| 25 return *promise; |
19 } | 26 } |
20 | 27 |
21 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { | 28 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { |
22 HandleScope scope(isolate); | 29 HandleScope scope(isolate); |
23 DCHECK_EQ(1, args.length()); | 30 DCHECK_EQ(1, args.length()); |
24 CONVERT_SMI_ARG_CHECKED(module_request, 0); | 31 CONVERT_SMI_ARG_CHECKED(module_request, 0); |
25 Handle<Module> module(isolate->context()->module()); | 32 Handle<Module> module(isolate->context()->module()); |
26 return *Module::GetModuleNamespace(module, module_request); | 33 return *Module::GetModuleNamespace(module, module_request); |
27 } | 34 } |
28 | 35 |
(...skipping 10 matching lines...) Expand all Loading... |
39 DCHECK_EQ(2, args.length()); | 46 DCHECK_EQ(2, args.length()); |
40 CONVERT_SMI_ARG_CHECKED(index, 0); | 47 CONVERT_SMI_ARG_CHECKED(index, 0); |
41 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 48 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
42 Handle<Module> module(isolate->context()->module()); | 49 Handle<Module> module(isolate->context()->module()); |
43 Module::StoreVariable(module, index, value); | 50 Module::StoreVariable(module, index, value); |
44 return isolate->heap()->undefined_value(); | 51 return isolate->heap()->undefined_value(); |
45 } | 52 } |
46 | 53 |
47 } // namespace internal | 54 } // namespace internal |
48 } // namespace v8 | 55 } // namespace v8 |
OLD | NEW |