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

Unified Diff: test/cctest/compiler/test-machine-operator-reducer.cc

Issue 684193002: [turbofan] Fix input count in Uint32Mod/Div reduction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Change order of node transformation. 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/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-machine-operator-reducer.cc
diff --git a/test/cctest/compiler/test-machine-operator-reducer.cc b/test/cctest/compiler/test-machine-operator-reducer.cc
index d660bccb47defa220f79a5791c8be85d57fa6315..115967a9ceaf500f3641b52c026576cb99cc0e35 100644
--- a/test/cctest/compiler/test-machine-operator-reducer.cc
+++ b/test/cctest/compiler/test-machine-operator-reducer.cc
@@ -9,6 +9,8 @@
#include "src/compiler/graph-inl.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/machine-operator-reducer.h"
+#include "src/compiler/operator-properties.h"
+#include "src/compiler/operator-properties-inl.h"
#include "src/compiler/typer.h"
#include "test/cctest/compiler/value-helper.h"
@@ -97,7 +99,7 @@ class ReducerTester : public HandleAndZoneScope {
template <typename T>
void CheckFoldBinop(volatile T expect, Node* a, Node* b) {
CHECK_NE(NULL, binop);
- Node* n = graph.NewNode(binop, a, b);
+ Node* n = CreateBinopNode(a, b);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
CHECK(reduction.Changed());
@@ -109,7 +111,7 @@ class ReducerTester : public HandleAndZoneScope {
// the {expect} node.
void CheckBinop(Node* expect, Node* a, Node* b) {
CHECK_NE(NULL, binop);
- Node* n = graph.NewNode(binop, a, b);
+ Node* n = CreateBinopNode(a, b);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
CHECK(reduction.Changed());
@@ -121,7 +123,7 @@ class ReducerTester : public HandleAndZoneScope {
void CheckFoldBinop(Node* left_expect, Node* right_expect, Node* left,
Node* right) {
CHECK_NE(NULL, binop);
- Node* n = graph.NewNode(binop, left, right);
+ Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
CHECK(reduction.Changed());
@@ -136,7 +138,7 @@ class ReducerTester : public HandleAndZoneScope {
void CheckFoldBinop(volatile T left_expect, const Operator* op_expect,
Node* right_expect, Node* left, Node* right) {
CHECK_NE(NULL, binop);
- Node* n = graph.NewNode(binop, left, right);
+ Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction r = reducer.Reduce(n);
CHECK(r.Changed());
@@ -151,11 +153,13 @@ class ReducerTester : public HandleAndZoneScope {
void CheckFoldBinop(Node* left_expect, const Operator* op_expect,
volatile T right_expect, Node* left, Node* right) {
CHECK_NE(NULL, binop);
- Node* n = graph.NewNode(binop, left, right);
+ Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction r = reducer.Reduce(n);
CHECK(r.Changed());
CHECK_EQ(op_expect->opcode(), r.replacement()->op()->opcode());
+ CHECK_EQ(OperatorProperties::GetTotalInputCount(op_expect),
+ r.replacement()->InputCount());
CHECK_EQ(left_expect, r.replacement()->InputAt(0));
CHECK_EQ(right_expect, ValueOf<T>(r.replacement()->InputAt(1)->op()));
}
@@ -168,7 +172,7 @@ class ReducerTester : public HandleAndZoneScope {
Node* p = Parameter();
Node* k = Constant<T>(constant);
{
- Node* n = graph.NewNode(binop, k, p);
+ Node* n = CreateBinopNode(k, p);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
CHECK(!reduction.Changed() || reduction.replacement() == n);
@@ -176,7 +180,7 @@ class ReducerTester : public HandleAndZoneScope {
CHECK_EQ(k, n->InputAt(1));
}
{
- Node* n = graph.NewNode(binop, p, k);
+ Node* n = CreateBinopNode(p, k);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
CHECK(!reduction.Changed());
@@ -192,7 +196,7 @@ class ReducerTester : public HandleAndZoneScope {
CHECK(!binop->HasProperty(Operator::kCommutative));
Node* p = Parameter();
Node* k = Constant<T>(constant);
- Node* n = graph.NewNode(binop, k, p);
+ Node* n = CreateBinopNode(k, p);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
CHECK(!reduction.Changed());
@@ -203,6 +207,15 @@ class ReducerTester : public HandleAndZoneScope {
Node* Parameter(int32_t index = 0) {
return graph.NewNode(common.Parameter(index), graph.start());
}
+
+ private:
+ Node* CreateBinopNode(Node* left, Node* right) {
+ if (binop->ControlInputCount() > 0) {
+ return graph.NewNode(binop, left, right, graph.start());
+ } else {
+ return graph.NewNode(binop, left, right);
+ }
+ }
};
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698