Index: src/compiler/bytecode-graph-builder.cc |
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc |
index e0b1e7a0bd94d1ec3af39fca696478ee321147b6..d51b52b072249226185044e6347fe4fe86dd86c7 100644 |
--- a/src/compiler/bytecode-graph-builder.cc |
+++ b/src/compiler/bytecode-graph-builder.cc |
@@ -1462,37 +1462,28 @@ void BytecodeGraphBuilder::VisitJump() { BuildJump(); } |
void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); } |
+void BytecodeGraphBuilder::VisitJumpIfTrue() { BuildJumpIfTrue(); } |
-void BytecodeGraphBuilder::VisitJumpIfTrue() { |
- BuildJumpIfEqual(jsgraph()->TrueConstant()); |
-} |
+void BytecodeGraphBuilder::VisitJumpIfTrueConstant() { BuildJumpIfTrue(); } |
-void BytecodeGraphBuilder::VisitJumpIfTrueConstant() { |
- BuildJumpIfEqual(jsgraph()->TrueConstant()); |
-} |
+void BytecodeGraphBuilder::VisitJumpIfFalse() { BuildJumpIfFalse(); } |
-void BytecodeGraphBuilder::VisitJumpIfFalse() { |
- BuildJumpIfEqual(jsgraph()->FalseConstant()); |
-} |
- |
-void BytecodeGraphBuilder::VisitJumpIfFalseConstant() { |
- BuildJumpIfEqual(jsgraph()->FalseConstant()); |
-} |
+void BytecodeGraphBuilder::VisitJumpIfFalseConstant() { BuildJumpIfFalse(); } |
void BytecodeGraphBuilder::VisitJumpIfToBooleanTrue() { |
- BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); |
+ BuildJumpIfToBooleanTrue(); |
} |
void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstant() { |
- BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); |
+ BuildJumpIfToBooleanTrue(); |
} |
void BytecodeGraphBuilder::VisitJumpIfToBooleanFalse() { |
- BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); |
+ BuildJumpIfToBooleanFalse(); |
} |
void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() { |
- BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); |
+ BuildJumpIfToBooleanFalse(); |
} |
void BytecodeGraphBuilder::VisitJumpIfNotHole() { BuildJumpIfNotHole(); } |
@@ -1728,8 +1719,7 @@ void BytecodeGraphBuilder::BuildJump() { |
MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); |
} |
- |
-void BytecodeGraphBuilder::BuildConditionalJump(Node* condition) { |
+void BytecodeGraphBuilder::BuildJumpIf(Node* condition) { |
NewBranch(condition); |
Environment* if_false_environment = environment()->CopyForConditional(); |
NewIfTrue(); |
@@ -1738,24 +1728,43 @@ void BytecodeGraphBuilder::BuildConditionalJump(Node* condition) { |
NewIfFalse(); |
} |
+void BytecodeGraphBuilder::BuildJumpIfNot(Node* condition) { |
+ NewBranch(condition); |
+ Environment* if_true_environment = environment()->CopyForConditional(); |
+ NewIfFalse(); |
+ MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); |
+ set_environment(if_true_environment); |
+ NewIfTrue(); |
+} |
void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) { |
Node* accumulator = environment()->LookupAccumulator(); |
Node* condition = |
NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), |
accumulator, comperand); |
- BuildConditionalJump(condition); |
+ BuildJumpIf(condition); |
} |
+void BytecodeGraphBuilder::BuildJumpIfFalse() { |
+ BuildJumpIfNot(environment()->LookupAccumulator()); |
+} |
-void BytecodeGraphBuilder::BuildJumpIfToBooleanEqual(Node* comperand) { |
+void BytecodeGraphBuilder::BuildJumpIfTrue() { |
+ BuildJumpIf(environment()->LookupAccumulator()); |
+} |
+ |
+void BytecodeGraphBuilder::BuildJumpIfToBooleanTrue() { |
Node* accumulator = environment()->LookupAccumulator(); |
- Node* to_boolean = |
+ Node* condition = |
NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), accumulator); |
+ BuildJumpIf(condition); |
+} |
+ |
+void BytecodeGraphBuilder::BuildJumpIfToBooleanFalse() { |
+ Node* accumulator = environment()->LookupAccumulator(); |
Node* condition = |
- NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), to_boolean, |
- comperand); |
- BuildConditionalJump(condition); |
+ NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), accumulator); |
+ BuildJumpIfNot(condition); |
} |
void BytecodeGraphBuilder::BuildJumpIfNotHole() { |
@@ -1763,10 +1772,7 @@ void BytecodeGraphBuilder::BuildJumpIfNotHole() { |
Node* condition = |
NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), |
accumulator, jsgraph()->TheHoleConstant()); |
- Node* node = |
- NewNode(common()->Select(MachineRepresentation::kTagged), condition, |
- jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); |
- BuildConditionalJump(node); |
+ BuildJumpIfNot(condition); |
} |
Node** BytecodeGraphBuilder::EnsureInputBufferSize(int size) { |