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

Unified Diff: src/compiler/instruction-selector.cc

Issue 436593002: [turbofan] Add Int32AddWithOverflow machine operator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add more tests. Created 6 years, 5 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/instruction-selector.h ('k') | src/compiler/instruction-selector-impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc
index 05a86c85002360779baa2775c1ea8181af192e7d..65054e14d0c82bc387d546a60c99b8a7fad26220 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -252,17 +252,8 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
if (buffer->descriptor->ReturnCount() == 1) {
buffer->output_nodes[0] = call;
} else {
- // Iterate over all uses of {call} and collect the projections into the
- // {result} buffer.
- for (UseIter i = call->uses().begin(); i != call->uses().end(); ++i) {
- if ((*i)->opcode() == IrOpcode::kProjection) {
- int index = OpParameter<int32_t>(*i);
- ASSERT_GE(index, 0);
- ASSERT_LT(index, buffer->descriptor->ReturnCount());
- ASSERT_EQ(NULL, buffer->output_nodes[index]);
- buffer->output_nodes[index] = *i;
- }
- }
+ call->CollectProjections(buffer->descriptor->ReturnCount(),
+ buffer->output_nodes);
}
// Filter out the outputs that aren't live because no projection uses them.
@@ -447,13 +438,10 @@ void InstructionSelector::VisitNode(Node* node) {
case IrOpcode::kIfFalse:
case IrOpcode::kEffectPhi:
case IrOpcode::kMerge:
- case IrOpcode::kProjection:
case IrOpcode::kLazyDeoptimization:
case IrOpcode::kContinuation:
// No code needed for these graph artifacts.
return;
- case IrOpcode::kPhi:
- return VisitPhi(node);
case IrOpcode::kParameter: {
int index = OpParameter<int>(node);
MachineRepresentation rep = linkage()
@@ -463,6 +451,10 @@ void InstructionSelector::VisitNode(Node* node) {
MarkAsRepresentation(rep, node);
return VisitParameter(node);
}
+ case IrOpcode::kPhi:
+ return VisitPhi(node);
+ case IrOpcode::kProjection:
+ return VisitProjection(node);
case IrOpcode::kInt32Constant:
case IrOpcode::kInt64Constant:
case IrOpcode::kExternalConstant:
@@ -515,6 +507,8 @@ void InstructionSelector::VisitNode(Node* node) {
return VisitWord64Equal(node);
case IrOpcode::kInt32Add:
return VisitInt32Add(node);
+ case IrOpcode::kInt32AddWithOverflow:
+ return VisitInt32AddWithOverflow(node);
case IrOpcode::kInt32Sub:
return VisitInt32Sub(node);
case IrOpcode::kInt32Mul:
@@ -736,6 +730,13 @@ void InstructionSelector::VisitWord64Compare(Node* node,
#endif // V8_TARGET_ARCH_32_BIT || !V8_TURBOFAN_TARGET
+void InstructionSelector::VisitParameter(Node* node) {
+ OperandGenerator g(this);
+ Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetParameterLocation(
+ OpParameter<int>(node))));
+}
+
+
void InstructionSelector::VisitPhi(Node* node) {
// TODO(bmeurer): Emit a PhiInstruction here.
for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) {
@@ -744,10 +745,10 @@ void InstructionSelector::VisitPhi(Node* node) {
}
-void InstructionSelector::VisitParameter(Node* node) {
- OperandGenerator g(this);
- Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetParameterLocation(
- OpParameter<int>(node))));
+void InstructionSelector::VisitProjection(Node* node) {
+ for (InputIter i = node->inputs().begin(); i != node->inputs().end(); ++i) {
+ MarkAsUsed(*i);
+ }
}
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/instruction-selector-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698