Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: src/interpreter/bytecode-peephole-optimizer.cc

Issue 1985033002: [Interpreter] Change LogicalNot to ToBooleanLogicalNot and add non-ToBoolean version. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-peephole-optimizer.cc
diff --git a/src/interpreter/bytecode-peephole-optimizer.cc b/src/interpreter/bytecode-peephole-optimizer.cc
index 6b6589af41f544ecffea19a1615d6cdf88b0a811..803fc23089927faf47fe893deb178dd479265d6f 100644
--- a/src/interpreter/bytecode-peephole-optimizer.cc
+++ b/src/interpreter/bytecode-peephole-optimizer.cc
@@ -95,15 +95,21 @@ bool BytecodePeepholeOptimizer::LastBytecodePutsNameInAccumulator() const {
}
void BytecodePeepholeOptimizer::UpdateCurrentBytecode(BytecodeNode* current) {
- // Conditional jumps with boolean conditions are emiitted in
- // ToBoolean form by the bytecode array builder,
- // i.e. JumpIfToBooleanTrue rather JumpIfTrue. The ToBoolean element
- // can be removed if the previous bytecode put a boolean value in
- // the accumulator.
if (Bytecodes::IsJumpIfToBoolean(current->bytecode()) &&
Bytecodes::WritesBooleanToAccumulator(last_.bytecode())) {
+ // Conditional jumps with boolean conditions are emitted in
+ // ToBoolean form by the bytecode array builder,
+ // i.e. JumpIfToBooleanTrue rather JumpIfTrue. The ToBoolean element
+ // can be removed if the previous bytecode put a boolean value in
+ // the accumulator.
Bytecode jump = Bytecodes::GetJumpWithoutToBoolean(current->bytecode());
current->set_bytecode(jump, current->operand(0), current->operand_scale());
+ } else if (current->bytecode() == Bytecode::kToBooleanLogicalNot &&
+ Bytecodes::WritesBooleanToAccumulator(last_.bytecode())) {
+ // Logical-nots are emitted in ToBoolean form by the bytecode array
+ // builder, The ToBoolean element can be removed if the previous bytecode
+ // put a boolean value in the accumulator.
+ current->set_bytecode(Bytecode::kLogicalNot);
}
}
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698