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

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

Issue 462633003: Provide mutators in NodeProperties instead of exposing indicies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « src/compiler/node-properties.h ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node-properties-inl.h
diff --git a/src/compiler/node-properties-inl.h b/src/compiler/node-properties-inl.h
index ea58b4d8a1982bc10cc6d109dda72ba20ac8f735..2d63b0cc1b75061fde3d2a573f4d67f0e07d8f1c 100644
--- a/src/compiler/node-properties-inl.h
+++ b/src/compiler/node-properties-inl.h
@@ -23,13 +23,12 @@ namespace compiler {
// Inputs are always arranged in order as follows:
// 0 [ values, context, effects, control ] node->InputCount()
+inline int NodeProperties::FirstValueIndex(Node* node) { return 0; }
-inline int NodeProperties::GetContextIndex(Node* node) {
+inline int NodeProperties::FirstContextIndex(Node* node) {
return PastValueIndex(node);
}
-inline int NodeProperties::FirstValueIndex(Node* node) { return 0; }
-
inline int NodeProperties::FirstEffectIndex(Node* node) {
return PastContextIndex(node);
}
@@ -45,7 +44,7 @@ inline int NodeProperties::PastValueIndex(Node* node) {
}
inline int NodeProperties::PastContextIndex(Node* node) {
- return GetContextIndex(node) +
+ return FirstContextIndex(node) +
OperatorProperties::GetContextInputCount(node->op());
}
@@ -71,7 +70,7 @@ inline Node* NodeProperties::GetValueInput(Node* node, int index) {
inline Node* NodeProperties::GetContextInput(Node* node) {
DCHECK(OperatorProperties::HasContextInput(node->op()));
- return node->InputAt(GetContextIndex(node));
+ return node->InputAt(FirstContextIndex(node));
}
inline Node* NodeProperties::GetEffectInput(Node* node, int index) {
@@ -106,7 +105,7 @@ inline bool NodeProperties::IsValueEdge(Node::Edge edge) {
inline bool NodeProperties::IsContextEdge(Node::Edge edge) {
Node* node = edge.from();
- return IsInputRange(edge, GetContextIndex(node),
+ return IsInputRange(edge, FirstContextIndex(node),
OperatorProperties::GetContextInputCount(node->op()));
}
@@ -134,13 +133,14 @@ inline bool NodeProperties::IsControl(Node* node) {
// -----------------------------------------------------------------------------
// Miscellaneous mutators.
+inline void NodeProperties::ReplaceControlInput(Node* node, Node* control) {
+ node->ReplaceInput(FirstControlIndex(node), control);
+}
+
inline void NodeProperties::ReplaceEffectInput(Node* node, Node* effect,
int index) {
DCHECK(index < OperatorProperties::GetEffectInputCount(node->op()));
- return node->ReplaceInput(
- OperatorProperties::GetValueInputCount(node->op()) +
- OperatorProperties::GetContextInputCount(node->op()) + index,
- effect);
+ return node->ReplaceInput(FirstEffectIndex(node) + index, effect);
}
inline void NodeProperties::RemoveNonValueInputs(Node* node) {
« no previous file with comments | « src/compiler/node-properties.h ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698