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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 10949019: Turn definitions that do not produce results (e.g. Checks) into instructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index f81bc35e8099da29729a7fb45126a3e9bca93817..6576a7ee62db6faf844c0e84be617e550117d9c2 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -22,7 +22,7 @@ namespace dart {
DECLARE_FLAG(bool, enable_type_checks);
-intptr_t Definition::Hashcode() const {
+intptr_t Instruction::Hashcode() const {
intptr_t result = tag();
for (intptr_t i = 0; i < InputCount(); ++i) {
Value* value = InputAt(i);
@@ -33,7 +33,7 @@ intptr_t Definition::Hashcode() const {
}
-bool Definition::Equals(Definition* other) const {
+bool Instruction::Equals(Instruction* other) const {
if (tag() != other->tag()) return false;
for (intptr_t i = 0; i < InputCount(); ++i) {
if (!InputAt(i)->Equals(other->InputAt(i))) return false;
@@ -47,7 +47,7 @@ bool Value::Equals(Value* other) const {
}
-bool CheckClassInstr::AttributesEqual(Definition* other) const {
+bool CheckClassInstr::AttributesEqual(Instruction* other) const {
CheckClassInstr* other_check = other->AsCheckClass();
ASSERT(other_check != NULL);
if (unary_checks().NumberOfChecks() !=
@@ -65,28 +65,28 @@ bool CheckClassInstr::AttributesEqual(Definition* other) const {
}
-bool CheckArrayBoundInstr::AttributesEqual(Definition* other) const {
+bool CheckArrayBoundInstr::AttributesEqual(Instruction* other) const {
CheckArrayBoundInstr* other_check = other->AsCheckArrayBound();
ASSERT(other_check != NULL);
return array_type() == other_check->array_type();
}
-bool StrictCompareInstr::AttributesEqual(Definition* other) const {
+bool StrictCompareInstr::AttributesEqual(Instruction* other) const {
StrictCompareInstr* other_op = other->AsStrictCompare();
ASSERT(other_op != NULL);
return kind() == other_op->kind();
}
-bool BinarySmiOpInstr::AttributesEqual(Definition* other) const {
+bool BinarySmiOpInstr::AttributesEqual(Instruction* other) const {
BinarySmiOpInstr* other_op = other->AsBinarySmiOp();
ASSERT(other_op != NULL);
return op_kind() == other_op->op_kind();
}
-bool LoadFieldInstr::AttributesEqual(Definition* other) const {
+bool LoadFieldInstr::AttributesEqual(Instruction* other) const {
LoadFieldInstr* other_load = other->AsLoadField();
ASSERT(other_load != NULL);
ASSERT((offset_in_bytes() != other_load->offset_in_bytes()) ||
@@ -96,7 +96,7 @@ bool LoadFieldInstr::AttributesEqual(Definition* other) const {
}
-bool LoadStaticFieldInstr::AttributesEqual(Definition* other) const {
+bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const {
LoadStaticFieldInstr* other_load = other->AsLoadStaticField();
ASSERT(other_load != NULL);
// Assert that the field is initialized.
@@ -106,7 +106,7 @@ bool LoadStaticFieldInstr::AttributesEqual(Definition* other) const {
}
-bool ConstantInstr::AttributesEqual(Definition* other) const {
+bool ConstantInstr::AttributesEqual(Instruction* other) const {
ConstantInstr* other_constant = other->AsConstant();
ASSERT(other_constant != NULL);
return (value().raw() == other_constant->value().raw());
@@ -225,7 +225,7 @@ Instruction* Instruction::RemoveFromGraph(bool return_previous) {
}
-void Definition::InsertBefore(Instruction* next) {
+void Instruction::InsertBefore(Instruction* next) {
ASSERT(previous_ == NULL);
ASSERT(next_ == NULL);
next_ = next;
@@ -235,7 +235,7 @@ void Definition::InsertBefore(Instruction* next) {
}
-void Definition::InsertAfter(Instruction* prev) {
+void Instruction::InsertAfter(Instruction* prev) {
ASSERT(previous_ == NULL);
ASSERT(next_ == NULL);
previous_ = prev;
@@ -245,7 +245,7 @@ void Definition::InsertAfter(Instruction* prev) {
}
-BlockEntryInstr* Definition::GetBlock() const {
+BlockEntryInstr* Instruction::GetBlock() const {
// TODO(fschneider): Implement a faster way to get the block of an
// instruction.
ASSERT(previous() != NULL);
@@ -1200,7 +1200,12 @@ RawAbstractType* CheckEitherNonSmiInstr::CompileType() const {
}
-// Optimizations that eliminate or simplify individual computations.
+// Optimizations that eliminate or simplify individual instructions.
+Instruction* Instruction::Canonicalize() {
+ return this;
+}
+
+
Definition* Definition::Canonicalize() {
Florian Schneider 2012/09/19 13:24:49 Definition::Canonicalize not needed anymore?
Vyacheslav Egorov (Google) 2012/09/21 12:51:40 It is needed to make the code more typesafe to gua
return this;
}
@@ -1222,7 +1227,7 @@ Definition* StrictCompareInstr::Canonicalize() {
}
-Definition* CheckClassInstr::Canonicalize() {
+Instruction* CheckClassInstr::Canonicalize() {
const intptr_t v_cid = value()->ResultCid();
const intptr_t num_checks = unary_checks().NumberOfChecks();
if ((num_checks == 1) &&
@@ -1234,12 +1239,12 @@ Definition* CheckClassInstr::Canonicalize() {
}
-Definition* CheckSmiInstr::Canonicalize() {
+Instruction* CheckSmiInstr::Canonicalize() {
return (value()->ResultCid() == kSmiCid) ? NULL : this;
}
-Definition* CheckEitherNonSmiInstr::Canonicalize() {
+Instruction* CheckEitherNonSmiInstr::Canonicalize() {
if ((left()->ResultCid() == kDoubleCid) ||
(right()->ResultCid() == kDoubleCid)) {
return NULL; // Remove from the graph.
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698