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-26 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
1561
Local<String> MainSource(Environment* env) {
16
1561
  return String::NewFromUtf8(
17
      env->isolate(),
18
      reinterpret_cast<const char*>(internal_bootstrap_node_native),
19
      NewStringType::kNormal,
20
3122
      sizeof(internal_bootstrap_node_native)).ToLocalChecked();
21
}
22
23
1561
void DefineJavaScript(Environment* env, Local<Object> target) {
24
3122
  HandleScope scope(env->isolate());
25
26
132685
  for (auto native : natives) {
27
131124
    if (native.source != internal_bootstrap_node_native) {
28
129563
      Local<String> name = String::NewFromUtf8(env->isolate(), native.name);
29
      Local<String> source =
30
259126
          String::NewFromUtf8(
31
              env->isolate(), reinterpret_cast<const char*>(native.source),
32
259126
              NewStringType::kNormal, native.source_len).ToLocalChecked();
33
388689
      target->Set(name, source);
34
    }
35
  }
36
1561
}
37
38
}  // namespace node