Skip to content

Commit 7267396

Browse files
bmsdavetargos
authored andcommitted
src: persist strings that are used multiple times in the environment
PR-URL: #30321 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent f0994c6 commit 7267396

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/heap_utils.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,15 @@ class JSGraph : public EmbedderGraph {
8989
MaybeLocal<Array> CreateObject() const {
9090
EscapableHandleScope handle_scope(isolate_);
9191
Local<Context> context = isolate_->GetCurrentContext();
92+
Environment* env = Environment::GetCurrent(context);
9293

9394
std::unordered_map<Node*, Local<Object>> info_objects;
9495
Local<Array> nodes = Array::New(isolate_, nodes_.size());
9596
Local<String> edges_string = FIXED_ONE_BYTE_STRING(isolate_, "edges");
9697
Local<String> is_root_string = FIXED_ONE_BYTE_STRING(isolate_, "isRoot");
97-
Local<String> name_string = FIXED_ONE_BYTE_STRING(isolate_, "name");
98-
Local<String> size_string = FIXED_ONE_BYTE_STRING(isolate_, "size");
99-
Local<String> value_string = FIXED_ONE_BYTE_STRING(isolate_, "value");
98+
Local<String> name_string = env->name_string();
99+
Local<String> size_string = env->size_string();
100+
Local<String> value_string = env->value_string();
100101
Local<String> wraps_string = FIXED_ONE_BYTE_STRING(isolate_, "wraps");
101102
Local<String> to_string = FIXED_ONE_BYTE_STRING(isolate_, "to");
102103

src/node_process_object.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ MaybeLocal<Object> CreateProcessObject(Environment* env) {
7474
Local<Context> context = env->context();
7575

7676
Local<FunctionTemplate> process_template = FunctionTemplate::New(isolate);
77-
process_template->SetClassName(FIXED_ONE_BYTE_STRING(isolate, "process"));
77+
process_template->SetClassName(env->process_string());
7878
Local<Function> process_ctor;
7979
Local<Object> process;
8080
if (!process_template->GetFunction(context).ToLocal(&process_ctor) ||

src/stream_wrap.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void LibuvStreamWrap::Initialize(Local<Object> target,
7878
// - callback
7979
// - handle
8080
sw->InstanceTemplate()->Set(
81-
FIXED_ONE_BYTE_STRING(env->isolate(), "oncomplete"),
81+
env->oncomplete_string(),
8282
v8::Null(env->isolate()));
8383
sw->InstanceTemplate()->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "callback"),
8484
v8::Null(env->isolate()));

0 commit comments

Comments
 (0)