Revert "Eliminatable CheckMaps replaced with if(true) or if(false)."

This reverts r18592 for breaking the GC stress bots.

R=machenbach@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18611 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4398efe8
......@@ -132,10 +132,8 @@ class HCheckTable : public ZoneObject {
// Branch-sensitive analysis for certain comparisons may add more facts
// to the state for the successor on the true branch.
HBasicBlock* pred_block = succ->predecessors()->at(0);
HControlInstruction* end = pred_block->end();
if (succ->predecessors()->length() == 1 && end->SuccessorAt(0) == succ &&
pred_block->IsReachable()) {
HControlInstruction* end = succ->predecessors()->at(0)->end();
if (succ->predecessors()->length() == 1 && end->SuccessorAt(0) == succ) {
if (end->IsCompareMap()) {
// Learn on the true branch of if(CompareMap(x)).
HCompareMap* cmp = HCompareMap::cast(end);
......@@ -313,27 +311,14 @@ class HCheckTable : public ZoneObject {
void ReduceCompareMap(HCompareMap* instr) {
MapSet maps = FindMaps(instr->value()->ActualValue());
if (maps == NULL) return;
TRACE(("CompareMap for #%d at B%d ",
instr->value()->ActualValue()->id(), instr->block()->block_id()));
if (maps->Contains(instr->map())) {
if (maps->size() == 1) {
// TODO(titzer): replace with goto true branch
INC_STAT(compares_true_);
TRACE(("replaced with goto B%d (true target)\n",
instr->SuccessorAt(0)->block_id()));
instr->block()->ReplaceControlWithGotoSuccessor(0);
} else {
TRACE(("can't be replaced with goto: ambiguous set of maps\n"));
}
} else {
// TODO(titzer): replace with goto false branch
INC_STAT(compares_false_);
TRACE(("replaced with goto B%d (false target)\n",
instr->SuccessorAt(1)->block_id()));
instr->block()->ReplaceControlWithGotoSuccessor(1);
}
}
......
......@@ -124,19 +124,17 @@ class HFlowEngine {
if (SkipNonDominatedBlock(root, block)) continue;
State* state = StateAt(block);
if (block->IsReachable()) {
if (block->IsLoopHeader()) {
// Apply loop effects before analyzing loop body.
ComputeLoopEffects(block)->Apply(state);
} else {
// Must have visited all predecessors before this block.
CheckPredecessorCount(block);
}
if (block->IsLoopHeader()) {
// Apply loop effects before analyzing loop body.
ComputeLoopEffects(block)->Apply(state);
} else {
// Must have visited all predecessors before this block.
CheckPredecessorCount(block);
}
// Go through all instructions of the current block, updating the state.
for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
state = state->Process(it.Current(), zone_);
}
// Go through all instructions of the current block, updating the state.
for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
state = state->Process(it.Current(), zone_);
}
// Propagate the block state forward to all successor blocks.
......@@ -187,7 +185,6 @@ class HFlowEngine {
i = member->loop_information()->GetLastBackEdge()->block_id();
} else {
// Process all the effects of the block.
if (member->IsUnreachable()) continue;
ASSERT(member->current_loop() == loop);
for (HInstructionIterator it(member); !it.Done(); it.Advance()) {
effects->Process(it.Current(), zone_);
......
......@@ -707,6 +707,7 @@ void HInstruction::PrintMnemonicTo(StringStream* stream) {
void HInstruction::Unlink() {
ASSERT(IsLinked());
ASSERT(!IsControlInstruction()); // Must never move control instructions.
ASSERT(!IsBlockEntry()); // Doesn't make sense to delete these.
ASSERT(previous_ != NULL);
previous_->next_ = next_;
......
......@@ -313,30 +313,6 @@ int HBasicBlock::LoopNestingDepth() const {
}
void HBasicBlock::ReplaceControlWithGotoSuccessor(int succ) {
ASSERT(IsFinished());
ASSERT(end()->SuccessorCount() == 2); // Only this case is supported yet.
ASSERT(succ < end()->SuccessorCount());
int unreachable_succ = 1 - succ;
// Replace control instruction with if (true) {succ} else {unreachable_succ}.
HBranch* new_branch = HBranch::New(
zone(),
NULL,
graph()->GetConstantTrue(),
ToBooleanStub::Types(ToBooleanStub::BOOLEAN),
end()->SuccessorAt(succ),
end()->SuccessorAt(unreachable_succ));
MarkSuccEdgeUnreachable(unreachable_succ);
end()->DeleteAndReplaceWith(end()->ActualValue());
new_branch->InsertAfter(last());
end_ = new_branch;
}
void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) {
ASSERT(IsLoopHeader());
......@@ -355,15 +331,6 @@ void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) {
}
void HBasicBlock::MarkSuccEdgeUnreachable(int succ) {
ASSERT(IsFinished());
HBasicBlock* succ_block = end()->SuccessorAt(succ);
ASSERT(succ_block->predecessors()->length() == 1);
succ_block->MarkUnreachable();
}
void HBasicBlock::RegisterPredecessor(HBasicBlock* pred) {
if (HasPredecessor()) {
// Only loop header blocks can have a predecessor added after
......
......@@ -114,8 +114,6 @@ class HBasicBlock V8_FINAL : public ZoneObject {
bool Dominates(HBasicBlock* other) const;
int LoopNestingDepth() const;
void ReplaceControlWithGotoSuccessor(int succ);
void SetInitialEnvironment(HEnvironment* env);
void ClearEnvironment() {
ASSERT(IsFinished());
......@@ -202,7 +200,6 @@ class HBasicBlock V8_FINAL : public ZoneObject {
int position);
private:
void MarkSuccEdgeUnreachable(int succ);
void RegisterPredecessor(HBasicBlock* pred);
void AddDominatedBlock(HBasicBlock* block);
......
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