LCOV - code coverage report
Current view: top level - src - version.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 15 15 100.0 %
Date: 2019-04-17 Functions: 3 3 100.0 %

          Line data    Source code
       1             : // Copyright 2012 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/version.h"
       6             : 
       7             : #include "include/v8-version-string.h"
       8             : #include "include/v8-version.h"
       9             : #include "src/utils.h"
      10             : 
      11             : // Define SONAME to have the build system put a specific SONAME into the
      12             : // shared library instead the generic SONAME generated from the V8 version
      13             : // number. This define is mainly used by the build system script.
      14             : #define SONAME            ""
      15             : 
      16             : namespace v8 {
      17             : namespace internal {
      18             : 
      19             : int Version::major_ = V8_MAJOR_VERSION;
      20             : int Version::minor_ = V8_MINOR_VERSION;
      21             : int Version::build_ = V8_BUILD_NUMBER;
      22             : int Version::patch_ = V8_PATCH_LEVEL;
      23             : const char* Version::embedder_ = V8_EMBEDDER_STRING;
      24             : bool Version::candidate_ = (V8_IS_CANDIDATE_VERSION != 0);
      25             : const char* Version::soname_ = SONAME;
      26             : const char* Version::version_string_ = V8_VERSION_STRING;
      27             : 
      28             : // Calculate the V8 version string.
      29       62626 : void Version::GetString(Vector<char> str) {
      30       62626 :   const char* candidate = IsCandidate() ? " (candidate)" : "";
      31       62626 :   if (GetPatch() > 0) {
      32             :     SNPrintF(str, "%d.%d.%d.%d%s%s", GetMajor(), GetMinor(), GetBuild(),
      33          60 :              GetPatch(), GetEmbedder(), candidate);
      34             :   } else {
      35             :     SNPrintF(str, "%d.%d.%d%s%s", GetMajor(), GetMinor(), GetBuild(),
      36       62566 :              GetEmbedder(), candidate);
      37             :   }
      38       62626 : }
      39             : 
      40             : 
      41             : // Calculate the SONAME for the V8 shared library.
      42         120 : void Version::GetSONAME(Vector<char> str) {
      43         120 :   if (soname_ == nullptr || *soname_ == '\0') {
      44             :     // Generate generic SONAME if no specific SONAME is defined.
      45          60 :     const char* candidate = IsCandidate() ? "-candidate" : "";
      46          60 :     if (GetPatch() > 0) {
      47             :       SNPrintF(str, "libv8-%d.%d.%d.%d%s%s.so", GetMajor(), GetMinor(),
      48          30 :                GetBuild(), GetPatch(), GetEmbedder(), candidate);
      49             :     } else {
      50             :       SNPrintF(str, "libv8-%d.%d.%d%s%s.so", GetMajor(), GetMinor(), GetBuild(),
      51          30 :                GetEmbedder(), candidate);
      52             :     }
      53             :   } else {
      54             :     // Use specific SONAME.
      55          60 :     SNPrintF(str, "%s", soname_);
      56             :   }
      57         120 : }
      58             : 
      59             : }  // namespace internal
      60      121996 : }  // namespace v8

Generated by: LCOV version 1.10