LCOV - code coverage report
Current view: top level - src/runtime - runtime-module.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 18 30 60.0 %
Date: 2017-10-20 Functions: 3 10 30.0 %

          Line data    Source code
       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             : #include "src/counters.h"
       9             : #include "src/objects-inl.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14        1164 : RUNTIME_FUNCTION(Runtime_DynamicImportCall) {
      15         582 :   HandleScope scope(isolate);
      16             :   DCHECK_EQ(2, args.length());
      17        1164 :   CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
      18         582 :   CONVERT_ARG_HANDLE_CHECKED(Object, specifier, 1);
      19             : 
      20         582 :   Handle<Script> script(Script::cast(function->shared()->script()));
      21             : 
      22        1284 :   while (script->eval_from_shared()->IsSharedFunctionInfo()) {
      23             :     script = handle(
      24             :         Script::cast(
      25             :             SharedFunctionInfo::cast(script->eval_from_shared())->script()),
      26          60 :         isolate);
      27             :   }
      28             : 
      29        1164 :   RETURN_RESULT_OR_FAILURE(
      30             :       isolate,
      31         582 :       isolate->RunHostImportModuleDynamicallyCallback(script, specifier));
      32             : }
      33             : 
      34         432 : RUNTIME_FUNCTION(Runtime_GetModuleNamespace) {
      35         144 :   HandleScope scope(isolate);
      36             :   DCHECK_EQ(1, args.length());
      37         288 :   CONVERT_SMI_ARG_CHECKED(module_request, 0);
      38         144 :   Handle<Module> module(isolate->context()->module());
      39         288 :   return *Module::GetModuleNamespace(module, module_request);
      40             : }
      41             : 
      42           0 : RUNTIME_FUNCTION(Runtime_LoadModuleVariable) {
      43           0 :   HandleScope scope(isolate);
      44             :   DCHECK_EQ(1, args.length());
      45           0 :   CONVERT_SMI_ARG_CHECKED(index, 0);
      46           0 :   Handle<Module> module(isolate->context()->module());
      47           0 :   return *Module::LoadVariable(module, index);
      48             : }
      49             : 
      50           0 : RUNTIME_FUNCTION(Runtime_StoreModuleVariable) {
      51           0 :   HandleScope scope(isolate);
      52             :   DCHECK_EQ(2, args.length());
      53           0 :   CONVERT_SMI_ARG_CHECKED(index, 0);
      54           0 :   CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
      55           0 :   Handle<Module> module(isolate->context()->module());
      56           0 :   Module::StoreVariable(module, index, value);
      57           0 :   return isolate->heap()->undefined_value();
      58             : }
      59             : 
      60         339 : RUNTIME_FUNCTION(Runtime_GetImportMetaObject) {
      61         113 :   HandleScope scope(isolate);
      62             :   DCHECK_EQ(0, args.length());
      63         113 :   Handle<Module> module(isolate->context()->module());
      64         226 :   return *isolate->RunHostInitializeImportMetaObjectCallback(module);
      65             : }
      66             : 
      67             : }  // namespace internal
      68             : }  // namespace v8

Generated by: LCOV version 1.10