mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
src: persist strings that are used multiple times in the environment
PR-URL: https://github.com/nodejs/node/pull/30321 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
ebe3dcc55d
commit
e7a24a19e8
@ -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");
|
||||
|
||||
|
@ -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) ||
|
||||
|
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user