Commit 0e2e00f4 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Remove interpreter compilation hint

The interpreter will be un-shipped soon, hence we cannot have a
compilation hint for interpreted execution.
This CL removes the respective enum value, removes a test which
specifically tested this one option, and adapts other code to use one of
the remaining hints.

R=ahaas@chromium.org

Bug: v8:10389
Change-Id: Ia754f7de95be271000a9e4e10ef2a3ee171da627
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2172748Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67491}
parent 4a98a3cc
......@@ -696,8 +696,6 @@ ExecutionTier ApplyHintToExecutionTier(WasmCompilationHintTier hint,
switch (hint) {
case WasmCompilationHintTier::kDefault:
return default_tier;
case WasmCompilationHintTier::kInterpreter:
return ExecutionTier::kInterpreter;
case WasmCompilationHintTier::kBaseline:
return ExecutionTier::kLiftoff;
case WasmCompilationHintTier::kOptimized:
......
......@@ -168,9 +168,8 @@ enum class WasmCompilationHintStrategy : uint8_t {
enum class WasmCompilationHintTier : uint8_t {
kDefault = 0,
kInterpreter = 1,
kBaseline = 2,
kOptimized = 3,
kBaseline = 1,
kOptimized = 2,
};
// Static representation of a wasm compilation hint
......
......@@ -708,12 +708,10 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
#define COMPILE_STRATEGY_LAZY (0x01)
#define COMPILE_STRATEGY_EAGER (0x02)
#define BASELINE_TIER_DEFAULT (0x00 << 2)
#define BASELINE_TIER_INTERPRETER (0x01 << 2)
#define BASELINE_TIER_BASELINE (0x02 << 2)
#define BASELINE_TIER_OPTIMIZED (0x03 << 2)
#define BASELINE_TIER_BASELINE (0x01 << 2)
#define BASELINE_TIER_OPTIMIZED (0x02 << 2)
#define TOP_TIER_DEFAULT (0x00 << 4)
#define TOP_TIER_INTERPRETER (0x01 << 4)
#define TOP_TIER_BASELINE (0x02 << 4)
#define TOP_TIER_OPTIMIZED (0x03 << 4)
#define TOP_TIER_BASELINE (0x01 << 4)
#define TOP_TIER_OPTIMIZED (0x02 << 4)
#endif // V8_WASM_MACRO_GEN_H_
......@@ -19,7 +19,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
assertPromiseResult(WebAssembly.compile(bytes)
.then(assertUnreachable,
error => assertEquals("WebAssembly.compile(): Invalid compilation " +
"hint 0x2d (forbidden downgrade) @+49", error.message)));
"hint 0x19 (forbidden downgrade) @+49", error.message)));
})();
(function testCompileWithBadLazyFunctionBody() {
......
......@@ -20,7 +20,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
.exportFunc();
assertThrows(() => builder.instantiate({mod: {pow: Math.pow}}),
WebAssembly.CompileError,
"WebAssembly.Module(): Invalid compilation hint 0x2d " +
"WebAssembly.Module(): Invalid compilation hint 0x19 " +
"(forbidden downgrade) @+70");
})();
......@@ -33,8 +33,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
kExprLocalGet, 0,
kExprCallFunction, 0])
.setCompilationHint(kCompilationHintStrategyDefault,
kCompilationHintTierInterpreter,
kCompilationHintTierInterpreter)
kCompilationHintTierBaseline,
kCompilationHintTierBaseline)
.exportFunc();
builder.addFunction('upow2', kSig_i_i)
.addBody([kExprLocalGet, 0,
......
......@@ -13,8 +13,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
kExprLocalGet, 0,
kExprCallFunction, 0])
.setCompilationHint(kCompilationHintStrategyDefault,
kCompilationHintTierInterpreter,
kCompilationHintTierInterpreter)
kCompilationHintTierBaseline,
kCompilationHintTierBaseline)
.exportFunc();
let instance = builder.instantiate({mod: {pow: Math.pow}});
assertEquals(27, instance.exports.upow(3))
......
// Copyright 2019 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: --experimental-wasm-compilation-hints --wasm-lazy-validation
load('test/mjsunit/wasm/wasm-module-builder.js');
(function testInterpreterCallsLazyFunctionInOtherInstance() {
print(arguments.callee.name);
let builder0 = new WasmModuleBuilder();
builder0.addFunction("getX", kSig_i_v)
.addBody([kExprI32Const, 42])
.setCompilationHint(kCompilationHintStrategyLazy,
kCompilationHintTierBaseline,
kCompilationHintTierBaseline)
.exportFunc();
let builder1 = new WasmModuleBuilder();
builder1.addImport("otherModule", "getX", kSig_i_v);
builder1.addFunction("plusX", kSig_i_i)
.addBody([kExprCallFunction, 0,
kExprLocalGet, 0,
kExprI32Add])
.setCompilationHint(kCompilationHintStrategyLazy,
kCompilationHintTierInterpreter,
kCompilationHintTierInterpreter)
.exportFunc();
let instance0 = builder0.instantiate();
let instance1 = builder1.instantiate(
{otherModule: {getX: instance0.exports.getX}});
assertEquals(46, instance1.exports.plusX(4));
})();
(function testInterpreterCallsLazyBadFunctionInOtherInstance() {
print(arguments.callee.name);
let builder0 = new WasmModuleBuilder();
builder0.addFunction("getX", kSig_i_v)
.addBody([kExprI64Const, 42])
.setCompilationHint(kCompilationHintStrategyLazy,
kCompilationHintTierBaseline,
kCompilationHintTierBaseline)
.exportFunc();
let builder1 = new WasmModuleBuilder();
builder1.addImport("otherModule", "getX", kSig_i_v);
builder1.addFunction("plusX", kSig_i_i)
.addBody([kExprCallFunction, 0,
kExprLocalGet, 0,
kExprI32Add])
.setCompilationHint(kCompilationHintStrategyLazy,
kCompilationHintTierInterpreter,
kCompilationHintTierInterpreter)
.exportFunc();
let instance0 = builder0.instantiate();
let instance1 = builder1.instantiate(
{otherModule: {getX: instance0.exports.getX}});
assertThrows(() => instance1.exports.plusX(4),
WebAssembly.CompileError,
"Compiling function #0:\"getX\" failed: type error in " +
"merge[0] (expected i32, got i64) @+57");
})();
(function testInterpreterCallsLazyFunctionThroughIndirection() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
let sig_i_ii = builder.addType(kSig_i_ii);
let add = builder.addFunction('add', sig_i_ii)
.addBody([kExprLocalGet, 0,
kExprLocalGet, 1,
kExprI32Add])
.setCompilationHint(kCompilationHintStrategyLazy,
kCompilationHintTierInterpreter,
kCompilationHintTierInterpreter);
builder.appendToTable([add.index]);
builder.addFunction('main', kSig_i_iii)
.addBody([// Call indirect #0 with args <#1, #2>.
kExprLocalGet, 1,
kExprLocalGet, 2,
kExprLocalGet, 0,
kExprCallIndirect, sig_i_ii, kTableZero])
.setCompilationHint(kCompilationHintStrategyLazy,
kCompilationHintTierInterpreter,
kCompilationHintTierInterpreter)
.exportFunc();
assertEquals(99, builder.instantiate().exports.main(0, 22, 77));
})();
(function testInterpreterCallsLazyBadFunctionThroughIndirection() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
let sig_i_ii = builder.addType(kSig_i_ii);
let add = builder.addFunction('add', sig_i_ii)
.addBody([kExprLocalGet, 0,
kExprLocalGet, 1,
kExprI64Add])
.setCompilationHint(kCompilationHintStrategyLazy,
kCompilationHintTierInterpreter,
kCompilationHintTierInterpreter);
builder.appendToTable([add.index]);
builder.addFunction('main', kSig_i_iii)
.addBody([// Call indirect #0 with args <#1, #2>.
kExprLocalGet, 1,
kExprLocalGet, 2,
kExprLocalGet, 0,
kExprCallIndirect, sig_i_ii, kTableZero])
.setCompilationHint(kCompilationHintStrategyLazy,
kCompilationHintTierInterpreter,
kCompilationHintTierInterpreter)
.exportFunc();
assertThrows(() => builder.instantiate().exports.main(0, 22, 77),
WebAssembly.CompileError,
"Compiling function #0:\"add\" failed: i64.add[1] expected " +
"type i64, found local.get of type i32 @+83");
})();
......@@ -49,7 +49,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
{mod: {pow: Math.pow}})
.then(assertUnreachable,
error => assertEquals("WebAssembly.instantiateStreaming(): Invalid " +
"compilation hint 0x2d (forbidden downgrade) " +
"compilation hint 0x19 (forbidden downgrade) " +
"@+78",
error.message)));
})();
......
......@@ -17,7 +17,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
.exportFunc();
assertThrows(() => builder.toModule(),
WebAssembly.CompileError,
"WebAssembly.Module(): Invalid compilation hint 0x2d " +
"WebAssembly.Module(): Invalid compilation hint 0x19 " +
"(forbidden downgrade) @+49");
})();
......
......@@ -492,9 +492,8 @@ let kCompilationHintStrategyLazy = 0x01;
let kCompilationHintStrategyEager = 0x02;
let kCompilationHintStrategyLazyBaselineEagerTopTier = 0x03;
let kCompilationHintTierDefault = 0x00;
let kCompilationHintTierInterpreter = 0x01;
let kCompilationHintTierBaseline = 0x02;
let kCompilationHintTierOptimized = 0x03;
let kCompilationHintTierBaseline = 0x01;
let kCompilationHintTierOptimized = 0x02;
let kTrapUnreachable = 0;
let kTrapMemOutOfBounds = 1;
......
......@@ -1487,10 +1487,9 @@ TEST_F(WasmModuleVerifyTest, TieringCompilationHints) {
static const byte data[] = {
SIGNATURES_SECTION(1, SIG_ENTRY_v_v),
FUNCTION_SIGNATURES_SECTION(3, 0, 0, 0),
SECTION_COMPILATION_HINTS(
BASELINE_TIER_INTERPRETER | TOP_TIER_BASELINE,
SECTION_COMPILATION_HINTS(BASELINE_TIER_BASELINE | TOP_TIER_BASELINE,
BASELINE_TIER_BASELINE | TOP_TIER_OPTIMIZED,
BASELINE_TIER_INTERPRETER | TOP_TIER_INTERPRETER),
BASELINE_TIER_OPTIMIZED | TOP_TIER_OPTIMIZED),
SECTION(Code, ENTRY_COUNT(3), NOP_BODY, NOP_BODY, NOP_BODY),
};
......@@ -1500,7 +1499,7 @@ TEST_F(WasmModuleVerifyTest, TieringCompilationHints) {
EXPECT_EQ(3u, result.value()->compilation_hints.size());
EXPECT_EQ(WasmCompilationHintStrategy::kDefault,
result.value()->compilation_hints[0].strategy);
EXPECT_EQ(WasmCompilationHintTier::kInterpreter,
EXPECT_EQ(WasmCompilationHintTier::kBaseline,
result.value()->compilation_hints[0].baseline_tier);
EXPECT_EQ(WasmCompilationHintTier::kBaseline,
result.value()->compilation_hints[0].top_tier);
......@@ -1512,9 +1511,9 @@ TEST_F(WasmModuleVerifyTest, TieringCompilationHints) {
result.value()->compilation_hints[1].top_tier);
EXPECT_EQ(WasmCompilationHintStrategy::kDefault,
result.value()->compilation_hints[2].strategy);
EXPECT_EQ(WasmCompilationHintTier::kInterpreter,
EXPECT_EQ(WasmCompilationHintTier::kOptimized,
result.value()->compilation_hints[2].baseline_tier);
EXPECT_EQ(WasmCompilationHintTier::kInterpreter,
EXPECT_EQ(WasmCompilationHintTier::kOptimized,
result.value()->compilation_hints[2].top_tier);
}
......
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