Commit 53e1fcae authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[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/+/2612990Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71957}
parent d81161ea
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment