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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 10824349: Implement class id checks as a separate instruction and add a local CSE optimization pass. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698