Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: Persist strings that are used multiple times in the Environment
  • Loading branch information
bmsdave committed Nov 6, 2019
commit cb6791e15a2c7f14655729e3cf70e1c0be6e3af5
7 changes: 4 additions & 3 deletions src/heap_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ class JSGraph : public EmbedderGraph {
MaybeLocal<Array> CreateObject() const {
EscapableHandleScope handle_scope(isolate_);
Local<Context> context = isolate_->GetCurrentContext();
Environment* env = Environment::GetCurrent(context);

std::unordered_map<Node*, Local<Object>> info_objects;
Local<Array> nodes = Array::New(isolate_, nodes_.size());
Local<String> edges_string = FIXED_ONE_BYTE_STRING(isolate_, "edges");
Local<String> is_root_string = FIXED_ONE_BYTE_STRING(isolate_, "isRoot");
Local<String> name_string = FIXED_ONE_BYTE_STRING(isolate_, "name");
Local<String> size_string = FIXED_ONE_BYTE_STRING(isolate_, "size");
Local<String> value_string = FIXED_ONE_BYTE_STRING(isolate_, "value");
Local<String> name_string = env->name_string();
Local<String> size_string = env->size_string();
Local<String> value_string = env->value_string();
Local<String> wraps_string = FIXED_ONE_BYTE_STRING(isolate_, "wraps");
Local<String> to_string = FIXED_ONE_BYTE_STRING(isolate_, "to");

Expand Down
2 changes: 1 addition & 1 deletion src/node_process_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ MaybeLocal<Object> CreateProcessObject(Environment* env) {
Local<Context> context = env->context();

Local<FunctionTemplate> process_template = FunctionTemplate::New(isolate);
process_template->SetClassName(FIXED_ONE_BYTE_STRING(isolate, "process"));
process_template->SetClassName(env->process_string());
Local<Function> process_ctor;
Local<Object> process;
if (!process_template->GetFunction(context).ToLocal(&process_ctor) ||
Expand Down
2 changes: 1 addition & 1 deletion src/stream_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void LibuvStreamWrap::Initialize(Local<Object> target,
// - callback
// - handle
sw->InstanceTemplate()->Set(
FIXED_ONE_BYTE_STRING(env->isolate(), "oncomplete"),
env->oncomplete_string(),
v8::Null(env->isolate()));
sw->InstanceTemplate()->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "callback"),
v8::Null(env->isolate()));
Expand Down