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

Unified Diff: test/cctest/compiler/test-representation-change.cc

Issue 1921563002: [turbofan] Initial version of number type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 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/v8.gyp ('k') | test/mjsunit/compiler/turbo-number-feedback.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-representation-change.cc
diff --git a/test/cctest/compiler/test-representation-change.cc b/test/cctest/compiler/test-representation-change.cc
index 6b57244015b9c3032e486195bb8d53df4b37a966..0d6b5b282708118f4fb74fc29bfbf6319fe29806 100644
--- a/test/cctest/compiler/test-representation-change.cc
+++ b/test/cctest/compiler/test-representation-change.cc
@@ -83,12 +83,20 @@ class RepresentationChangerTester : public HandleAndZoneScope,
return n;
}
+ Node* Return(Node* input) {
+ Node* n = graph()->NewNode(common()->Return(), input, graph()->start(),
+ graph()->start());
+ return n;
+ }
+
void CheckTypeError(MachineRepresentation from, Type* from_type,
MachineRepresentation to) {
changer()->testing_type_errors_ = true;
changer()->type_error_ = false;
Node* n = Parameter(0);
- Node* c = changer()->GetRepresentationFor(n, from, from_type, to);
+ Node* use = Return(n);
+ Node* c = changer()->GetRepresentationFor(n, from, from_type, use,
+ UseInfo(to, Truncation::None()));
CHECK(changer()->type_error_);
CHECK_EQ(n, c);
}
@@ -96,7 +104,9 @@ class RepresentationChangerTester : public HandleAndZoneScope,
void CheckNop(MachineRepresentation from, Type* from_type,
MachineRepresentation to) {
Node* n = Parameter(0);
- Node* c = changer()->GetRepresentationFor(n, from, from_type, to);
+ Node* use = Return(n);
+ Node* c = changer()->GetRepresentationFor(n, from, from_type, use,
+ UseInfo(to, Truncation::None()));
CHECK_EQ(n, c);
}
};
@@ -113,15 +123,17 @@ TEST(BoolToBit_constant) {
RepresentationChangerTester r;
Node* true_node = r.jsgraph()->TrueConstant();
+ Node* true_use = r.Return(true_node);
Node* true_bit = r.changer()->GetRepresentationFor(
- true_node, MachineRepresentation::kTagged, Type::None(),
- MachineRepresentation::kBit);
+ true_node, MachineRepresentation::kTagged, Type::None(), true_use,
+ UseInfo(MachineRepresentation::kBit, Truncation::None()));
r.CheckInt32Constant(true_bit, 1);
Node* false_node = r.jsgraph()->FalseConstant();
+ Node* false_use = r.Return(false_node);
Node* false_bit = r.changer()->GetRepresentationFor(
- false_node, MachineRepresentation::kTagged, Type::None(),
- MachineRepresentation::kBit);
+ false_node, MachineRepresentation::kTagged, Type::None(), false_use,
+ UseInfo(MachineRepresentation::kBit, Truncation::None()));
r.CheckInt32Constant(false_bit, 0);
}
@@ -131,9 +143,10 @@ TEST(BitToBool_constant) {
for (int i = -5; i < 5; i++) {
Node* node = r.jsgraph()->Int32Constant(i);
+ Node* use = r.Return(node);
Node* val = r.changer()->GetRepresentationFor(
- node, MachineRepresentation::kBit, Type::Boolean(),
- MachineRepresentation::kTagged);
+ node, MachineRepresentation::kBit, Type::Boolean(), use,
+ UseInfo(MachineRepresentation::kTagged, Truncation::None()));
r.CheckHeapConstant(val, i == 0 ? r.isolate()->heap()->false_value()
: r.isolate()->heap()->true_value());
}
@@ -146,49 +159,54 @@ TEST(ToTagged_constant) {
{
FOR_FLOAT64_INPUTS(i) {
Node* n = r.jsgraph()->Float64Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat64, Type::None(),
- MachineRepresentation::kTagged);
- r.CheckNumberConstant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat64, Type::None(), use,
+ UseInfo(MachineRepresentation::kTagged, Truncation::None()));
+ r.CheckNumberConstant(c, *i);
}
}
{
FOR_FLOAT64_INPUTS(i) {
Node* n = r.jsgraph()->Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat64, Type::None(),
- MachineRepresentation::kTagged);
- r.CheckNumberConstant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat64, Type::None(), use,
+ UseInfo(MachineRepresentation::kTagged, Truncation::None()));
+ r.CheckNumberConstant(c, *i);
}
}
{
FOR_FLOAT32_INPUTS(i) {
Node* n = r.jsgraph()->Float32Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat32, Type::None(),
- MachineRepresentation::kTagged);
- r.CheckNumberConstant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat32, Type::None(), use,
+ UseInfo(MachineRepresentation::kTagged, Truncation::None()));
+ r.CheckNumberConstant(c, *i);
}
}
{
FOR_INT32_INPUTS(i) {
Node* n = r.jsgraph()->Int32Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kWord32, Type::Signed32(),
- MachineRepresentation::kTagged);
- r.CheckNumberConstant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kWord32, Type::Signed32(), use,
+ UseInfo(MachineRepresentation::kTagged, Truncation::None()));
+ r.CheckNumberConstant(c, *i);
}
}
{
FOR_UINT32_INPUTS(i) {
Node* n = r.jsgraph()->Int32Constant(*i);
+ Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kWord32, Type::Unsigned32(),
- MachineRepresentation::kTagged);
+ n, MachineRepresentation::kWord32, Type::Unsigned32(), use,
+ UseInfo(MachineRepresentation::kTagged, Truncation::None()));
r.CheckNumberConstant(c, *i);
}
}
@@ -201,49 +219,54 @@ TEST(ToFloat64_constant) {
{
FOR_FLOAT64_INPUTS(i) {
Node* n = r.jsgraph()->Float64Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat64, Type::None(),
- MachineRepresentation::kFloat64);
- CHECK_EQ(n, c);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat64, Type::None(), use,
+ UseInfo(MachineRepresentation::kFloat64, Truncation::None()));
+ CHECK_EQ(n, c);
}
}
{
FOR_FLOAT64_INPUTS(i) {
Node* n = r.jsgraph()->Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kTagged, Type::None(),
- MachineRepresentation::kFloat64);
- r.CheckFloat64Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kTagged, Type::None(), use,
+ UseInfo(MachineRepresentation::kFloat64, Truncation::None()));
+ r.CheckFloat64Constant(c, *i);
}
}
{
FOR_FLOAT32_INPUTS(i) {
Node* n = r.jsgraph()->Float32Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat32, Type::None(),
- MachineRepresentation::kFloat64);
- r.CheckFloat64Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat32, Type::None(), use,
+ UseInfo(MachineRepresentation::kFloat64, Truncation::None()));
+ r.CheckFloat64Constant(c, *i);
}
}
{
FOR_INT32_INPUTS(i) {
Node* n = r.jsgraph()->Int32Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kWord32, Type::Signed32(),
- MachineRepresentation::kFloat64);
- r.CheckFloat64Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kWord32, Type::Signed32(), use,
+ UseInfo(MachineRepresentation::kFloat64, Truncation::None()));
+ r.CheckFloat64Constant(c, *i);
}
}
{
FOR_UINT32_INPUTS(i) {
Node* n = r.jsgraph()->Int32Constant(*i);
+ Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kWord32, Type::Unsigned32(),
- MachineRepresentation::kFloat64);
+ n, MachineRepresentation::kWord32, Type::Unsigned32(), use,
+ UseInfo(MachineRepresentation::kFloat64, Truncation::None()));
r.CheckFloat64Constant(c, *i);
}
}
@@ -264,30 +287,33 @@ TEST(ToFloat32_constant) {
{
FOR_FLOAT32_INPUTS(i) {
Node* n = r.jsgraph()->Float32Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat32, Type::None(),
- MachineRepresentation::kFloat32);
- CHECK_EQ(n, c);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat32, Type::None(), use,
+ UseInfo(MachineRepresentation::kFloat32, Truncation::None()));
+ CHECK_EQ(n, c);
}
}
{
FOR_FLOAT32_INPUTS(i) {
Node* n = r.jsgraph()->Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kTagged, Type::None(),
- MachineRepresentation::kFloat32);
- r.CheckFloat32Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kTagged, Type::None(), use,
+ UseInfo(MachineRepresentation::kFloat32, Truncation::None()));
+ r.CheckFloat32Constant(c, *i);
}
}
{
FOR_FLOAT32_INPUTS(i) {
Node* n = r.jsgraph()->Float64Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat64, Type::None(),
- MachineRepresentation::kFloat32);
- r.CheckFloat32Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat64, Type::None(), use,
+ UseInfo(MachineRepresentation::kFloat32, Truncation::None()));
+ r.CheckFloat32Constant(c, *i);
}
}
@@ -295,9 +321,10 @@ TEST(ToFloat32_constant) {
FOR_INT32_INPUTS(i) {
if (!IsFloat32Int32(*i)) continue;
Node* n = r.jsgraph()->Int32Constant(*i);
+ Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kWord32, Type::Signed32(),
- MachineRepresentation::kFloat32);
+ n, MachineRepresentation::kWord32, Type::Signed32(), use,
+ UseInfo(MachineRepresentation::kFloat32, Truncation::None()));
r.CheckFloat32Constant(c, static_cast<float>(*i));
}
}
@@ -306,9 +333,10 @@ TEST(ToFloat32_constant) {
FOR_UINT32_INPUTS(i) {
if (!IsFloat32Uint32(*i)) continue;
Node* n = r.jsgraph()->Int32Constant(*i);
+ Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kWord32, Type::Unsigned32(),
- MachineRepresentation::kFloat32);
+ n, MachineRepresentation::kWord32, Type::Unsigned32(), use,
+ UseInfo(MachineRepresentation::kFloat32, Truncation::None()));
r.CheckFloat32Constant(c, static_cast<float>(*i));
}
}
@@ -321,10 +349,11 @@ TEST(ToInt32_constant) {
{
FOR_INT32_INPUTS(i) {
Node* n = r.jsgraph()->Int32Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kWord32, Type::Signed32(),
- MachineRepresentation::kWord32);
- r.CheckInt32Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kWord32, Type::Signed32(), use,
+ UseInfo(MachineRepresentation::kWord32, Truncation::None()));
+ r.CheckInt32Constant(c, *i);
}
}
@@ -332,9 +361,10 @@ TEST(ToInt32_constant) {
FOR_INT32_INPUTS(i) {
if (!IsFloat32Int32(*i)) continue;
Node* n = r.jsgraph()->Float32Constant(static_cast<float>(*i));
+ Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat32, Type::Signed32(),
- MachineRepresentation::kWord32);
+ n, MachineRepresentation::kFloat32, Type::Signed32(), use,
+ UseInfo(MachineRepresentation::kWord32, Truncation::None()));
r.CheckInt32Constant(c, *i);
}
}
@@ -342,19 +372,21 @@ TEST(ToInt32_constant) {
{
FOR_INT32_INPUTS(i) {
Node* n = r.jsgraph()->Float64Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat64, Type::Signed32(),
- MachineRepresentation::kWord32);
- r.CheckInt32Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat64, Type::Signed32(), use,
+ UseInfo(MachineRepresentation::kWord32, Truncation::None()));
+ r.CheckInt32Constant(c, *i);
}
}
{
FOR_INT32_INPUTS(i) {
Node* n = r.jsgraph()->Constant(*i);
+ Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kTagged, Type::Signed32(),
- MachineRepresentation::kWord32);
+ n, MachineRepresentation::kTagged, Type::Signed32(), use,
+ UseInfo(MachineRepresentation::kWord32, Truncation::None()));
r.CheckInt32Constant(c, *i);
}
}
@@ -367,10 +399,11 @@ TEST(ToUint32_constant) {
{
FOR_UINT32_INPUTS(i) {
Node* n = r.jsgraph()->Int32Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kWord32, Type::Unsigned32(),
- MachineRepresentation::kWord32);
- r.CheckUint32Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kWord32, Type::Unsigned32(), use,
+ UseInfo(MachineRepresentation::kWord32, Truncation::None()));
+ r.CheckUint32Constant(c, *i);
}
}
@@ -378,9 +411,10 @@ TEST(ToUint32_constant) {
FOR_UINT32_INPUTS(i) {
if (!IsFloat32Uint32(*i)) continue;
Node* n = r.jsgraph()->Float32Constant(static_cast<float>(*i));
+ Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat32, Type::Unsigned32(),
- MachineRepresentation::kWord32);
+ n, MachineRepresentation::kFloat32, Type::Unsigned32(), use,
+ UseInfo(MachineRepresentation::kWord32, Truncation::None()));
r.CheckUint32Constant(c, *i);
}
}
@@ -388,19 +422,21 @@ TEST(ToUint32_constant) {
{
FOR_UINT32_INPUTS(i) {
Node* n = r.jsgraph()->Float64Constant(*i);
- Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kFloat64, Type::Unsigned32(),
- MachineRepresentation::kWord32);
- r.CheckUint32Constant(c, *i);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(
+ n, MachineRepresentation::kFloat64, Type::Unsigned32(), use,
+ UseInfo(MachineRepresentation::kWord32, Truncation::None()));
+ r.CheckUint32Constant(c, *i);
}
}
{
FOR_UINT32_INPUTS(i) {
Node* n = r.jsgraph()->Constant(static_cast<double>(*i));
+ Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
- n, MachineRepresentation::kTagged, Type::Unsigned32(),
- MachineRepresentation::kWord32);
+ n, MachineRepresentation::kTagged, Type::Unsigned32(), use,
+ UseInfo(MachineRepresentation::kWord32, Truncation::None()));
r.CheckUint32Constant(c, *i);
}
}
@@ -412,7 +448,9 @@ static void CheckChange(IrOpcode::Value expected, MachineRepresentation from,
RepresentationChangerTester r;
Node* n = r.Parameter();
- Node* c = r.changer()->GetRepresentationFor(n, from, from_type, to);
+ Node* use = r.Return(n);
+ Node* c = r.changer()->GetRepresentationFor(n, from, from_type, use,
+ UseInfo(to, Truncation::None()));
CHECK_NE(c, n);
CHECK_EQ(expected, c->opcode());
@@ -427,7 +465,9 @@ static void CheckTwoChanges(IrOpcode::Value expected2,
RepresentationChangerTester r;
Node* n = r.Parameter();
- Node* c1 = r.changer()->GetRepresentationFor(n, from, from_type, to);
+ Node* use = r.Return(n);
+ Node* c1 = r.changer()->GetRepresentationFor(n, from, from_type, use,
+ UseInfo(to, Truncation::None()));
CHECK_NE(c1, n);
CHECK_EQ(expected1, c1->opcode());
« no previous file with comments | « src/v8.gyp ('k') | test/mjsunit/compiler/turbo-number-feedback.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698