I'm experimenting with removing deoptimization checks and I have a question 
about how to remove hydrogen instructions.

I'm looking at a benchmark where the CheckMaps deoptimization checks are 
never triggered and I'm trying to remove them.  I know this is not safe in 
the general case, but when I traced the deoptimizations for this benchmark 
there were not any that were triggered because of CheckMaps.

I've tried to follow the HDeadCodeEliminationPhase as a guide because what 
I want to do is delete instructions that match a certain criteria, so I 
thought that pass might be a good example.  The main loop in my pass is:

  for (int i = 0; i < graph()->blocks()->length(); ++i) {   
    HBasicBlock* block = graph()->blocks()->at(i);         
    for (HInstructionIterator it(block); !it.Done(); it.Advance()) {   
      HInstruction* instr = it.Current();  
      if (instr->opcode() == HValue::kCheckMaps) {     
        instr->DeleteAndReplaceWith(NULL);
      }                                                
    } 
  }  

When I run this and just print the list of instructions that will be 
removed the list looks okay.  However if I actually delete the instruction 
I get a runtime error as follows:

#
# Fatal error in ../src/objects.cc, line 10380
# unreachable code
#

==== C stack trace ===============================

 1: V8_Fatal
 2: 
v8::internal::Code::FindAndReplace(v8::internal::Code::FindAndReplacePattern 
const&)
 3: 
v8::internal::CodeStub::GetCodeCopy(v8::internal::Code::FindAndReplacePattern 
const&)
 4: 
v8::internal::PropertyICCompiler::ComputeCompareNil(v8::internal::Handle<v8::internal::Map>,
 
v8::internal::CompareNilICStub*)
 5: 
v8::internal::CompareNilIC::CompareNil(v8::internal::Handle<v8::internal::Object>)
 6: ??
 7: v8::internal::CompareNilIC_Miss(int, v8::internal::Object**, 
v8::internal::Isolate*)
 8: ??
Segmentation fault (core dumped)

I'm wondering if anyone has suggestions for what I can look at it 
understand what's going on and debug the problem.  Obviously the specific 
thing I'm trying to do of removing CheckMaps is not something that should 
work in general.  But I think it should be possible to remove a hydrogen 
instruction during the optimization phase.  I've tried to pattern my 
attempt off of the existing code, but obviously I'm missing something.  If 
anyone has suggestions about what I should try that is appreciated.

Thanks,

Gabriel

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to