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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 515433003: Remove old changes lowering code and convert test to use new changes lowering code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/simplified-lowering.h ('k') | test/cctest/compiler/test-changes-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 75f23b2d89b1cb36290b3483f88f842ec8044f3c..72c2d372e8e3888314805c5156ff3babe4e0bb8c 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -726,10 +726,6 @@ void SimplifiedLowering::LowerAllNodes() {
graph()->zone()->isolate());
RepresentationSelector selector(jsgraph(), zone(), &changer);
selector.Run(this);
-
- GraphReducer graph_reducer(graph());
- graph_reducer.AddReducer(this);
- graph_reducer.ReduceGraph();
}
@@ -752,157 +748,6 @@ Node* SimplifiedLowering::OffsetMinusTagConstant(int32_t offset) {
}
-static void UpdateControlSuccessors(Node* before, Node* node) {
- DCHECK(IrOpcode::IsControlOpcode(before->opcode()));
- UseIter iter = before->uses().begin();
- while (iter != before->uses().end()) {
- if (IrOpcode::IsControlOpcode((*iter)->opcode()) &&
- NodeProperties::IsControlEdge(iter.edge())) {
- iter = iter.UpdateToAndIncrement(node);
- continue;
- }
- ++iter;
- }
-}
-
-
-void SimplifiedLowering::DoChangeTaggedToUI32(Node* node, Node* effect,
- Node* control, bool is_signed) {
- // if (IsTagged(val))
- // ConvertFloat64To(Int32|Uint32)(Load[kMachFloat64](input, #value_offset))
- // else Untag(val)
- Node* val = node->InputAt(0);
- Node* branch = graph()->NewNode(common()->Branch(), IsTagged(val), control);
-
- // true branch.
- Node* tbranch = graph()->NewNode(common()->IfTrue(), branch);
- Node* loaded = graph()->NewNode(
- machine()->Load(kMachFloat64), val,
- OffsetMinusTagConstant(HeapNumber::kValueOffset), effect);
- Operator* op = is_signed ? machine()->ChangeFloat64ToInt32()
- : machine()->ChangeFloat64ToUint32();
- Node* converted = graph()->NewNode(op, loaded);
-
- // false branch.
- Node* fbranch = graph()->NewNode(common()->IfFalse(), branch);
- Node* untagged = Untag(val);
-
- // merge.
- Node* merge = graph()->NewNode(common()->Merge(2), tbranch, fbranch);
- Node* phi = graph()->NewNode(common()->Phi(2), converted, untagged, merge);
- UpdateControlSuccessors(control, merge);
- branch->ReplaceInput(1, control);
- node->ReplaceUses(phi);
-}
-
-
-void SimplifiedLowering::DoChangeTaggedToFloat64(Node* node, Node* effect,
- Node* control) {
- // if (IsTagged(input)) Load[kMachFloat64](input, #value_offset)
- // else ConvertFloat64(Untag(input))
- Node* val = node->InputAt(0);
- Node* branch = graph()->NewNode(common()->Branch(), IsTagged(val), control);
-
- // true branch.
- Node* tbranch = graph()->NewNode(common()->IfTrue(), branch);
- Node* loaded = graph()->NewNode(
- machine()->Load(kMachFloat64), val,
- OffsetMinusTagConstant(HeapNumber::kValueOffset), effect);
-
- // false branch.
- Node* fbranch = graph()->NewNode(common()->IfFalse(), branch);
- Node* untagged = Untag(val);
- Node* converted =
- graph()->NewNode(machine()->ChangeInt32ToFloat64(), untagged);
-
- // merge.
- Node* merge = graph()->NewNode(common()->Merge(2), tbranch, fbranch);
- Node* phi = graph()->NewNode(common()->Phi(2), loaded, converted, merge);
- UpdateControlSuccessors(control, merge);
- branch->ReplaceInput(1, control);
- node->ReplaceUses(phi);
-}
-
-
-void SimplifiedLowering::DoChangeUI32ToTagged(Node* node, Node* effect,
- Node* control, bool is_signed) {
- Node* val = node->InputAt(0);
- Node* is_smi = NULL;
- if (is_signed) {
- if (SmiValuesAre32Bits()) {
- // All int32s fit in this case.
- DCHECK(kPointerSize == 8);
- return node->ReplaceUses(SmiTag(val));
- } else {
- // TODO(turbofan): use an Int32AddWithOverflow to tag and check here.
- Node* lt = graph()->NewNode(machine()->Int32LessThanOrEqual(), val,
- jsgraph()->Int32Constant(Smi::kMaxValue));
- Node* gt =
- graph()->NewNode(machine()->Int32LessThanOrEqual(),
- jsgraph()->Int32Constant(Smi::kMinValue), val);
- is_smi = graph()->NewNode(machine()->Word32And(), lt, gt);
- }
- } else {
- // Check if Uint32 value is in the smi range.
- is_smi = graph()->NewNode(machine()->Uint32LessThanOrEqual(), val,
- jsgraph()->Int32Constant(Smi::kMaxValue));
- }
-
- // TODO(turbofan): fold smi test branch eagerly.
- // if (IsSmi(input)) SmiTag(input);
- // else InlineAllocAndInitHeapNumber(ConvertToFloat64(input)))
- Node* branch = graph()->NewNode(common()->Branch(), is_smi, control);
-
- // true branch.
- Node* tbranch = graph()->NewNode(common()->IfTrue(), branch);
- Node* smi_tagged = SmiTag(val);
-
- // false branch.
- Node* fbranch = graph()->NewNode(common()->IfFalse(), branch);
- Node* heap_num = jsgraph()->Constant(0.0); // TODO(titzer): alloc and init
-
- // merge.
- Node* merge = graph()->NewNode(common()->Merge(2), tbranch, fbranch);
- Node* phi = graph()->NewNode(common()->Phi(2), smi_tagged, heap_num, merge);
- UpdateControlSuccessors(control, merge);
- branch->ReplaceInput(1, control);
- node->ReplaceUses(phi);
-}
-
-
-void SimplifiedLowering::DoChangeFloat64ToTagged(Node* node, Node* effect,
- Node* control) {
- return; // TODO(titzer): need to call runtime to allocate in one branch
-}
-
-
-void SimplifiedLowering::DoChangeBoolToBit(Node* node, Node* effect,
- Node* control) {
- Node* cmp = graph()->NewNode(machine()->WordEqual(), node->InputAt(0),
- jsgraph()->TrueConstant());
- node->ReplaceUses(cmp);
-}
-
-
-void SimplifiedLowering::DoChangeBitToBool(Node* node, Node* effect,
- Node* control) {
- Node* val = node->InputAt(0);
- Node* branch = graph()->NewNode(common()->Branch(), val, control);
-
- // true branch.
- Node* tbranch = graph()->NewNode(common()->IfTrue(), branch);
- // false branch.
- Node* fbranch = graph()->NewNode(common()->IfFalse(), branch);
- // merge.
- Node* merge = graph()->NewNode(common()->Merge(2), tbranch, fbranch);
- Node* phi = graph()->NewNode(common()->Phi(2), jsgraph()->TrueConstant(),
- jsgraph()->FalseConstant(), merge);
- UpdateControlSuccessors(control, merge);
- branch->ReplaceInput(1, control);
- node->ReplaceUses(phi);
-}
-
-
static WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
MachineType representation,
Type* type) {
@@ -964,41 +809,6 @@ void SimplifiedLowering::DoStoreElement(Node* node) {
}
-Reduction SimplifiedLowering::Reduce(Node* node) { return NoChange(); }
-
-
-void SimplifiedLowering::LowerChange(Node* node, Node* effect, Node* control) {
- switch (node->opcode()) {
- case IrOpcode::kChangeTaggedToInt32:
- DoChangeTaggedToUI32(node, effect, control, true);
- break;
- case IrOpcode::kChangeTaggedToUint32:
- DoChangeTaggedToUI32(node, effect, control, false);
- break;
- case IrOpcode::kChangeTaggedToFloat64:
- DoChangeTaggedToFloat64(node, effect, control);
- break;
- case IrOpcode::kChangeInt32ToTagged:
- DoChangeUI32ToTagged(node, effect, control, true);
- break;
- case IrOpcode::kChangeUint32ToTagged:
- DoChangeUI32ToTagged(node, effect, control, false);
- break;
- case IrOpcode::kChangeFloat64ToTagged:
- DoChangeFloat64ToTagged(node, effect, control);
- break;
- case IrOpcode::kChangeBoolToBit:
- DoChangeBoolToBit(node, effect, control);
- break;
- case IrOpcode::kChangeBitToBool:
- DoChangeBitToBool(node, effect, control);
- break;
- default:
- UNREACHABLE();
- break;
- }
-}
-
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | test/cctest/compiler/test-changes-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698