[wasm] Remove redundant SharedFunctionInfo allocation.

R=clemensh@chromium.org

Change-Id: Icc3882377c8e40411d556bf7165eed061f600f18
Reviewed-on: https://chromium-review.googlesource.com/965064
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51995}
This commit is contained in:
Michael Starzinger 2018-03-16 13:37:38 +01:00 committed by Commit Bot
parent c94dcb2117
commit d852096f15
2 changed files with 4 additions and 10 deletions

View File

@ -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)));

View File

@ -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);