[wasm-hints] Unified Naming for Compilation Hints
The tiers are now consistently referred to as baselin and top tier. Bug: v8:9003 Change-Id: I74ad1867aca63bee9eb83b7f0f9fbaf2b1523dcb Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1547667 Commit-Queue: Frederik Gossen <frgossen@google.com> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#60591}
This commit is contained in:
parent
8bedd29166
commit
f0cfb7cc81
@ -363,10 +363,10 @@ ExecutionTierPair GetRequestedExecutionTiers(
|
||||
const WasmCompilationHint* hint =
|
||||
GetCompilationHint(module, func_index);
|
||||
if (hint != nullptr) {
|
||||
result.baseline_tier =
|
||||
ApplyHintToExecutionTier(hint->first_tier, result.baseline_tier);
|
||||
result.baseline_tier = ApplyHintToExecutionTier(hint->baseline_tier,
|
||||
result.baseline_tier);
|
||||
result.top_tier =
|
||||
ApplyHintToExecutionTier(hint->second_tier, result.top_tier);
|
||||
ApplyHintToExecutionTier(hint->top_tier, result.top_tier);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1017,10 +1017,10 @@ class ModuleDecoderImpl : public Decoder {
|
||||
static_cast<int>(pc_ - start_));
|
||||
|
||||
// Compilation hints are encoded in one byte each.
|
||||
// +-------+-------------+------------+------------------+
|
||||
// | 2 bit | 2 bit | 2 bit | 2 bit |
|
||||
// | ... | Second tier | First tier | Lazy compilation |
|
||||
// +-------+-------------+------------+------------------+
|
||||
// +-------+----------+---------------+------------------+
|
||||
// | 2 bit | 2 bit | 2 bit | 2 bit |
|
||||
// | ... | Top tier | Baseline tier | Lazy compilation |
|
||||
// +-------+----------+---------------+------------------+
|
||||
uint8_t hint_byte = decoder.consume_u8("compilation hint");
|
||||
if (!decoder.ok()) break;
|
||||
|
||||
@ -1028,9 +1028,9 @@ class ModuleDecoderImpl : public Decoder {
|
||||
WasmCompilationHint hint;
|
||||
hint.strategy =
|
||||
static_cast<WasmCompilationHintStrategy>(hint_byte & 0x03);
|
||||
hint.first_tier =
|
||||
hint.baseline_tier =
|
||||
static_cast<WasmCompilationHintTier>(hint_byte >> 2 & 0x3);
|
||||
hint.second_tier =
|
||||
hint.top_tier =
|
||||
static_cast<WasmCompilationHintTier>(hint_byte >> 4 & 0x3);
|
||||
|
||||
// Check strategy.
|
||||
@ -1042,8 +1042,8 @@ class ModuleDecoderImpl : public Decoder {
|
||||
|
||||
// Ensure that the second tier never downgrades the compilation result.
|
||||
// If first and secod tier are the same it will be invoked only once.
|
||||
if (hint.second_tier < hint.first_tier &&
|
||||
hint.second_tier != WasmCompilationHintTier::kDefault) {
|
||||
if (hint.top_tier < hint.baseline_tier &&
|
||||
hint.top_tier != WasmCompilationHintTier::kDefault) {
|
||||
decoder.errorf(decoder.pc(),
|
||||
"Invalid compilation hint %#x (forbidden downgrade)",
|
||||
hint_byte);
|
||||
|
@ -159,8 +159,8 @@ enum class WasmCompilationHintTier : uint8_t {
|
||||
// Static representation of a wasm compilation hint
|
||||
struct WasmCompilationHint {
|
||||
WasmCompilationHintStrategy strategy;
|
||||
WasmCompilationHintTier first_tier;
|
||||
WasmCompilationHintTier second_tier;
|
||||
WasmCompilationHintTier baseline_tier;
|
||||
WasmCompilationHintTier top_tier;
|
||||
};
|
||||
|
||||
enum ModuleOrigin : uint8_t { kWasmOrigin, kAsmJsOrigin };
|
||||
|
@ -688,13 +688,13 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
|
||||
#define COMPILE_STRATEGY_DEFAULT (0x00)
|
||||
#define COMPILE_STRATEGY_LAZY (0x01)
|
||||
#define COMPILE_STRATEGY_EAGER (0x02)
|
||||
#define FIRST_TIER_DEFAULT (0x00 << 2)
|
||||
#define FIRST_TIER_INTERPRETER (0x01 << 2)
|
||||
#define FIRST_TIER_BASELINE (0x02 << 2)
|
||||
#define FIRST_TIER_OPTIMIZED (0x03 << 2)
|
||||
#define SECOND_TIER_DEFAULT (0x00 << 4)
|
||||
#define SECOND_TIER_INTERPRETER (0x01 << 4)
|
||||
#define SECOND_TIER_BASELINE (0x02 << 4)
|
||||
#define SECOND_TIER_OPTIMIZED (0x03 << 4)
|
||||
#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 TOP_TIER_DEFAULT (0x00 << 4)
|
||||
#define TOP_TIER_INTERPRETER (0x01 << 4)
|
||||
#define TOP_TIER_BASELINE (0x02 << 4)
|
||||
#define TOP_TIER_OPTIMIZED (0x03 << 4)
|
||||
|
||||
#endif // V8_WASM_MACRO_GEN_H_
|
||||
|
@ -95,7 +95,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let instance = builder.instantiate();
|
||||
})();
|
||||
|
||||
(function testDecodeCompilationHintsSectionSecondTierDefault() {
|
||||
(function testDecodeCompilationHintsSectionTopTierDefault() {
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('sq', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
|
@ -640,8 +640,8 @@ class WasmFunctionBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
giveCompilationHint(strategy, firstTier, secondTier) {
|
||||
this.module.giveCompilationHint(strategy, firstTier, secondTier, this.index);
|
||||
giveCompilationHint(strategy, baselineTier, topTier) {
|
||||
this.module.giveCompilationHint(strategy, baselineTier, topTier, this.index);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -871,9 +871,9 @@ class WasmModuleBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
giveCompilationHint(strategy, firstTier, secondTier, index) {
|
||||
this.compilation_hints[index] = {strategy: strategy, firstTier: firstTier,
|
||||
secondTier: secondTier};
|
||||
giveCompilationHint(strategy, baselineTier, topTier, index) {
|
||||
this.compilation_hints[index] = {strategy: strategy, baselineTier:
|
||||
baselineTier, topTier: topTier};
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -1206,8 +1206,8 @@ class WasmModuleBuilder {
|
||||
var hintByte;
|
||||
if(index in wasm.compilation_hints) {
|
||||
let hint = wasm.compilation_hints[index];
|
||||
hintByte = hint.strategy | (hint.firstTier << 2) |
|
||||
(hint.secondTier << 4);
|
||||
hintByte = hint.strategy | (hint.baselineTier << 2) |
|
||||
(hint.topTier << 4);
|
||||
} else{
|
||||
hintByte = defaultHintByte;
|
||||
}
|
||||
|
@ -1318,9 +1318,9 @@ TEST_F(WasmModuleVerifyTest, TieringCompilationHints) {
|
||||
SIGNATURES_SECTION(1, SIG_ENTRY_v_v),
|
||||
FUNCTION_SIGNATURES_SECTION(3, 0, 0, 0),
|
||||
SECTION_COMPILATION_HINTS(
|
||||
FIRST_TIER_INTERPRETER | SECOND_TIER_BASELINE,
|
||||
FIRST_TIER_BASELINE | SECOND_TIER_OPTIMIZED,
|
||||
FIRST_TIER_INTERPRETER | SECOND_TIER_INTERPRETER),
|
||||
BASELINE_TIER_INTERPRETER | TOP_TIER_BASELINE,
|
||||
BASELINE_TIER_BASELINE | TOP_TIER_OPTIMIZED,
|
||||
BASELINE_TIER_INTERPRETER | TOP_TIER_INTERPRETER),
|
||||
SECTION(Code, ENTRY_COUNT(3), NOP_BODY, NOP_BODY, NOP_BODY),
|
||||
};
|
||||
|
||||
@ -1331,21 +1331,21 @@ TEST_F(WasmModuleVerifyTest, TieringCompilationHints) {
|
||||
EXPECT_EQ(WasmCompilationHintStrategy::kDefault,
|
||||
result.value()->compilation_hints[0].strategy);
|
||||
EXPECT_EQ(WasmCompilationHintTier::kInterpreter,
|
||||
result.value()->compilation_hints[0].first_tier);
|
||||
result.value()->compilation_hints[0].baseline_tier);
|
||||
EXPECT_EQ(WasmCompilationHintTier::kBaseline,
|
||||
result.value()->compilation_hints[0].second_tier);
|
||||
result.value()->compilation_hints[0].top_tier);
|
||||
EXPECT_EQ(WasmCompilationHintStrategy::kDefault,
|
||||
result.value()->compilation_hints[1].strategy);
|
||||
EXPECT_EQ(WasmCompilationHintTier::kBaseline,
|
||||
result.value()->compilation_hints[1].first_tier);
|
||||
result.value()->compilation_hints[1].baseline_tier);
|
||||
EXPECT_EQ(WasmCompilationHintTier::kOptimized,
|
||||
result.value()->compilation_hints[1].second_tier);
|
||||
result.value()->compilation_hints[1].top_tier);
|
||||
EXPECT_EQ(WasmCompilationHintStrategy::kDefault,
|
||||
result.value()->compilation_hints[2].strategy);
|
||||
EXPECT_EQ(WasmCompilationHintTier::kInterpreter,
|
||||
result.value()->compilation_hints[2].first_tier);
|
||||
result.value()->compilation_hints[2].baseline_tier);
|
||||
EXPECT_EQ(WasmCompilationHintTier::kInterpreter,
|
||||
result.value()->compilation_hints[2].second_tier);
|
||||
result.value()->compilation_hints[2].top_tier);
|
||||
}
|
||||
|
||||
class WasmSignatureDecodeTest : public TestWithZone {
|
||||
|
Loading…
Reference in New Issue
Block a user