Commit 83e14103 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Float32Constant/Float64Constant cannot occur in JS level graph.

Now that the hole NaN is no longer represented as Float64Constant early
on, we should never see such a constant node in any JS-level graph, but
we will only see them after representation selection. Change Typer and
SimplifiedLowering appropriately (and fix the invalid tests).

R=jarin@chromium.org
BUG=v8:5267

Review-Url: https://codereview.chromium.org/2299883003
Cr-Commit-Position: refs/heads/master@{#39063}
parent 64a7bd38
......@@ -1317,8 +1317,6 @@ class RepresentationSelector {
return VisitLeaf(node, MachineRepresentation::kWord32);
case IrOpcode::kInt64Constant:
return VisitLeaf(node, MachineRepresentation::kWord64);
case IrOpcode::kFloat64Constant:
return VisitLeaf(node, MachineRepresentation::kFloat64);
case IrOpcode::kExternalConstant:
return VisitLeaf(node, MachineType::PointerRepresentation());
case IrOpcode::kNumberConstant:
......
......@@ -580,14 +580,14 @@ Type* Typer::Visitor::TypeRelocatableInt64Constant(Node* node) {
}
Type* Typer::Visitor::TypeFloat32Constant(Node* node) {
return Type::Intersect(Type::Of(OpParameter<float>(node), zone()),
Type::UntaggedFloat32(), zone());
UNREACHABLE();
return nullptr;
}
Type* Typer::Visitor::TypeFloat64Constant(Node* node) {
return Type::Intersect(Type::Of(OpParameter<double>(node), zone()),
Type::UntaggedFloat64(), zone());
UNREACHABLE();
return nullptr;
}
......
......@@ -5,8 +5,6 @@
#include "src/assembler.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/typer.h"
#include "src/types.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/value-helper.h"
......@@ -20,12 +18,10 @@ class JSCacheTesterHelper {
: main_graph_(zone),
main_common_(zone),
main_javascript_(zone),
main_typer_(isolate, &main_graph_),
main_machine_(zone) {}
Graph main_graph_;
CommonOperatorBuilder main_common_;
JSOperatorBuilder main_javascript_;
Typer main_typer_;
MachineOperatorBuilder main_machine_;
};
......@@ -42,11 +38,8 @@ class JSConstantCacheTester : public HandleAndZoneScope,
main_graph_.SetStart(main_graph_.NewNode(common()->Start(0)));
main_graph_.SetEnd(
main_graph_.NewNode(common()->End(1), main_graph_.start()));
main_typer_.Run();
}
Type* TypeOf(Node* node) { return NodeProperties::GetType(node); }
Handle<HeapObject> handle(Node* node) {
CHECK_EQ(IrOpcode::kHeapConstant, node->opcode());
return OpParameter<Handle<HeapObject>>(node);
......@@ -68,15 +61,6 @@ TEST(ZeroConstant1) {
CHECK_NE(zero, T.Constant(std::numeric_limits<double>::quiet_NaN()));
CHECK_NE(zero, T.Float64Constant(0));
CHECK_NE(zero, T.Int32Constant(0));
Type* t = T.TypeOf(zero);
CHECK(t->Is(Type::Number()));
CHECK(t->Is(Type::Integral32()));
CHECK(t->Is(Type::Signed32()));
CHECK(t->Is(Type::Unsigned32()));
CHECK(t->Is(Type::SignedSmall()));
CHECK(t->Is(Type::UnsignedSmall()));
}
......@@ -90,16 +74,6 @@ TEST(MinusZeroConstant) {
CHECK_EQ(minus_zero, T.Constant(-0.0));
CHECK_NE(zero, minus_zero);
Type* t = T.TypeOf(minus_zero);
CHECK(t->Is(Type::Number()));
CHECK(t->Is(Type::MinusZero()));
CHECK(!t->Is(Type::Integral32()));
CHECK(!t->Is(Type::Signed32()));
CHECK(!t->Is(Type::Unsigned32()));
CHECK(!t->Is(Type::SignedSmall()));
CHECK(!t->Is(Type::UnsignedSmall()));
double zero_value = OpParameter<double>(zero);
double minus_zero_value = OpParameter<double>(minus_zero);
......@@ -122,15 +96,6 @@ TEST(ZeroConstant2) {
CHECK_NE(zero, T.Constant(std::numeric_limits<double>::quiet_NaN()));
CHECK_NE(zero, T.Float64Constant(0));
CHECK_NE(zero, T.Int32Constant(0));
Type* t = T.TypeOf(zero);
CHECK(t->Is(Type::Number()));
CHECK(t->Is(Type::Integral32()));
CHECK(t->Is(Type::Signed32()));
CHECK(t->Is(Type::Unsigned32()));
CHECK(t->Is(Type::SignedSmall()));
CHECK(t->Is(Type::UnsignedSmall()));
}
......@@ -147,15 +112,6 @@ TEST(OneConstant1) {
CHECK_NE(one, T.Constant(std::numeric_limits<double>::quiet_NaN()));
CHECK_NE(one, T.Float64Constant(1.0));
CHECK_NE(one, T.Int32Constant(1));
Type* t = T.TypeOf(one);
CHECK(t->Is(Type::Number()));
CHECK(t->Is(Type::Integral32()));
CHECK(t->Is(Type::Signed32()));
CHECK(t->Is(Type::Unsigned32()));
CHECK(t->Is(Type::SignedSmall()));
CHECK(t->Is(Type::UnsignedSmall()));
}
......@@ -172,15 +128,6 @@ TEST(OneConstant2) {
CHECK_NE(one, T.Constant(std::numeric_limits<double>::quiet_NaN()));
CHECK_NE(one, T.Float64Constant(1.0));
CHECK_NE(one, T.Int32Constant(1));
Type* t = T.TypeOf(one);
CHECK(t->Is(Type::Number()));
CHECK(t->Is(Type::Integral32()));
CHECK(t->Is(Type::Signed32()));
CHECK(t->Is(Type::Unsigned32()));
CHECK(t->Is(Type::SignedSmall()));
CHECK(t->Is(Type::UnsignedSmall()));
}
......@@ -227,17 +174,6 @@ TEST(CanonicalizingNumbers) {
}
TEST(NumberTypes) {
JSConstantCacheTester T;
FOR_FLOAT64_INPUTS(i) {
double value = *i;
Node* node = T.Constant(value);
CHECK(T.TypeOf(node)->Is(Type::Of(value, T.main_zone())));
}
}
TEST(HeapNumbers) {
JSConstantCacheTester T;
......@@ -277,21 +213,6 @@ TEST(OddballValues) {
}
TEST(OddballTypes) {
JSConstantCacheTester T;
CHECK(T.TypeOf(T.UndefinedConstant())->Is(Type::Undefined()));
// TODO(dcarney): figure this out.
// CHECK(T.TypeOf(T.TheHoleConstant())->Is(Type::Internal()));
CHECK(T.TypeOf(T.TrueConstant())->Is(Type::Boolean()));
CHECK(T.TypeOf(T.FalseConstant())->Is(Type::Boolean()));
CHECK(T.TypeOf(T.NullConstant())->Is(Type::Null()));
CHECK(T.TypeOf(T.ZeroConstant())->Is(Type::Number()));
CHECK(T.TypeOf(T.OneConstant())->Is(Type::Number()));
CHECK(T.TypeOf(T.NaNConstant())->Is(Type::NaN()));
}
TEST(ExternalReferences) {
// TODO(titzer): test canonicalization of external references.
}
......
......@@ -463,10 +463,9 @@ TEST(JSToNumber_replacement) {
TEST(JSToNumberOfConstant) {
JSTypedLoweringTester R;
const Operator* ops[] = {
R.common.NumberConstant(0), R.common.NumberConstant(-1),
R.common.NumberConstant(0.1), R.common.Int32Constant(1177),
R.common.Float64Constant(0.99)};
const Operator* ops[] = {R.common.NumberConstant(0),
R.common.NumberConstant(-1),
R.common.NumberConstant(0.1)};
for (size_t i = 0; i < arraysize(ops); i++) {
Node* n = R.graph.NewNode(ops[i]);
......
......@@ -21,10 +21,10 @@ namespace compiler {
using testing::Capture;
class EffectControlLinearizerTest : public TypedGraphTest {
class EffectControlLinearizerTest : public GraphTest {
public:
EffectControlLinearizerTest()
: TypedGraphTest(3),
: GraphTest(3),
machine_(zone()),
javascript_(zone()),
simplified_(zone()),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment