[wasm] Create FunctionTemplate with correct ConstructorBehaivor
Instead of always using v8::ConstructorBehavior::kAllow and then immediately calling FunctionTemplate::RemovePrototype, this patch changes FunctionTemplateInfo::New to pass in the correct value for v8::ConstructorBehavior. There is no change in observable behavior with this patch. Bug: v8:11288 Change-Id: Ia7dd8a0c1ac6d081bc0d9b73d7c7cb4164638144 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2612990 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#71957}
This commit is contained in:
parent
d81161ea9d
commit
53e1fcae87
@ -1979,9 +1979,11 @@ static i::Handle<i::FunctionTemplateInfo> NewFunctionTemplate(
|
||||
i::Isolate* i_isolate, FunctionCallback func, bool has_prototype,
|
||||
SideEffectType side_effect_type = SideEffectType::kHasSideEffect) {
|
||||
Isolate* isolate = reinterpret_cast<Isolate*>(i_isolate);
|
||||
ConstructorBehavior behavior =
|
||||
has_prototype ? ConstructorBehavior::kAllow : ConstructorBehavior::kThrow;
|
||||
Local<FunctionTemplate> templ = FunctionTemplate::New(
|
||||
isolate, func, {}, {}, 0, ConstructorBehavior::kAllow, side_effect_type);
|
||||
has_prototype ? templ->ReadOnlyPrototype() : templ->RemovePrototype();
|
||||
isolate, func, {}, {}, 0, behavior, side_effect_type);
|
||||
if (has_prototype) templ->ReadOnlyPrototype();
|
||||
return v8::Utils::OpenHandle(*templ);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user