GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/node_config.cc Lines: 20 21 95.2 %
Date: 2019-02-01 22:03:38 Branches: 1 2 50.0 %

Line Branch Exec Source
1
#include "env-inl.h"
2
#include "node.h"
3
#include "node_i18n.h"
4
#include "node_options-inl.h"
5
#include "util-inl.h"
6
7
namespace node {
8
9
using v8::Boolean;
10
using v8::Context;
11
using v8::Integer;
12
using v8::Isolate;
13
using v8::Local;
14
using v8::Number;
15
using v8::Object;
16
using v8::Value;
17
18
// The config binding is used to provide an internal view of compile or runtime
19
// config options that are required internally by lib/*.js code. This is an
20
// alternative to dropping additional properties onto the process object as
21
// has been the practice previously in node.cc.
22
23
164
static void Initialize(Local<Object> target,
24
                       Local<Value> unused,
25
                       Local<Context> context) {
26
164
  Environment* env = Environment::GetCurrent(context);
27
164
  Isolate* isolate = env->isolate();
28
29
#if defined(DEBUG) && DEBUG
30
  READONLY_TRUE_PROPERTY(target, "isDebugBuild");
31
#else
32
492
  READONLY_FALSE_PROPERTY(target, "isDebugBuild");
33
#endif  // defined(DEBUG) && DEBUG
34
35
#if HAVE_OPENSSL
36
492
  READONLY_TRUE_PROPERTY(target, "hasOpenSSL");
37
#else
38
  READONLY_FALSE_PROPERTY(target, "hasOpenSSL");
39
#endif  // HAVE_OPENSSL
40
41
#ifdef NODE_FIPS_MODE
42
  READONLY_TRUE_PROPERTY(target, "fipsMode");
43
  // TODO(addaleax): Use options parser variable instead.
44
  if (per_process::cli_options->force_fips_crypto)
45
    READONLY_TRUE_PROPERTY(target, "fipsForced");
46
#endif
47
48
#ifdef NODE_HAVE_I18N_SUPPORT
49
50
492
  READONLY_TRUE_PROPERTY(target, "hasIntl");
51
52
#ifdef NODE_HAVE_SMALL_ICU
53
492
  READONLY_TRUE_PROPERTY(target, "hasSmallICU");
54
#endif  // NODE_HAVE_SMALL_ICU
55
56
#if NODE_USE_V8_PLATFORM
57
492
  READONLY_TRUE_PROPERTY(target, "hasTracing");
58
#endif
59
60
#if !defined(NODE_WITHOUT_NODE_OPTIONS)
61
492
  READONLY_TRUE_PROPERTY(target, "hasNodeOptions");
62
#endif
63
64
#endif  // NODE_HAVE_I18N_SUPPORT
65
66
#if HAVE_INSPECTOR
67
492
  READONLY_TRUE_PROPERTY(target, "hasInspector");
68
#else
69
  READONLY_FALSE_PROPERTY(target, "hasInspector");
70
#endif
71
72
164
  if (env->abort_on_uncaught_exception())
73
    READONLY_TRUE_PROPERTY(target, "shouldAbortOnUncaughtException");
74
75
656
  READONLY_PROPERTY(target,
76
                    "bits",
77
                    Number::New(env->isolate(), 8 * sizeof(intptr_t)));
78
79
164
  Local<Object> debug_options_obj = Object::New(isolate);
80
492
  READONLY_PROPERTY(target, "debugOptions", debug_options_obj);
81
82
164
  const DebugOptions& debug_options = env->options()->debug_options();
83
656
  READONLY_PROPERTY(debug_options_obj,
84
                    "inspectorEnabled",
85
                    Boolean::New(isolate, debug_options.inspector_enabled));
86
656
  READONLY_STRING_PROPERTY(
87
      debug_options_obj, "host", debug_options.host_port.host());
88
656
  READONLY_PROPERTY(debug_options_obj,
89
                    "port",
90
                    Integer::New(isolate, debug_options.host_port.port()));
91
164
}  // InitConfig
92
93
}  // namespace node
94
95
164
NODE_MODULE_CONTEXT_AWARE_INTERNAL(config, node::Initialize)