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

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 2666283002: [turbofan] Constant propagation for JumpIfFalse/JumpIfTrue. (Closed)
Patch Set: REBASE Created 3 years, 11 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/code-stub-assembler.cc ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index f6790a863d735b6c8622b45cfdb4f94c0379c72c..acf12ef8594da23d2e22cb39da6a7127d44919e5 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -2072,11 +2072,25 @@ void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) {
}
void BytecodeGraphBuilder::BuildJumpIfFalse() {
- BuildJumpIfNot(environment()->LookupAccumulator());
+ NewBranch(environment()->LookupAccumulator());
+ Environment* if_true_environment = environment()->Copy();
+ environment()->BindAccumulator(jsgraph()->FalseConstant());
+ NewIfFalse();
+ MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset());
+ if_true_environment->BindAccumulator(jsgraph()->TrueConstant());
+ set_environment(if_true_environment);
+ NewIfTrue();
}
void BytecodeGraphBuilder::BuildJumpIfTrue() {
- BuildJumpIf(environment()->LookupAccumulator());
+ NewBranch(environment()->LookupAccumulator());
+ Environment* if_false_environment = environment()->Copy();
+ environment()->BindAccumulator(jsgraph()->TrueConstant());
+ NewIfTrue();
+ MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset());
+ if_false_environment->BindAccumulator(jsgraph()->FalseConstant());
+ set_environment(if_false_environment);
+ NewIfFalse();
}
void BytecodeGraphBuilder::BuildJumpIfToBooleanTrue() {
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698