LCOV - code coverage report
Current view: top level - src - roots.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 14 17 82.4 %
Date: 2019-01-20 Functions: 6 6 100.0 %

          Line data    Source code
       1             : // Copyright 2018 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/roots.h"
       6             : 
       7             : #include "src/elements-kind.h"
       8             : #include "src/visitors.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13             : const char* RootsTable::root_names_[RootsTable::kEntriesCount] = {
      14             : #define ROOT_NAME(type, name, CamelName) #name,
      15             :     ROOT_LIST(ROOT_NAME)
      16             : #undef ROOT_NAME
      17             : };
      18             : 
      19             : // static
      20       13882 : RootIndex RootsTable::RootIndexForFixedTypedArray(
      21             :     ExternalArrayType array_type) {
      22       13882 :   switch (array_type) {
      23             : #define ARRAY_TYPE_TO_ROOT_INDEX(Type, type, TYPE, ctype) \
      24             :   case kExternal##Type##Array:                            \
      25             :     return RootIndex::kFixed##Type##ArrayMap;
      26             : 
      27         880 :     TYPED_ARRAYS(ARRAY_TYPE_TO_ROOT_INDEX)
      28             : #undef ARRAY_TYPE_TO_ROOT_INDEX
      29             :   }
      30           0 :   UNREACHABLE();
      31             : }
      32             : 
      33             : // static
      34        1232 : RootIndex RootsTable::RootIndexForFixedTypedArray(ElementsKind elements_kind) {
      35        1232 :   switch (elements_kind) {
      36             : #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) \
      37             :   case TYPE##_ELEMENTS:                           \
      38             :     return RootIndex::kFixed##Type##ArrayMap;
      39         112 :     TYPED_ARRAYS(TYPED_ARRAY_CASE)
      40             :     default:
      41           0 :       UNREACHABLE();
      42             : #undef TYPED_ARRAY_CASE
      43             :   }
      44             : }
      45             : 
      46             : // static
      47        4182 : RootIndex RootsTable::RootIndexForEmptyFixedTypedArray(
      48             :     ElementsKind elements_kind) {
      49        4182 :   switch (elements_kind) {
      50             : #define ELEMENT_KIND_TO_ROOT_INDEX(Type, type, TYPE, ctype) \
      51             :   case TYPE##_ELEMENTS:                                     \
      52             :     return RootIndex::kEmptyFixed##Type##Array;
      53             : 
      54         468 :     TYPED_ARRAYS(ELEMENT_KIND_TO_ROOT_INDEX)
      55             : #undef ELEMENT_KIND_TO_ROOT_INDEX
      56             :     default:
      57           0 :       UNREACHABLE();
      58             :   }
      59             : }
      60             : 
      61       63477 : void ReadOnlyRoots::Iterate(RootVisitor* visitor) {
      62             :   visitor->VisitRootPointers(Root::kReadOnlyRootList, nullptr,
      63             :                              roots_table_.read_only_roots_begin(),
      64      126954 :                              roots_table_.read_only_roots_end());
      65       63477 :   visitor->Synchronize(VisitorSynchronization::kReadOnlyRootList);
      66       63477 : }
      67             : 
      68             : }  // namespace internal
      69      183867 : }  // namespace v8

Generated by: LCOV version 1.10