Skip dead blocks/instructions in store elimination.

Also improve tracing.

R=ishell@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21463 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
bmeurer@chromium.org 2014-05-23 11:48:40 +00:00
parent 988642494f
commit 238a2489e2

View File

@ -30,8 +30,10 @@ void HStoreEliminationPhase::Run() {
for (int i = 0; i < graph()->blocks()->length(); i++) {
unobserved_.Rewind(0);
HBasicBlock* block = graph()->blocks()->at(i);
if (!block->IsReachable()) continue;
for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
HInstruction* instr = it.Current();
if (instr->CheckFlag(HValue::kIsDead)) continue;
// TODO(titzer): eliminate unobserved HStoreKeyed instructions too.
switch (instr->opcode()) {
@ -97,17 +99,20 @@ void HStoreEliminationPhase::ProcessInstr(HInstruction* instr,
GVNFlagSet flags) {
if (unobserved_.length() == 0) return; // Nothing to do.
if (instr->CanDeoptimize()) {
TRACE(("-- Observed stores at I%d (might deoptimize)\n", instr->id()));
TRACE(("-- Observed stores at I%d (%s might deoptimize)\n",
instr->id(), instr->Mnemonic()));
unobserved_.Rewind(0);
return;
}
if (instr->CheckChangesFlag(kNewSpacePromotion)) {
TRACE(("-- Observed stores at I%d (might GC)\n", instr->id()));
TRACE(("-- Observed stores at I%d (%s might GC)\n",
instr->id(), instr->Mnemonic()));
unobserved_.Rewind(0);
return;
}
if (instr->DependsOnFlags().ContainsAnyOf(flags)) {
TRACE(("-- Observed stores at I%d (GVN flags)\n", instr->id()));
TRACE(("-- Observed stores at I%d (GVN flags of %s)\n",
instr->id(), instr->Mnemonic()));
unobserved_.Rewind(0);
return;
}