diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-02-25 10:04:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 10:04:09 -0800 |
commit | 605e2b7498a7979b59917aa5db17d5022e974c8b (patch) | |
tree | 9cf62a6a4191a8125d86b9d17f272269ea2b8834 /src/ir/ExpressionAnalyzer.cpp | |
parent | f11b7e712fab6f11ce9f51b85459ab199e817cae (diff) | |
download | binaryen-605e2b7498a7979b59917aa5db17d5022e974c8b.tar.gz binaryen-605e2b7498a7979b59917aa5db17d5022e974c8b.tar.bz2 binaryen-605e2b7498a7979b59917aa5db17d5022e974c8b.zip |
SmallVector (#1912)
Trying to refactor the code to be simpler and less redundant, I ran into some perf issues that it seems like a small vector, with fixed-size storage and optional additional storage as needed, might help with. This implements that class and uses it in a few places.
This seems to help, I see some 1-2% fewer instructions and cycles in `perf stat`, but it's hard to tell if it really makes a noticeable difference.
Diffstat (limited to 'src/ir/ExpressionAnalyzer.cpp')
-rw-r--r-- | src/ir/ExpressionAnalyzer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ir/ExpressionAnalyzer.cpp b/src/ir/ExpressionAnalyzer.cpp index e2345d303..28c59491a 100644 --- a/src/ir/ExpressionAnalyzer.cpp +++ b/src/ir/ExpressionAnalyzer.cpp @@ -24,7 +24,7 @@ namespace wasm { // Given a stack of expressions, checks if the topmost is used as a result. // For example, if the parent is a block and the node is before the last position, // it is not used. -bool ExpressionAnalyzer::isResultUsed(std::vector<Expression*> stack, Function* func) { +bool ExpressionAnalyzer::isResultUsed(ExpressionStack& stack, Function* func) { for (int i = int(stack.size()) - 2; i >= 0; i--) { auto* curr = stack[i]; auto* above = stack[i + 1]; @@ -52,7 +52,7 @@ bool ExpressionAnalyzer::isResultUsed(std::vector<Expression*> stack, Function* } // Checks if a value is dropped. -bool ExpressionAnalyzer::isResultDropped(std::vector<Expression*> stack) { +bool ExpressionAnalyzer::isResultDropped(ExpressionStack& stack) { for (int i = int(stack.size()) - 2; i >= 0; i--) { auto* curr = stack[i]; auto* above = stack[i + 1]; |