Chromium Code Reviews| Index: runtime/vm/intermediate_language.cc |
| =================================================================== |
| --- runtime/vm/intermediate_language.cc (revision 10885) |
| +++ runtime/vm/intermediate_language.cc (working copy) |
| @@ -21,6 +21,47 @@ |
| 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; |
|
srdjan
2012/08/17 22:30:22
Weird indentation.
Florian Schneider
2012/08/20 12:09:37
Done.
|
| +} |
| + |
| + |
| +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); |
| +} |
| + |
|
srdjan
2012/08/17 22:30:22
One line too much
Florian Schneider
2012/08/20 12:09:37
Done.
|
| + |
| + |
| +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; |
| + } |
| + } |
|
srdjan
2012/08/17 22:30:22
You may want to move this loop and tests into clas
|
| + return true; |
| +} |
| + |
| + |
| UseVal::UseVal(Definition* definition) |
| : definition_(definition), next_use_(NULL), previous_use_(NULL) { |
| AddToUseList(); |
| @@ -177,6 +218,18 @@ |
| } |
| +void Instruction::InsertBefore(Instruction* next) { |
| + ASSERT(previous_ == NULL); |
| + ASSERT(next_ == NULL); |
| + ASSERT(IsBind()); |
|
srdjan
2012/08/17 22:30:22
Why don't you put this method in BindInstr then?
Florian Schneider
2012/08/20 12:09:37
Done.
|
| + ASSERT(!next->IsBlockEntry()); |
| + next_ = next; |
| + previous_ = next->previous_; |
| + next->previous_ = this; |
| + previous_->next_ = this; |
| +} |
| + |
| + |
| void ForwardInstructionIterator::RemoveCurrentFromGraph() { |
| current_ = current_->RemoveFromGraph(true); // Set current_ to previous. |
| } |
| @@ -965,6 +1018,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 |