Commit 692eec39 authored by jarin's avatar jarin Committed by Commit bot

[turbofan] Remove obsolete parts of change lowering.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/1917753002

Cr-Commit-Position: refs/heads/master@{#35756}
parent 80c73e2c
This diff is collapsed.
......@@ -28,10 +28,8 @@ class ChangeLowering final : public Reducer {
private:
Node* HeapNumberValueIndexConstant();
Node* SmiMaxValueConstant();
Node* SmiShiftBitsConstant();
Node* AllocateHeapNumberWithValue(Node* value, Node* control);
Node* ChangeInt32ToFloat64(Node* value);
Node* ChangeInt32ToSmi(Node* value);
Node* ChangeSmiToFloat64(Node* value);
......@@ -64,12 +62,7 @@ class ChangeLowering final : public Reducer {
Node* LoadMapBitField(Node* map);
Node* LoadMapInstanceType(Node* map);
Reduction ObjectIsCallable(Node* node);
Reduction ObjectIsNumber(Node* node);
Reduction ObjectIsReceiver(Node* node);
Reduction ObjectIsSmi(Node* node);
Reduction ObjectIsString(Node* node);
Reduction ObjectIsUndetectable(Node* node);
Node* ComputeIndex(const ElementAccess& access, Node* const key);
Graph* graph() const;
......
......@@ -839,8 +839,8 @@ struct EffectControlLinearizationPhase {
// chains and lower them,
// - get rid of the region markers,
// - introduce effect phis and rewire effects to get SSA again.
EffectControlLinearizer introducer(data->jsgraph(), schedule, temp_zone);
introducer.Run();
EffectControlLinearizer linearizer(data->jsgraph(), schedule, temp_zone);
linearizer.Run();
}
};
......
......@@ -8,11 +8,13 @@
#include "src/compiler/access-builder.h"
#include "src/compiler/change-lowering.h"
#include "src/compiler/control-builders.h"
#include "src/compiler/effect-control-linearizer.h"
#include "src/compiler/graph-reducer.h"
#include "src/compiler/graph-visualizer.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/pipeline.h"
#include "src/compiler/representation-change.h"
#include "src/compiler/scheduler.h"
#include "src/compiler/simplified-lowering.h"
#include "src/compiler/source-position.h"
#include "src/compiler/typer.h"
......@@ -60,6 +62,11 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
typer.Run();
lowering.LowerAllNodes();
Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(),
Scheduler::kNoFlags);
EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone());
linearizer.Run();
ChangeLowering lowering(&jsgraph);
GraphReducer reducer(this->zone(), this->graph());
reducer.AddReducer(&lowering);
......@@ -726,6 +733,11 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
SourcePositionTable table(jsgraph.graph());
SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes();
Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(),
Scheduler::kNoFlags);
EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone());
linearizer.Run();
ChangeLowering lowering(&jsgraph);
GraphReducer reducer(this->zone(), this->graph());
reducer.AddReducer(&lowering);
......@@ -1298,9 +1310,8 @@ const MachineType kMachineReps[] = {
TEST(LowerLoadField_to_load) {
TestingGraph t(Type::Any(), Type::Signed32());
for (size_t i = 0; i < arraysize(kMachineReps); i++) {
TestingGraph t(Type::Any(), Type::Signed32());
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Handle<Name>::null(), Type::Any(), kMachineReps[i]};
......@@ -1365,9 +1376,8 @@ TEST(LowerStoreField_to_store) {
TEST(LowerLoadElement_to_load) {
TestingGraph t(Type::Any(), Type::Signed32());
for (size_t i = 0; i < arraysize(kMachineReps); i++) {
TestingGraph t(Type::Any(), Type::Signed32());
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
Type::Any(), kMachineReps[i]};
......
......@@ -335,34 +335,6 @@ class ChangeLowering32Test : public ChangeLoweringTest {
};
TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) {
Node* value = Parameter(Type::Integral32());
Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), value);
Reduction r = Reduce(node);
ASSERT_TRUE(r.Changed());
Capture<Node*> add, branch, heap_number, if_true;
EXPECT_THAT(
r.replacement(),
IsPhi(MachineRepresentation::kTagged,
IsFinishRegion(
AllOf(CaptureEq(&heap_number),
IsAllocateHeapNumber(_, CaptureEq(&if_true))),
IsStore(
StoreRepresentation(MachineRepresentation::kFloat64,
kNoWriteBarrier),
CaptureEq(&heap_number),
IsIntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag),
IsChangeInt32ToFloat64(value), CaptureEq(&heap_number),
CaptureEq(&if_true))),
IsProjection(0, AllOf(CaptureEq(&add),
IsInt32AddWithOverflow(value, value))),
IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))),
IsIfFalse(AllOf(CaptureEq(&branch),
IsBranch(IsProjection(1, CaptureEq(&add)),
graph()->start()))))));
}
TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToFloat64) {
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
......@@ -434,39 +406,6 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToUint32) {
}
TARGET_TEST_F(ChangeLowering32Test, ChangeUint32ToTagged) {
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
Node* value = Parameter(Type::Number());
Node* node = graph()->NewNode(simplified()->ChangeUint32ToTagged(), value);
Reduction r = Reduce(node);
ASSERT_TRUE(r.Changed());
Capture<Node*> branch, heap_number, if_false;
EXPECT_THAT(
r.replacement(),
IsPhi(
MachineRepresentation::kTagged,
IsWord32Shl(value, IsInt32Constant(kSmiTagSize + kSmiShiftSize)),
IsFinishRegion(
AllOf(CaptureEq(&heap_number),
IsAllocateHeapNumber(_, CaptureEq(&if_false))),
IsStore(
StoreRepresentation(MachineRepresentation::kFloat64,
kNoWriteBarrier),
CaptureEq(&heap_number),
IsInt32Constant(HeapNumber::kValueOffset - kHeapObjectTag),
IsChangeUint32ToFloat64(value), CaptureEq(&heap_number),
CaptureEq(&if_false))),
IsMerge(IsIfTrue(AllOf(
CaptureEq(&branch),
IsBranch(IsUint32LessThanOrEqual(
value, IsInt32Constant(Smi::kMaxValue)),
graph()->start()))),
AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
}
// -----------------------------------------------------------------------------
// 64-bit
......@@ -480,15 +419,6 @@ class ChangeLowering64Test : public ChangeLoweringTest {
};
TARGET_TEST_F(ChangeLowering64Test, ChangeInt32ToTagged) {
Node* value = Parameter(Type::Signed32());
Node* node = graph()->NewNode(simplified()->ChangeInt32ToTagged(), value);
Reduction r = Reduce(node);
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsChangeInt32ToSmi(value));
}
TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToFloat64) {
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
......@@ -561,40 +491,6 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToUint32) {
graph()->start()))))));
}
TARGET_TEST_F(ChangeLowering64Test, ChangeUint32ToTagged) {
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize == 1);
Node* value = Parameter(Type::Number());
Node* node = graph()->NewNode(simplified()->ChangeUint32ToTagged(), value);
Reduction r = Reduce(node);
ASSERT_TRUE(r.Changed());
Capture<Node*> branch, heap_number, if_false;
EXPECT_THAT(
r.replacement(),
IsPhi(
MachineRepresentation::kTagged,
IsWord64Shl(IsChangeUint32ToUint64(value),
IsInt64Constant(kSmiTagSize + kSmiShiftSize)),
IsFinishRegion(
AllOf(CaptureEq(&heap_number),
IsAllocateHeapNumber(_, CaptureEq(&if_false))),
IsStore(
StoreRepresentation(MachineRepresentation::kFloat64,
kNoWriteBarrier),
CaptureEq(&heap_number),
IsInt64Constant(HeapNumber::kValueOffset - kHeapObjectTag),
IsChangeUint32ToFloat64(value), CaptureEq(&heap_number),
CaptureEq(&if_false))),
IsMerge(IsIfTrue(AllOf(
CaptureEq(&branch),
IsBranch(IsUint32LessThanOrEqual(
value, IsInt32Constant(Smi::kMaxValue)),
graph()->start()))),
AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
}
} // namespace compiler
} // namespace internal
} // namespace v8
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