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

Unified Diff: src/interpreter/control-flow-builders.h

Issue 2795183002: [Interpreter] Move ToBoolean elision in BytecodeGenerator. (Closed)
Patch Set: tests Created 3 years, 8 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-peephole-table.h ('k') | src/interpreter/control-flow-builders.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/control-flow-builders.h
diff --git a/src/interpreter/control-flow-builders.h b/src/interpreter/control-flow-builders.h
index 68c28c70d190f3a8e00449dec368390827032505..313c9aa5363748115bfaeb5f89afc44277e35402 100644
--- a/src/interpreter/control-flow-builders.h
+++ b/src/interpreter/control-flow-builders.h
@@ -44,8 +44,12 @@ class V8_EXPORT_PRIVATE BreakableControlFlowBuilder
// Inserts a jump to an unbound label that is patched when the corresponding
// BindBreakTarget is called.
void Break() { EmitJump(&break_labels_); }
- void BreakIfTrue() { EmitJumpIfTrue(&break_labels_); }
- void BreakIfFalse() { EmitJumpIfFalse(&break_labels_); }
+ void BreakIfTrue(BytecodeArrayBuilder::ToBooleanMode mode) {
+ EmitJumpIfTrue(mode, &break_labels_);
+ }
+ void BreakIfFalse(BytecodeArrayBuilder::ToBooleanMode mode) {
+ EmitJumpIfFalse(mode, &break_labels_);
+ }
void BreakIfUndefined() { EmitJumpIfUndefined(&break_labels_); }
void BreakIfNull() { EmitJumpIfNull(&break_labels_); }
@@ -53,8 +57,10 @@ class V8_EXPORT_PRIVATE BreakableControlFlowBuilder
protected:
void EmitJump(BytecodeLabels* labels);
- void EmitJumpIfTrue(BytecodeLabels* labels);
- void EmitJumpIfFalse(BytecodeLabels* labels);
+ void EmitJumpIfTrue(BytecodeArrayBuilder::ToBooleanMode mode,
+ BytecodeLabels* labels);
+ void EmitJumpIfFalse(BytecodeArrayBuilder::ToBooleanMode mode,
+ BytecodeLabels* labels);
void EmitJumpIfUndefined(BytecodeLabels* labels);
void EmitJumpIfNull(BytecodeLabels* labels);
@@ -96,7 +102,6 @@ class V8_EXPORT_PRIVATE LoopBuilder final : public BreakableControlFlowBuilder {
// Inserts a jump to an unbound label that is patched when BindContinueTarget
// is called.
void Continue() { EmitJump(&continue_labels_); }
- void ContinueIfTrue() { EmitJumpIfTrue(&continue_labels_); }
void ContinueIfUndefined() { EmitJumpIfUndefined(&continue_labels_); }
void ContinueIfNull() { EmitJumpIfNull(&continue_labels_); }
@@ -126,9 +131,11 @@ class V8_EXPORT_PRIVATE SwitchBuilder final
void SetCaseTarget(int index);
// This method is called when visiting case comparison operation for |index|.
- // Inserts a JumpIfTrue to a unbound label that is patched when the
- // corresponding SetCaseTarget is called.
- void Case(int index) { builder()->JumpIfTrue(&case_sites_.at(index)); }
+ // Inserts a JumpIfTrue with ToBooleanMode |mode| to a unbound label that is
+ // patched when the corresponding SetCaseTarget is called.
+ void Case(BytecodeArrayBuilder::ToBooleanMode mode, int index) {
+ builder()->JumpIfTrue(mode, &case_sites_.at(index));
+ }
// This method is called when all cases comparisons have been emitted if there
// is a default case statement. Inserts a Jump to a unbound label that is
« no previous file with comments | « src/interpreter/bytecode-peephole-table.h ('k') | src/interpreter/control-flow-builders.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698