LCOV - code coverage report
Current view: top level - src/objects - module-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 23 23 100.0 %
Date: 2019-04-17 Functions: 14 14 100.0 %

          Line data    Source code
       1             : // Copyright 2017 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             : #ifndef V8_OBJECTS_MODULE_INL_H_
       6             : #define V8_OBJECTS_MODULE_INL_H_
       7             : 
       8             : #include "src/objects/module.h"
       9             : 
      10             : #include "src/objects-inl.h"  // Needed for write barriers
      11             : #include "src/objects/scope-info.h"
      12             : 
      13             : // Has to be the last include (doesn't have include guards):
      14             : #include "src/objects/object-macros.h"
      15             : 
      16             : namespace v8 {
      17             : namespace internal {
      18             : 
      19             : OBJECT_CONSTRUCTORS_IMPL(Module, Struct)
      20             : OBJECT_CONSTRUCTORS_IMPL(ModuleInfoEntry, Struct)
      21             : OBJECT_CONSTRUCTORS_IMPL(JSModuleNamespace, JSObject)
      22             : 
      23             : NEVER_READ_ONLY_SPACE_IMPL(Module)
      24             : 
      25             : CAST_ACCESSOR(Module)
      26       47392 : ACCESSORS(Module, code, Object, kCodeOffset)
      27      257251 : ACCESSORS(Module, exports, ObjectHashTable, kExportsOffset)
      28       43078 : ACCESSORS(Module, regular_exports, FixedArray, kRegularExportsOffset)
      29       12164 : ACCESSORS(Module, regular_imports, FixedArray, kRegularImportsOffset)
      30       11726 : ACCESSORS(Module, module_namespace, HeapObject, kModuleNamespaceOffset)
      31       16712 : ACCESSORS(Module, requested_modules, FixedArray, kRequestedModulesOffset)
      32       11167 : ACCESSORS(Module, script, Script, kScriptOffset)
      33        9294 : ACCESSORS(Module, exception, Object, kExceptionOffset)
      34        9264 : ACCESSORS(Module, import_meta, Object, kImportMetaOffset)
      35       36055 : SMI_ACCESSORS(Module, status, kStatusOffset)
      36        8427 : SMI_ACCESSORS(Module, dfs_index, kDfsIndexOffset)
      37        9749 : SMI_ACCESSORS(Module, dfs_ancestor_index, kDfsAncestorIndexOffset)
      38        5040 : SMI_ACCESSORS(Module, hash, kHashOffset)
      39             : 
      40        7735 : ModuleInfo Module::info() const {
      41             :   return (status() >= kEvaluating)
      42             :              ? ModuleInfo::cast(code())
      43       15257 :              : GetSharedFunctionInfo()->scope_info()->ModuleDescriptorInfo();
      44             : }
      45             : 
      46             : CAST_ACCESSOR(JSModuleNamespace)
      47       53961 : ACCESSORS(JSModuleNamespace, module, Module, kModuleOffset)
      48             : 
      49             : CAST_ACCESSOR(ModuleInfoEntry)
      50        5695 : ACCESSORS(ModuleInfoEntry, export_name, Object, kExportNameOffset)
      51        4715 : ACCESSORS(ModuleInfoEntry, local_name, Object, kLocalNameOffset)
      52        5681 : ACCESSORS(ModuleInfoEntry, import_name, Object, kImportNameOffset)
      53        2092 : SMI_ACCESSORS(ModuleInfoEntry, module_request, kModuleRequestOffset)
      54        1611 : SMI_ACCESSORS(ModuleInfoEntry, cell_index, kCellIndexOffset)
      55        2180 : SMI_ACCESSORS(ModuleInfoEntry, beg_pos, kBegPosOffset)
      56        2180 : SMI_ACCESSORS(ModuleInfoEntry, end_pos, kEndPosOffset)
      57             : 
      58             : OBJECT_CONSTRUCTORS_IMPL(ModuleInfo, FixedArray)
      59             : CAST_ACCESSOR(ModuleInfo)
      60             : 
      61             : FixedArray ModuleInfo::module_requests() const {
      62             :   return FixedArray::cast(get(kModuleRequestsIndex));
      63             : }
      64             : 
      65             : FixedArray ModuleInfo::special_exports() const {
      66             :   return FixedArray::cast(get(kSpecialExportsIndex));
      67             : }
      68             : 
      69             : FixedArray ModuleInfo::regular_exports() const {
      70             :   return FixedArray::cast(get(kRegularExportsIndex));
      71             : }
      72             : 
      73             : FixedArray ModuleInfo::regular_imports() const {
      74             :   return FixedArray::cast(get(kRegularImportsIndex));
      75             : }
      76             : 
      77             : FixedArray ModuleInfo::namespace_imports() const {
      78             :   return FixedArray::cast(get(kNamespaceImportsIndex));
      79             : }
      80             : 
      81             : FixedArray ModuleInfo::module_request_positions() const {
      82             :   return FixedArray::cast(get(kModuleRequestPositionsIndex));
      83             : }
      84             : 
      85             : #ifdef DEBUG
      86             : bool ModuleInfo::Equals(ModuleInfo other) const {
      87             :   return regular_exports() == other->regular_exports() &&
      88             :          regular_imports() == other->regular_imports() &&
      89             :          special_exports() == other->special_exports() &&
      90             :          namespace_imports() == other->namespace_imports() &&
      91             :          module_requests() == other->module_requests() &&
      92             :          module_request_positions() == other->module_request_positions();
      93             : }
      94             : #endif
      95             : 
      96             : }  // namespace internal
      97             : }  // namespace v8
      98             : 
      99             : #include "src/objects/object-macros-undef.h"
     100             : 
     101             : #endif  // V8_OBJECTS_MODULE_INL_H_

Generated by: LCOV version 1.10