Index: runtime/vm/intermediate_language.cc |
=================================================================== |
--- runtime/vm/intermediate_language.cc (revision 10885) |
+++ runtime/vm/intermediate_language.cc (working copy) |
@@ -21,6 +21,46 @@ |
DECLARE_FLAG(bool, enable_type_checks); |
+ |
+intptr_t Computation::Hashcode() const { |
+ intptr_t result = computation_kind(); |
+ for (intptr_t i = 0; i < InputCount(); ++i) { |
+ UseVal* val = InputAt(i)->AsUse(); |
+ intptr_t j = val != NULL |
+ ? val->definition()->ssa_temp_index() |
+ : -1; |
+ result = result * 31 + j; |
+ } |
+ return result; |
+} |
+ |
+ |
+bool Computation::Equals(Computation* other) const { |
+ if (computation_kind() != other->computation_kind()) return false; |
+ for (intptr_t i = 0; i < InputCount(); ++i) { |
+ if (!InputAt(i)->Equals(other->InputAt(i))) return false; |
+ } |
+ return AttributesEqual(other); |
+} |
+ |
+ |
+bool CheckClassComp::AttributesEqual(Computation* other) const { |
+ CheckClassComp* other_check = other->AsCheckClass(); |
+ if (other_check == NULL) return false; |
+ if (ic_data()->NumberOfChecks() != other->ic_data()->NumberOfChecks()) { |
+ return false; |
+ } |
+ for (intptr_t i = 0; i < ic_data()->NumberOfChecks(); ++i) { |
+ // TODO(fschneider): Make sure ic_data are sorted to hit more cases. |
+ if (ic_data()->GetReceiverClassIdAt(i) != |
+ other->ic_data()->GetReceiverClassIdAt(i)) { |
+ return false; |
+ } |
+ } |
+ return true; |
+} |
+ |
+ |
UseVal::UseVal(Definition* definition) |
: definition_(definition), next_use_(NULL), previous_use_(NULL) { |
AddToUseList(); |
@@ -177,6 +217,16 @@ |
} |
+void BindInstr::InsertBefore(BindInstr* next) { |
+ ASSERT(previous_ == NULL); |
+ ASSERT(next_ == NULL); |
+ next_ = next; |
+ previous_ = next->previous_; |
+ next->previous_ = this; |
+ previous_->next_ = this; |
+} |
+ |
+ |
void ForwardInstructionIterator::RemoveCurrentFromGraph() { |
current_ = current_->RemoveFromGraph(true); // Set current_ to previous. |
} |
@@ -965,6 +1015,11 @@ |
} |
+RawAbstractType* CheckClassComp::CompileType() const { |
+ return AbstractType::null(); |
+} |
+ |
+ |
// Shared code generation methods (EmitNativeCode, MakeLocationSummary, and |
// PrepareEntry). Only assembly code that can be shared across all architectures |
// can be used. Machine specific register allocation and code generation |