Commit d852096f authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Remove redundant SharedFunctionInfo allocation.

R=clemensh@chromium.org

Change-Id: Icc3882377c8e40411d556bf7165eed061f600f18
Reviewed-on: https://chromium-review.googlesource.com/965064Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51995}
parent c94dcb21
......@@ -777,16 +777,13 @@ Handle<JSFunction> WasmDebugInfo::GetCWasmEntry(
Handle<Code> new_entry_code = compiler::CompileCWasmEntry(isolate, sig);
Handle<String> name = isolate->factory()->InternalizeOneByteString(
STATIC_CHAR_VECTOR("c-wasm-entry"));
Handle<SharedFunctionInfo> shared =
isolate->factory()->NewSharedFunctionInfo(name, new_entry_code, false);
shared->set_internal_formal_parameter_count(
compiler::CWasmEntryParameters::kNumParameters);
NewFunctionArgs args = NewFunctionArgs::ForWasm(
name, new_entry_code, isolate->sloppy_function_map());
Handle<JSFunction> new_entry = isolate->factory()->NewFunction(args);
new_entry->set_context(
debug_info->wasm_instance()->compiled_module()->native_context());
new_entry->set_shared(*shared);
new_entry->shared()->set_internal_formal_parameter_count(
compiler::CWasmEntryParameters::kNumParameters);
entries->set(index, *new_entry);
}
return handle(JSFunction::cast(entries->get(index)));
......
......@@ -808,18 +808,15 @@ Handle<WasmExportedFunction> WasmExportedFunction::New(
Vector<uint8_t>::cast(buffer.SubVector(0, length)))
.ToHandleChecked();
}
Handle<SharedFunctionInfo> shared =
isolate->factory()->NewSharedFunctionInfo(name, export_wrapper, false);
shared->set_length(arity);
shared->set_internal_formal_parameter_count(arity);
NewFunctionArgs args = NewFunctionArgs::ForWasm(
name, export_wrapper, isolate->sloppy_function_without_prototype_map());
Handle<JSFunction> js_function = isolate->factory()->NewFunction(args);
// According to the spec, exported functions should not have a [[Construct]]
// method.
DCHECK(!js_function->IsConstructor());
js_function->shared()->set_length(arity);
js_function->shared()->set_internal_formal_parameter_count(arity);
js_function->set_shared(*shared);
Handle<Symbol> instance_symbol(isolate->factory()->wasm_instance_symbol());
JSObject::AddProperty(js_function, instance_symbol, instance, DONT_ENUM);
......
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