Commit 93fff34e authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[asm.js] Remove redundant data duplication from "wasm_data".

R=clemensh@chromium.org

Change-Id: Id3a44a247bc881ba0f9d41a242cbb6130094771c
Reviewed-on: https://chromium-review.googlesource.com/501847
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45233}
parent 2026d5cb
......@@ -35,8 +35,6 @@ namespace {
enum WasmDataEntries {
kWasmDataCompiledModule,
kWasmDataUsesArray,
kWasmDataScript,
kWasmDataScriptPosition,
kWasmDataEntryCount,
};
......@@ -220,9 +218,6 @@ MaybeHandle<FixedArray> AsmJs::CompileAsmViaWasm(CompilationInfo* info) {
info->isolate()->factory()->NewFixedArray(kWasmDataEntryCount);
result->set(kWasmDataCompiledModule, *compiled.ToHandleChecked());
result->set(kWasmDataUsesArray, *uses_array);
result->set(kWasmDataScript, *info->script());
result->set(kWasmDataScriptPosition,
Smi::FromInt(info->literal()->position()));
MessageLocation location(info->script(), info->literal()->position(),
info->literal()->position());
......@@ -251,6 +246,7 @@ MaybeHandle<FixedArray> AsmJs::CompileAsmViaWasm(CompilationInfo* info) {
}
MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
Handle<SharedFunctionInfo> shared,
Handle<FixedArray> wasm_data,
Handle<JSReceiver> stdlib,
Handle<JSReceiver> foreign,
......@@ -314,11 +310,8 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
return single_function;
}
Handle<Script> script(Script::cast(wasm_data->get(kWasmDataScript)));
int32_t position = 0;
if (!wasm_data->get(kWasmDataScriptPosition)->ToInt32(&position)) {
UNREACHABLE();
}
int position = shared->start_position();
Handle<Script> script(Script::cast(shared->script()));
MessageLocation location(script, position, position);
char text[50];
int length;
......
......@@ -14,12 +14,14 @@ namespace internal {
class CompilationInfo;
class JSArrayBuffer;
class SharedFunctionInfo;
// Interface to compile and instantiate for asm.js modules.
class AsmJs {
public:
static MaybeHandle<FixedArray> CompileAsmViaWasm(CompilationInfo* info);
static MaybeHandle<Object> InstantiateAsmWasm(Isolate* isolate,
Handle<SharedFunctionInfo>,
Handle<FixedArray> wasm_data,
Handle<JSReceiver> stdlib,
Handle<JSReceiver> foreign,
......
......@@ -86,9 +86,10 @@ RUNTIME_FUNCTION(Runtime_InstantiateAsmJs) {
memory = args.at<JSArrayBuffer>(3);
}
if (function->shared()->HasAsmWasmData()) {
Handle<FixedArray> data(function->shared()->asm_wasm_data());
MaybeHandle<Object> result =
AsmJs::InstantiateAsmWasm(isolate, data, stdlib, foreign, memory);
Handle<SharedFunctionInfo> shared(function->shared());
Handle<FixedArray> data(shared->asm_wasm_data());
MaybeHandle<Object> result = AsmJs::InstantiateAsmWasm(
isolate, shared, data, stdlib, foreign, memory);
if (!result.is_null()) {
return *result.ToHandleChecked();
}
......
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