diff options
author | Alon Zakai <azakai@google.com> | 2020-11-15 20:47:17 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-15 20:47:17 -0800 |
commit | eb4d1bb700b1ac3ef95bb396ea7ea3ef96dc099d (patch) | |
tree | 3939781fb643284cd203e66749aa0d9910e7e367 /src | |
parent | 59a74f9bfc83bd1cf67208bb41ecb3f9bda492e6 (diff) | |
download | binaryen-eb4d1bb700b1ac3ef95bb396ea7ea3ef96dc099d.tar.gz binaryen-eb4d1bb700b1ac3ef95bb396ea7ea3ef96dc099d.tar.bz2 binaryen-eb4d1bb700b1ac3ef95bb396ea7ea3ef96dc099d.zip |
[cost.h] Require all expressions to be define a cost (#3363)
Almost NFC, but adds a cost to DataDrop, 5, which tries to reflect
that it is costlier than a call (it calls into VM internals) but also not
much more, as it actually helps perf in the long term, so it should be
preferred where possible.
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/cost.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ir/cost.h b/src/ir/cost.h index b8a4bf64a..95ef99b65 100644 --- a/src/ir/cost.h +++ b/src/ir/cost.h @@ -24,7 +24,7 @@ namespace wasm { // Measure the execution cost of an AST. Very handwave-ey -struct CostAnalyzer : public Visitor<CostAnalyzer, Index> { +struct CostAnalyzer : public OverriddenVisitor<CostAnalyzer, Index> { CostAnalyzer(Expression* ast) { cost = visit(ast); } Index cost; @@ -550,6 +550,21 @@ struct CostAnalyzer : public Visitor<CostAnalyzer, Index> { Index visitPop(Pop* curr) { return 0; } Index visitNop(Nop* curr) { return 0; } Index visitUnreachable(Unreachable* curr) { return 0; } + Index visitDataDrop(DataDrop* curr) { return 5; } + Index visitI31New(I31New* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitI31Get(I31Get* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitRefTest(RefTest* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitRefCast(RefCast* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitBrOnCast(BrOnCast* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitRttCanon(RttCanon* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitRttSub(RttSub* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitStructNew(StructNew* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitStructGet(StructGet* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitStructSet(StructSet* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitArrayNew(ArrayNew* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitArrayGet(ArrayGet* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitArraySet(ArraySet* curr) { WASM_UNREACHABLE("TODO: GC"); } + Index visitArrayLen(ArrayLen* curr) { WASM_UNREACHABLE("TODO: GC"); } }; } // namespace wasm |