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

Unified Diff: runtime/vm/intermediate_language.h

Issue 2466643002: AOT: Enable branch merging for checked smi comparisons (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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/il_printer.cc ('k') | runtime/vm/intermediate_language.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 457dd7c4c298dc533c152517ed8193c1e5b10725..3d474f09a5f7aceb0c7c4f4495d73ba33df1337d 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -477,6 +477,7 @@ class EmbeddedArray<T, 0> {
M(AllocateUninitializedContext) \
M(CloneContext) \
M(BinarySmiOp) \
+ M(CheckedSmiComparison) \
M(CheckedSmiOp) \
M(BinaryInt32Op) \
M(UnarySmiOp) \
@@ -2381,7 +2382,7 @@ class ComparisonInstr : public Definition {
void set_operation_cid(intptr_t value) { operation_cid_ = value; }
intptr_t operation_cid() const { return operation_cid_; }
- void NegateComparison() {
+ virtual void NegateComparison() {
kind_ = Token::NegateComparison(kind_);
}
@@ -6997,7 +6998,7 @@ class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> {
Value* left() const { return inputs_[0]; }
Value* right() const { return inputs_[1]; }
- virtual bool CanDeoptimize() const { return true; }
+ virtual bool CanDeoptimize() const { return false; }
virtual EffectSet Effects() const { return EffectSet::All(); }
@@ -7014,6 +7015,53 @@ class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> {
};
+class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> {
+ public:
+ CheckedSmiComparisonInstr(Token::Kind op_kind,
+ Value* left,
+ Value* right,
+ InstanceCallInstr* call)
+ : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()),
+ call_(call),
+ is_negated_(false) {
+ SetInputAt(0, left);
+ SetInputAt(1, right);
+ }
+
+ InstanceCallInstr* call() const { return call_; }
+
+ virtual bool CanDeoptimize() const { return false; }
+
+ virtual Definition* Canonicalize(FlowGraph* flow_graph);
+
+ virtual void NegateComparison() {
+ ComparisonInstr::NegateComparison();
+ is_negated_ = !is_negated_;
+ }
+
+ bool is_negated() const { return is_negated_; }
+
+ virtual EffectSet Effects() const { return EffectSet::All(); }
+
+ PRINT_OPERANDS_TO_SUPPORT
+
+ DECLARE_INSTRUCTION(CheckedSmiComparison)
+
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler,
+ BranchInstr* branch);
+
+ virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
+ BranchLabels labels);
+
+ virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
+
+ private:
+ InstanceCallInstr* call_;
+ bool is_negated_;
+ DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr);
+};
+
+
class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> {
public:
BinaryIntegerOpInstr(Token::Kind op_kind,
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698