GCC Code Coverage Report
Directory: ../src/ Exec Total Coverage
File: /home/node-core-coverage/node-core-coverage/workdir/node/src/node_javascript.cc Lines: 12 12 100.0 %
Date: 2016-07-12 Branches: 4 4 100.0 %

Line Exec Source
1
#include "node.h"
2
#include "node_natives.h"
3
#include "v8.h"
4
#include "env.h"
5
#include "env-inl.h"
6
7
namespace node {
8
9
using v8::HandleScope;
10
using v8::Local;
11
using v8::NewStringType;
12
using v8::Object;
13
using v8::String;
14
15
1554
Local<String> MainSource(Environment* env) {
16
1554
  return String::NewFromUtf8(
17
      env->isolate(),
18
      reinterpret_cast<const char*>(internal_bootstrap_node_native),
19
      NewStringType::kNormal,
20
3108
      sizeof(internal_bootstrap_node_native)).ToLocalChecked();
21
}
22
23
1554
void DefineJavaScript(Environment* env, Local<Object> target) {
24
3108
  HandleScope scope(env->isolate());
25
26
132090
  for (auto native : natives) {
27
130536
    if (native.source != internal_bootstrap_node_native) {
28
128982
      Local<String> name = String::NewFromUtf8(env->isolate(), native.name);
29
      Local<String> source =
30
257964
          String::NewFromUtf8(
31
              env->isolate(), reinterpret_cast<const char*>(native.source),
32
257964
              NewStringType::kNormal, native.source_len).ToLocalChecked();
33
386946
      target->Set(name, source);
34
    }
35
  }
36
1554
}
37
38
}  // namespace node