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

Unified Diff: src/compiler/operator-properties-inl.h

Issue 680313003: Move input/output counts directly into Operators, simplying OperatorProperties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: yes Created 6 years, 2 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 | « src/compiler/operator.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/operator-properties-inl.h
diff --git a/src/compiler/operator-properties-inl.h b/src/compiler/operator-properties-inl.h
index 0488b1b7c6598e028c72e4d6c2ab6bbf70ad674c..409e4f00dfe5a1c3114a2b0b3e959cd5a8b0842d 100644
--- a/src/compiler/operator-properties-inl.h
+++ b/src/compiler/operator-properties-inl.h
@@ -16,7 +16,7 @@ namespace internal {
namespace compiler {
inline bool OperatorProperties::HasValueInput(const Operator* op) {
- return OperatorProperties::GetValueInputCount(op) > 0;
+ return op->ValueInputCount() > 0;
}
inline bool OperatorProperties::HasContextInput(const Operator* op) {
@@ -25,11 +25,11 @@ inline bool OperatorProperties::HasContextInput(const Operator* op) {
}
inline bool OperatorProperties::HasEffectInput(const Operator* op) {
- return OperatorProperties::GetEffectInputCount(op) > 0;
+ return op->EffectInputCount() > 0;
}
inline bool OperatorProperties::HasControlInput(const Operator* op) {
- return OperatorProperties::GetControlInputCount(op) > 0;
+ return op->ControlInputCount() > 0;
}
inline bool OperatorProperties::HasFrameStateInput(const Operator* op) {
@@ -94,7 +94,7 @@ inline bool OperatorProperties::HasFrameStateInput(const Operator* op) {
}
inline int OperatorProperties::GetValueInputCount(const Operator* op) {
- return op->InputCount();
+ return op->ValueInputCount();
}
inline int OperatorProperties::GetContextInputCount(const Operator* op) {
@@ -106,44 +106,11 @@ inline int OperatorProperties::GetFrameStateInputCount(const Operator* op) {
}
inline int OperatorProperties::GetEffectInputCount(const Operator* op) {
- if (op->opcode() == IrOpcode::kEffectPhi ||
- op->opcode() == IrOpcode::kFinish ||
- op->opcode() == IrOpcode::kTerminate) {
- return OpParameter<int>(op);
- }
- if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite))
- return 0; // no effects.
- return 1;
+ return op->EffectInputCount();
}
inline int OperatorProperties::GetControlInputCount(const Operator* op) {
- // TODO(titzer): fix this mess; just make them a count on the operator.
- switch (op->opcode()) {
- case IrOpcode::kPhi:
- case IrOpcode::kEffectPhi:
- case IrOpcode::kLoad:
- case IrOpcode::kLoadField:
- case IrOpcode::kInt32Div:
- case IrOpcode::kInt32Mod:
- case IrOpcode::kUint32Div:
- case IrOpcode::kUint32Mod:
- return 1;
-#define OPCODE_CASE(x) case IrOpcode::k##x:
- CONTROL_OP_LIST(OPCODE_CASE)
-#undef OPCODE_CASE
- if (op->opcode() == IrOpcode::kBranch) return 1;
- if (op->opcode() == IrOpcode::kTerminate) return 1;
- // Control operators are Operator1<int>.
- return OpParameter<int>(op);
- default:
- // Operators that have write effects must have a control
- // dependency. Effect dependencies only ensure the correct order of
- // write/read operations without consideration of control flow. Without an
- // explicit control dependency writes can be float in the schedule too
- // early along a path that shouldn't generate a side-effect.
- return op->HasProperty(Operator::kNoWrite) ? 0 : 1;
- }
- return 0;
+ return op->ControlInputCount();
}
inline int OperatorProperties::GetTotalInputCount(const Operator* op) {
@@ -156,33 +123,28 @@ inline int OperatorProperties::GetTotalInputCount(const Operator* op) {
// Output properties.
inline bool OperatorProperties::HasValueOutput(const Operator* op) {
- return GetValueOutputCount(op) > 0;
+ return op->ValueOutputCount() > 0;
}
inline bool OperatorProperties::HasEffectOutput(const Operator* op) {
- return op->opcode() == IrOpcode::kStart ||
- op->opcode() == IrOpcode::kValueEffect ||
- (op->opcode() != IrOpcode::kFinish &&
- op->opcode() != IrOpcode::kTerminate && GetEffectInputCount(op) > 0);
+ return op->EffectOutputCount() > 0;
}
inline bool OperatorProperties::HasControlOutput(const Operator* op) {
- IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
- return (opcode != IrOpcode::kEnd && IrOpcode::IsControlOpcode(opcode));
+ return op->ControlOutputCount() > 0;
}
inline int OperatorProperties::GetValueOutputCount(const Operator* op) {
- return op->OutputCount();
+ return op->ValueOutputCount();
}
inline int OperatorProperties::GetEffectOutputCount(const Operator* op) {
- return HasEffectOutput(op) ? 1 : 0;
+ return op->EffectOutputCount();
}
-inline int OperatorProperties::GetControlOutputCount(const Operator* node) {
- return node->opcode() == IrOpcode::kBranch ? 2 : HasControlOutput(node) ? 1
- : 0;
+inline int OperatorProperties::GetControlOutputCount(const Operator* op) {
+ return op->ControlOutputCount();
}
« no previous file with comments | « src/compiler/operator.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698