Commit 34d9cd04 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm] Fix code kind of imported math intrinsics

The error showed when printing the resulting code object, because the
tier was neither TurboFan nor Liftoff, even though the code was
registered as a standard wasm function (instead of an import wrapper).

R=jkummerow@chromium.org

Bug: chromium:1254674
Change-Id: I26482fd88d72403393428979abf08e9f60cd8c4c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3202001
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77238}
parent b1c2af72
......@@ -3163,6 +3163,9 @@ wasm::WasmCompilationResult Pipeline::GenerateCodeForWasmNativeStub(
result.frame_slot_count = code_generator->frame()->GetTotalFrameSlotCount();
result.tagged_parameter_slots = call_descriptor->GetTaggedParameterSlots();
result.result_tier = wasm::ExecutionTier::kTurbofan;
if (kind == CodeKind::WASM_TO_JS_FUNCTION) {
result.kind = wasm::WasmCompilationResult::kWasmToJsWrapper;
}
DCHECK(result.succeeded());
......
......@@ -7578,8 +7578,11 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
call_descriptor = GetI32WasmCallDescriptor(&zone, call_descriptor);
}
// The code does not call to JS, but conceptually it is an import wrapper,
// hence use {WASM_TO_JS_FUNCTION} here.
// TODO(wasm): Rename this to {WASM_IMPORT_CALL}?
return Pipeline::GenerateCodeForWasmNativeStub(
call_descriptor, mcgraph, CodeKind::WASM_FUNCTION, debug_name,
call_descriptor, mcgraph, CodeKind::WASM_TO_JS_FUNCTION, debug_name,
WasmStubAssemblerOptions(), source_positions);
}
......@@ -7634,11 +7637,9 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
if (machine->Is32()) {
incoming = GetI32WasmCallDescriptor(&zone, incoming);
}
wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub(
return Pipeline::GenerateCodeForWasmNativeStub(
incoming, mcgraph, CodeKind::WASM_TO_JS_FUNCTION, func_name,
WasmStubAssemblerOptions(), source_position_table);
result.kind = wasm::WasmCompilationResult::kWasmToJsWrapper;
return result;
}
wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::NativeModule* native_module,
......
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --print-wasm-code
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
builder.addImport('Math', 'sqrt', kSig_d_d);
builder.instantiate({Math: Math});
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