LCOV - code coverage report
Current view: top level - src/snapshot - natives-common.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 12 13 92.3 %
Date: 2017-04-26 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // Copyright 2015 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             : // The common functionality when building with internal or external natives.
       6             : 
       7             : #include "src/heap/heap.h"
       8             : #include "src/objects-inl.h"
       9             : #include "src/snapshot/natives.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14      990128 : NativesExternalStringResource::NativesExternalStringResource(NativeType type,
      15             :                                                              int index)
      16      990128 :     : type_(type), index_(index) {
      17             :   Vector<const char> source;
      18             :   DCHECK(0 <= index);
      19      990128 :   switch (type_) {
      20             :     case CORE:
      21             :       DCHECK(index < Natives::GetBuiltinsCount());
      22      929328 :       source = Natives::GetScriptSource(index);
      23      929329 :       break;
      24             :     case EXTRAS:
      25             :       DCHECK(index < ExtraNatives::GetBuiltinsCount());
      26       60794 :       source = ExtraNatives::GetScriptSource(index);
      27       60794 :       break;
      28             :     case EXPERIMENTAL_EXTRAS:
      29             :       DCHECK(index < ExperimentalExtraNatives::GetBuiltinsCount());
      30           6 :       source = ExperimentalExtraNatives::GetScriptSource(index);
      31           6 :       break;
      32             :     default:
      33           0 :       UNREACHABLE();
      34             :   }
      35      990129 :   data_ = source.start();
      36      990129 :   length_ = source.length();
      37      990129 : }
      38             : 
      39             : }  // namespace internal
      40             : }  // namespace v8

Generated by: LCOV version 1.10