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

Unified Diff: src/compiler/representation-change.cc

Issue 2280613002: Revert of [turbofan] Insert dummy values when changing from None type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/ppc/code-generator-ppc.cc ('k') | src/compiler/s390/code-generator-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/representation-change.cc
diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc
index 9d30fd4773f5f94a9b085a954812108b47a58394..5427bdb1cd83bcd8589cfaf860df8004e6c498f7 100644
--- a/src/compiler/representation-change.cc
+++ b/src/compiler/representation-change.cc
@@ -204,10 +204,10 @@
}
// Select the correct X -> Tagged operator.
const Operator* op;
- if (!output_type->IsInhabited()) {
- // This is an impossible value; it should not be used at runtime.
- // We just provide a dummy value here.
- return jsgraph()->TheHoleConstant();
+ if (output_rep == MachineRepresentation::kNone) {
+ // We should only asisgn this representation if the type is empty.
+ CHECK(!output_type->IsInhabited());
+ op = machine()->ImpossibleToTagged();
} else if (output_rep == MachineRepresentation::kBit) {
if (output_type->Is(Type::Boolean())) {
op = simplified()->ChangeBitToTagged();
@@ -283,10 +283,10 @@
}
// Select the correct X -> Float32 operator.
const Operator* op = nullptr;
- if (!output_type->IsInhabited()) {
- // This is an impossible value; it should not be used at runtime.
- // We just provide a dummy value here.
- return jsgraph()->Float32Constant(0.0f);
+ if (output_rep == MachineRepresentation::kNone) {
+ // We should only use kNone representation if the type is empty.
+ CHECK(!output_type->IsInhabited());
+ op = machine()->ImpossibleToFloat32();
} else if (IsWord(output_rep)) {
if (output_type->Is(Type::Signed32())) {
// int32 -> float64 -> float32
@@ -352,10 +352,10 @@
}
// Select the correct X -> Float64 operator.
const Operator* op = nullptr;
- if (!output_type->IsInhabited()) {
- // This is an impossible value; it should not be used at runtime.
- // We just provide a dummy value here.
- return jsgraph()->Float64Constant(0.0);
+ if (output_rep == MachineRepresentation::kNone) {
+ // We should only use kNone representation if the type is empty.
+ CHECK(!output_type->IsInhabited());
+ op = machine()->ImpossibleToFloat64();
} else if (IsWord(output_rep)) {
if (output_type->Is(Type::Signed32())) {
op = machine()->ChangeInt32ToFloat64();
@@ -435,10 +435,10 @@
// Select the correct X -> Word32 operator.
const Operator* op = nullptr;
- if (!output_type->IsInhabited()) {
- // This is an impossible value; it should not be used at runtime.
- // We just provide a dummy value here.
- return jsgraph()->Int32Constant(0);
+ if (output_rep == MachineRepresentation::kNone) {
+ // We should only use kNone representation if the type is empty.
+ CHECK(!output_type->IsInhabited());
+ op = machine()->ImpossibleToWord32();
} else if (output_rep == MachineRepresentation::kBit) {
return node; // Sloppy comparison -> word32
} else if (output_rep == MachineRepresentation::kFloat64) {
@@ -551,10 +551,10 @@
}
// Select the correct X -> Bit operator.
const Operator* op;
- if (!output_type->IsInhabited()) {
- // This is an impossible value; it should not be used at runtime.
- // We just provide a dummy value here.
- return jsgraph()->Int32Constant(0);
+ if (output_rep == MachineRepresentation::kNone) {
+ // We should only use kNone representation if the type is empty.
+ CHECK(!output_type->IsInhabited());
+ op = machine()->ImpossibleToBit();
} else if (output_rep == MachineRepresentation::kTagged) {
op = simplified()->ChangeTaggedToBit();
} else {
@@ -566,10 +566,10 @@
Node* RepresentationChanger::GetWord64RepresentationFor(
Node* node, MachineRepresentation output_rep, Type* output_type) {
- if (!output_type->IsInhabited()) {
- // This is an impossible value; it should not be used at runtime.
- // We just provide a dummy value here.
- return jsgraph()->Int64Constant(0);
+ if (output_rep == MachineRepresentation::kNone) {
+ // We should only use kNone representation if the type is empty.
+ CHECK(!output_type->IsInhabited());
+ return jsgraph()->graph()->NewNode(machine()->ImpossibleToFloat64(), node);
} else if (output_rep == MachineRepresentation::kBit) {
return node; // Sloppy comparison -> word64
}
« no previous file with comments | « src/compiler/ppc/code-generator-ppc.cc ('k') | src/compiler/s390/code-generator-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698