v8::FunctionCallback callback) {
v8::Local<v8::Function> function =
NewFunctionTemplate(callback)->GetFunction();
- v8::Local<v8::String> name_string = v8::String::NewFromUtf8(isolate(), name);
+ // kInternalized strings are created in the old space.
+ const v8::NewStringType type = v8::NewStringType::kInternalized;
+ v8::Local<v8::String> name_string =
+ v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked();
that->Set(name_string, function);
function->SetName(name_string); // NODE_SET_METHOD() compatibility.
}
v8::Local<v8::Signature> signature = v8::Signature::New(isolate(), that);
v8::Local<v8::Function> function =
NewFunctionTemplate(callback, signature)->GetFunction();
- v8::Local<v8::String> name_string = v8::String::NewFromUtf8(isolate(), name);
+ // kInternalized strings are created in the old space.
+ const v8::NewStringType type = v8::NewStringType::kInternalized;
+ v8::Local<v8::String> name_string =
+ v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked();
that->PrototypeTemplate()->Set(name_string, function);
function->SetName(name_string); // NODE_SET_PROTOTYPE_METHOD() compatibility.
}
v8::FunctionCallback callback) {
v8::Local<v8::Function> function =
NewFunctionTemplate(callback)->GetFunction();
- v8::Local<v8::String> name_string = v8::String::NewFromUtf8(isolate(), name);
+ // kInternalized strings are created in the old space.
+ const v8::NewStringType type = v8::NewStringType::kInternalized;
+ v8::Local<v8::String> name_string =
+ v8::String::NewFromUtf8(isolate(), name, type).ToLocalChecked();
that->Set(name_string, function);
function->SetName(name_string); // NODE_SET_METHOD() compatibility.
}