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

Unified Diff: runtime/vm/intermediate_language.h

Issue 2949513002: Revert "Reduce copying, redundancy & repetition for codegen of comparison instructions" (Closed)
Patch Set: Created 3 years, 6 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 | « runtime/vm/disassembler_arm64.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index cb50a2a0e0c7dfcea0aa311def2bf8184667eaff..588d082bc70a03551fc685729f18f6c3db2a823a 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -536,26 +536,6 @@ FOR_EACH_ABSTRACT_INSTRUCTION(FORWARD_DECLARATION)
DECLARE_INSTRUCTION_NO_BACKEND(type) \
DECLARE_INSTRUCTION_BACKEND()
-#if defined(TARGET_ARCH_DBC)
-#define DECLARE_COMPARISON_METHODS \
- virtual LocationSummary* MakeLocationSummary(Zone* zone, bool optimizing) \
- const; \
- virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, \
- BranchLabels labels); \
- virtual Condition GetNextInstructionCondition(FlowGraphCompiler* compiler, \
- BranchLabels labels);
-#else
-#define DECLARE_COMPARISON_METHODS \
- virtual LocationSummary* MakeLocationSummary(Zone* zone, bool optimizing) \
- const; \
- virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, \
- BranchLabels labels);
-#endif
-
-#define DECLARE_COMPARISON_INSTRUCTION(type) \
- DECLARE_INSTRUCTION_NO_BACKEND(type) \
- DECLARE_COMPARISON_METHODS
-
#ifndef PRODUCT
#define PRINT_TO_SUPPORT virtual void PrintTo(BufferFormatter* f) const;
#else
@@ -986,13 +966,6 @@ class Instruction : public ZoneAllocated {
};
-struct BranchLabels {
- Label* true_label;
- Label* false_label;
- Label* fall_through;
-};
-
-
class PureInstruction : public Instruction {
public:
explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {}
@@ -1947,6 +1920,13 @@ class TemplateDefinition : public CSETrait<Definition, PureDefinition>::Base {
};
+struct BranchLabels {
+ Label* true_label;
+ Label* false_label;
+ Label* fall_through;
+};
+
+
class InductionVariableInfo;
@@ -2365,34 +2345,12 @@ class ComparisonInstr : public Definition {
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0;
- // Emits instructions to do the comparison and branch to the true or false
- // label depending on the result. This implementation will call
- // EmitComparisonCode and then generate the branch instructions afterwards.
- virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler,
+ BranchInstr* branch) = 0;
- // Used by EmitBranchCode and EmitNativeCode depending on whether the boolean
- // is to be turned into branches or instantiated. May return a valid
- // condition in which case the caller is expected to emit a branch to the
- // true label based on that condition (or a branch to the false label on the
- // opposite condition). May also branch directly to the labels.
virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
BranchLabels labels) = 0;
-#if defined(TARGET_ARCH_DBC)
- // On the DBC platform EmitNativeCode needs to know ahead of time what
- // 'Condition' will be returned by EmitComparisonCode. This call must return
- // the same result as EmitComparisonCode, but should not emit any
- // instructions.
- virtual Condition GetNextInstructionCondition(FlowGraphCompiler* compiler,
- BranchLabels labels) = 0;
-#endif
-
- // Emits code that generates 'true' or 'false', depending on the comparison.
- // This implementation will call EmitComparisonCode. If EmitComparisonCode
- // does not use the labels (merely returning a condition) then EmitNativeCode
- // may be able to use the condition to avoid a branch.
- virtual void EmitNativeCode(FlowGraphCompiler* compiler);
-
void SetDeoptId(const Instruction& instr) { CopyDeoptIdFrom(instr); }
// Operation class id is computed from collected ICData.
@@ -3080,7 +3038,7 @@ class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
bool needs_number_check,
intptr_t deopt_id);
- DECLARE_COMPARISON_INSTRUCTION(StrictCompare)
+ DECLARE_INSTRUCTION(StrictCompare)
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
@@ -3090,6 +3048,11 @@ class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
virtual Definition* Canonicalize(FlowGraph* flow_graph);
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
+
+ virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
+ BranchLabels labels);
+
bool needs_number_check() const { return needs_number_check_; }
void set_needs_number_check(bool value) { needs_number_check_ = value; }
@@ -3120,7 +3083,7 @@ class TestSmiInstr : public TemplateComparison<2, NoThrow, Pure> {
SetInputAt(1, right);
}
- DECLARE_COMPARISON_INSTRUCTION(TestSmi);
+ DECLARE_INSTRUCTION(TestSmi);
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
@@ -3132,6 +3095,11 @@ class TestSmiInstr : public TemplateComparison<2, NoThrow, Pure> {
return kTagged;
}
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
+
+ virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
+ BranchLabels labels);
+
private:
DISALLOW_COPY_AND_ASSIGN(TestSmiInstr);
};
@@ -3156,7 +3124,7 @@ class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> {
return cid_results_;
}
- DECLARE_COMPARISON_INSTRUCTION(TestCids);
+ DECLARE_INSTRUCTION(TestCids);
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
@@ -3174,6 +3142,11 @@ class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> {
virtual bool AttributesEqual(Instruction* other) const;
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
+
+ virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
+ BranchLabels labels);
+
void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
PRINT_OPERANDS_TO_SUPPORT
@@ -3200,7 +3173,7 @@ class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
set_operation_cid(cid);
}
- DECLARE_COMPARISON_INSTRUCTION(EqualityCompare)
+ DECLARE_INSTRUCTION(EqualityCompare)
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
@@ -3208,6 +3181,11 @@ class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
virtual bool ComputeCanDeoptimize() const { return false; }
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
+
+ virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
+ BranchLabels labels);
+
virtual Representation RequiredInputRepresentation(intptr_t idx) const {
ASSERT((idx == 0) || (idx == 1));
if (operation_cid() == kDoubleCid) return kUnboxedDouble;
@@ -3237,7 +3215,7 @@ class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> {
set_operation_cid(cid);
}
- DECLARE_COMPARISON_INSTRUCTION(RelationalOp)
+ DECLARE_INSTRUCTION(RelationalOp)
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
@@ -3245,6 +3223,11 @@ class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> {
virtual bool ComputeCanDeoptimize() const { return false; }
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
+
+ virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
+ BranchLabels labels);
+
virtual Representation RequiredInputRepresentation(intptr_t idx) const {
ASSERT((idx == 0) || (idx == 1));
if (operation_cid() == kDoubleCid) return kUnboxedDouble;
@@ -5365,8 +5348,7 @@ class DoubleTestOpInstr : public TemplateComparison<1, NoThrow, Pure> {
PRINT_OPERANDS_TO_SUPPORT
- DECLARE_COMPARISON_INSTRUCTION(DoubleTestOp)
-
+ DECLARE_INSTRUCTION(DoubleTestOp)
virtual CompileType ComputeType() const;
virtual Definition* Canonicalize(FlowGraph* flow_graph);
@@ -5378,6 +5360,11 @@ class DoubleTestOpInstr : public TemplateComparison<1, NoThrow, Pure> {
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
+
+ virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
+ BranchLabels labels);
+
private:
const MethodRecognizer::Kind op_kind_;
@@ -6947,14 +6934,6 @@ class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> {
virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
BranchLabels labels);
-#if defined(TARGET_ARCH_DBC)
- virtual Condition GetNextInstructionCondition(FlowGraphCompiler* compiler,
- BranchLabels labels) {
- UNREACHABLE();
- return INVALID_CONDITION;
- }
-#endif
-
virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
private:
« no previous file with comments | « runtime/vm/disassembler_arm64.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698