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

Unified Diff: vm/intermediate_language.cc

Issue 10831178: Refactor Instruction classes to use a template base class. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
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
Index: vm/intermediate_language.cc
===================================================================
--- vm/intermediate_language.cc (revision 10287)
+++ vm/intermediate_language.cc (working copy)
@@ -188,135 +188,6 @@
}
-intptr_t BranchInstr::InputCount() const {
- return 2;
-}
-
-
-Value* BranchInstr::InputAt(intptr_t i) const {
- if (i == 0) return left();
- if (i == 1) return right();
- UNREACHABLE();
- return NULL;
-}
-
-
-void BranchInstr::SetInputAt(intptr_t i, Value* value) {
- if (i == 0) {
- left_ = value;
- } else if (i == 1) {
- right_ = value;
- } else {
- UNREACHABLE();
- }
-}
-
-
-intptr_t ParallelMoveInstr::InputCount() const {
- UNREACHABLE();
- return 0;
-}
-
-
-Value* ParallelMoveInstr::InputAt(intptr_t i) const {
- UNREACHABLE();
- return NULL;
-}
-
-
-void ParallelMoveInstr::SetInputAt(intptr_t i, Value* value) {
- UNREACHABLE();
-}
-
-
-intptr_t GotoInstr::InputCount() const {
- return 0;
-}
-
-
-Value* GotoInstr::InputAt(intptr_t i) const {
- UNREACHABLE();
- return NULL;
-}
-
-
-void GotoInstr::SetInputAt(intptr_t i, Value* value) {
- UNREACHABLE();
-}
-
-
-intptr_t PushArgumentInstr::InputCount() const {
- return 1;
-}
-
-
-Value* PushArgumentInstr::InputAt(intptr_t i) const {
- if (i == 0) return value();
- UNREACHABLE();
- return NULL;
-}
-
-
-void PushArgumentInstr::SetInputAt(intptr_t i, Value* value) {
- if (i == 0) {
- value_ = value;
- return;
- }
- UNREACHABLE();
-}
-
-
-intptr_t ReturnInstr::InputCount() const {
- return 1;
-}
-
-
-Value* ReturnInstr::InputAt(intptr_t i) const {
- if (i == 0) return value();
- UNREACHABLE();
- return NULL;
-}
-
-
-void ReturnInstr::SetInputAt(intptr_t i, Value* value) {
- if (i == 0) {
- value_ = value;
- return;
- }
- UNREACHABLE();
-}
-
-
-intptr_t BindInstr::InputCount() const {
- return computation()->InputCount();
-}
-
-
-Value* BindInstr::InputAt(intptr_t i) const {
- return computation()->InputAt(i);
-}
-
-
-void BindInstr::SetInputAt(intptr_t i, Value* value) {
- computation()->SetInputAt(i, value);
-}
-
-
-intptr_t PhiInstr::InputCount() const {
- return inputs_.length();
-}
-
-
-Value* PhiInstr::InputAt(intptr_t i) const {
- return inputs_[i];
-}
-
-
-void PhiInstr::SetInputAt(intptr_t i, Value* value) {
- inputs_[i] = value;
-}
-
-
RawAbstractType* PhiInstr::StaticType() const {
// TODO(regis): Return the least upper bound of the input static types.
// It is much simpler to compute the least specific of the input static types,
@@ -342,22 +213,6 @@
}
-intptr_t ParameterInstr::InputCount() const {
- return 0;
-}
-
-
-Value* ParameterInstr::InputAt(intptr_t i) const {
- UNREACHABLE();
- return NULL;
-}
-
-
-void ParameterInstr::SetInputAt(intptr_t i, Value* value) {
- UNREACHABLE();
-}
-
-
RawAbstractType* ParameterInstr::StaticType() const {
// TODO(regis): Can type feedback provide information about the static type
// of a passed-in parameter?
@@ -369,54 +224,6 @@
}
-intptr_t GraphEntryInstr::InputCount() const {
- return 0;
-}
-
-
-Value* GraphEntryInstr::InputAt(intptr_t i) const {
- UNREACHABLE();
- return NULL;
-}
-
-
-void GraphEntryInstr::SetInputAt(intptr_t i, Value* value) {
- UNREACHABLE();
-}
-
-
-intptr_t TargetEntryInstr::InputCount() const {
- return 0;
-}
-
-
-Value* TargetEntryInstr::InputAt(intptr_t i) const {
- UNREACHABLE();
- return NULL;
-}
-
-
-void TargetEntryInstr::SetInputAt(intptr_t i, Value* value) {
- UNREACHABLE();
-}
-
-
-intptr_t JoinEntryInstr::InputCount() const {
- return 0;
-}
-
-
-Value* JoinEntryInstr::InputAt(intptr_t i) const {
- UNREACHABLE();
- return NULL;
-}
-
-
-void JoinEntryInstr::SetInputAt(intptr_t i, Value* value) {
- UNREACHABLE();
-}
-
-
intptr_t JoinEntryInstr::IndexOfPredecessor(BlockEntryInstr* pred) const {
for (intptr_t i = 0; i < predecessors_.length(); ++i) {
if (predecessors_[i] == pred) return i;

Powered by Google App Engine
This is Rietveld 408576698