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

Unified Diff: runtime/vm/intermediate_language.h

Issue 27307005: Change == into an instance call to allow polymorphic inlining of ==. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased, addressed comments Created 7 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
===================================================================
--- runtime/vm/intermediate_language.h (revision 29797)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -39,6 +39,7 @@
// See intrinsifier for fingerprint computation.
#define RECOGNIZED_LIST(V) \
V(::, identical, ObjectIdentical, 496869842) \
+ V(Object, ==, ObjectEquals, 180968008) \
V(Object, Object., ObjectConstructor, 1058585294) \
V(Object, get:_cid, ObjectCid, 1498721510) \
V(_List, get:length, ObjectArrayLength, 215153395) \
@@ -1015,6 +1016,7 @@
friend class BranchSimplifier;
friend class BlockEntryInstr;
friend class RelationalOpInstr;
+ friend class EqualityCompareInstr;
virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
@@ -2733,6 +2735,7 @@
ASSERT(!arguments->is_empty());
ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap());
ASSERT(Token::IsBinaryOperator(token_kind) ||
+ Token::IsEqualityOperator(token_kind) ||
Token::IsRelationalOperator(token_kind) ||
Token::IsPrefixOperator(token_kind) ||
Token::IsIndexOperator(token_kind) ||
@@ -2988,43 +2991,25 @@
Token::Kind kind,
Value* left,
Value* right,
- const Array& ic_data_array)
- : ComparisonInstr(token_pos, kind, left, right),
- ic_data_(GetICData(ic_data_array)),
- unary_ic_data_(NULL) {
- ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
- if (HasICData()) {
- unary_ic_data_ = &ICData::ZoneHandle(ic_data_->AsUnaryClassChecks());
- }
+ intptr_t cid,
+ intptr_t deopt_id)
+ : ComparisonInstr(token_pos, kind, left, right) {
+ ASSERT(Token::IsEqualityOperator(kind));
+ set_operation_cid(cid);
+ deopt_id_ = deopt_id; // Override generated deopt-id.
}
DECLARE_INSTRUCTION(EqualityCompare)
virtual CompileType ComputeType() const;
virtual bool RecomputeType();
- const ICData* ic_data() const { return ic_data_; }
- bool HasICData() const {
- return (ic_data() != NULL) && !ic_data()->IsNull();
- }
- void set_ic_data(const ICData* value) {
- ic_data_ = value;
- if (HasICData()) {
- unary_ic_data_ = &ICData::ZoneHandle(ic_data_->AsUnaryClassChecks());
- }
- }
-
- bool IsInlinedNumericComparison() const {
- return (operation_cid() == kDoubleCid)
- || (operation_cid() == kMintCid)
- || (operation_cid() == kSmiCid);
- }
-
- bool IsCheckedStrictEqual() const;
-
virtual void PrintOperandsTo(BufferFormatter* f) const;
- virtual bool CanDeoptimize() const {
- return !IsInlinedNumericComparison();
+ virtual bool CanDeoptimize() const { return false; }
+
+ virtual bool CanBecomeDeoptimizationTarget() const {
+ // EqualityCompare can be merged into Branch and thus needs an environment.
+ return true;
}
virtual void EmitBranchCode(FlowGraphCompiler* compiler,
@@ -3041,20 +3026,11 @@
return kTagged;
}
- bool IsPolymorphic() const;
+ virtual EffectSet Effects() const { return EffectSet::None(); }
- virtual EffectSet Effects() const {
- return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All();
- }
+ virtual bool MayThrow() const { return false; }
- virtual bool MayThrow() const {
- return !IsInlinedNumericComparison() && !IsCheckedStrictEqual();
- }
-
private:
- const ICData* ic_data_;
- ICData* unary_ic_data_;
-
DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr);
};
@@ -3781,7 +3757,7 @@
};
-// Note overrideable, built-in: value? false : true.
+// Note overrideable, built-in: value ? false : true.
class BooleanNegateInstr : public TemplateDefinition<1> {
public:
explicit BooleanNegateInstr(Value* value) {
« 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