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/instruction-selector.h

Issue 1019803005: [turbofan] Factor out common switch-related code in instruction selectors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction-selector.h
diff --git a/src/compiler/instruction-selector.h b/src/compiler/instruction-selector.h
index 937ed4db34f2497686e1f12ed1b50f255c85c108..d5156106bb8b51e0ee452c725cd37d7b1a133d16 100644
--- a/src/compiler/instruction-selector.h
+++ b/src/compiler/instruction-selector.h
@@ -23,6 +23,16 @@ struct CallBuffer; // TODO(bmeurer): Remove this.
class FlagsContinuation;
class Linkage;
+struct SwitchInfo {
Benedikt Meurer 2015/03/25 17:52:48 Please move this struct to the -impl.h file, and a
titzer 2015/03/26 08:27:37 Done.
+ int32_t min_value;
+ int32_t max_value;
+ size_t value_range;
+ size_t case_count;
+ int32_t* case_values;
+ BasicBlock** case_branches;
+ BasicBlock* default_branch;
+};
+
typedef ZoneVector<InstructionOperand> InstructionOperandVector;
@@ -134,6 +144,10 @@ class InstructionSelector FINAL {
private:
friend class OperandGenerator;
+ void EmitTableSwitch(const SwitchInfo& sw, InstructionOperand& index_operand);
+ void EmitLookupSwitch(const SwitchInfo& sw,
+ InstructionOperand& value_operand);
+
// Inform the instruction selection that {node} was just defined.
void MarkAsDefined(Node* node);
@@ -201,9 +215,7 @@ class InstructionSelector FINAL {
void VisitCall(Node* call, BasicBlock* handler);
void VisitGoto(BasicBlock* target);
void VisitBranch(Node* input, BasicBlock* tbranch, BasicBlock* fbranch);
- void VisitSwitch(Node* node, BasicBlock* default_branch,
- BasicBlock** case_branches, int32_t* case_values,
- size_t case_count, int32_t min_value, int32_t max_value);
+ void VisitSwitch(Node* node, const SwitchInfo& sw);
void VisitDeoptimize(Node* value);
void VisitReturn(Node* value);
void VisitThrow(Node* value);
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698