| Index: src/ia32/debug-ia32.cc
 | 
| diff --git a/src/ia32/debug-ia32.cc b/src/ia32/debug-ia32.cc
 | 
| index 34b33b2c17f5ad194493ebbd323ce97315cdfbad..6d1c0f63840573d9c5b48b5c67e754c66961dc74 100644
 | 
| --- a/src/ia32/debug-ia32.cc
 | 
| +++ b/src/ia32/debug-ia32.cc
 | 
| @@ -13,60 +13,61 @@
 | 
|  namespace v8 {
 | 
|  namespace internal {
 | 
|  
 | 
| -bool BreakLocationIterator::IsDebugBreakAtReturn() {
 | 
| -  return Debug::IsDebugBreakAtReturn(rinfo());
 | 
| -}
 | 
|  
 | 
| +// Patch the code at the current PC with a call to the target address.
 | 
| +// Additional guard int3 instructions can be added if required.
 | 
| +void PatchCodeWithCall(Address pc, Address target, int guard_bytes) {
 | 
| +  // Call instruction takes up 5 bytes and int3 takes up one byte.
 | 
| +  static const int kCallCodeSize = 5;
 | 
| +  int code_size = kCallCodeSize + guard_bytes;
 | 
|  
 | 
| -// Patch the JS frame exit code with a debug break call. See
 | 
| -// CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-ia32.cc
 | 
| -// for the precise return instructions sequence.
 | 
| -void BreakLocationIterator::SetDebugBreakAtReturn() {
 | 
| -  DCHECK(Assembler::kJSReturnSequenceLength >=
 | 
| -         Assembler::kCallInstructionLength);
 | 
| -  rinfo()->PatchCodeWithCall(
 | 
| -      debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(),
 | 
| -      Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength);
 | 
| -}
 | 
| +  // Create a code patcher.
 | 
| +  CodePatcher patcher(pc, code_size);
 | 
|  
 | 
| +// Add a label for checking the size of the code used for returning.
 | 
| +#ifdef DEBUG
 | 
| +  Label check_codesize;
 | 
| +  patcher.masm()->bind(&check_codesize);
 | 
| +#endif
 | 
|  
 | 
| -// Restore the JS frame exit code.
 | 
| -void BreakLocationIterator::ClearDebugBreakAtReturn() {
 | 
| -  rinfo()->PatchCode(original_rinfo()->pc(),
 | 
| -                     Assembler::kJSReturnSequenceLength);
 | 
| -}
 | 
| +  // Patch the code.
 | 
| +  patcher.masm()->call(target, RelocInfo::NONE32);
 | 
|  
 | 
| +  // Check that the size of the code generated is as expected.
 | 
| +  DCHECK_EQ(kCallCodeSize,
 | 
| +            patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize));
 | 
|  
 | 
| -// A debug break in the frame exit code is identified by the JS frame exit code
 | 
| -// having been patched with a call instruction.
 | 
| -bool Debug::IsDebugBreakAtReturn(RelocInfo* rinfo) {
 | 
| -  DCHECK(RelocInfo::IsJSReturn(rinfo->rmode()));
 | 
| -  return rinfo->IsPatchedReturnSequence();
 | 
| +  // Add the requested number of int3 instructions after the call.
 | 
| +  DCHECK_GE(guard_bytes, 0);
 | 
| +  for (int i = 0; i < guard_bytes; i++) {
 | 
| +    patcher.masm()->int3();
 | 
| +  }
 | 
| +
 | 
| +  CpuFeatures::FlushICache(pc, code_size);
 | 
|  }
 | 
|  
 | 
|  
 | 
| -bool BreakLocationIterator::IsDebugBreakAtSlot() {
 | 
| -  DCHECK(IsDebugBreakSlot());
 | 
| -  // Check whether the debug break slot instructions have been patched.
 | 
| -  return rinfo()->IsPatchedDebugBreakSlotSequence();
 | 
| +// Patch the JS frame exit code with a debug break call. See
 | 
| +// CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-ia32.cc
 | 
| +// for the precise return instructions sequence.
 | 
| +void BreakLocation::SetDebugBreakAtReturn() {
 | 
| +  DCHECK(Assembler::kJSReturnSequenceLength >=
 | 
| +         Assembler::kCallInstructionLength);
 | 
| +  PatchCodeWithCall(
 | 
| +      pc(), debug_info_->GetIsolate()->builtins()->Return_DebugBreak()->entry(),
 | 
| +      Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength);
 | 
|  }
 | 
|  
 | 
|  
 | 
| -void BreakLocationIterator::SetDebugBreakAtSlot() {
 | 
| +void BreakLocation::SetDebugBreakAtSlot() {
 | 
|    DCHECK(IsDebugBreakSlot());
 | 
|    Isolate* isolate = debug_info_->GetIsolate();
 | 
| -  rinfo()->PatchCodeWithCall(
 | 
| -      isolate->builtins()->Slot_DebugBreak()->entry(),
 | 
| +  PatchCodeWithCall(
 | 
| +      pc(), isolate->builtins()->Slot_DebugBreak()->entry(),
 | 
|        Assembler::kDebugBreakSlotLength - Assembler::kCallInstructionLength);
 | 
|  }
 | 
|  
 | 
|  
 | 
| -void BreakLocationIterator::ClearDebugBreakAtSlot() {
 | 
| -  DCHECK(IsDebugBreakSlot());
 | 
| -  rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength);
 | 
| -}
 | 
| -
 | 
| -
 | 
|  #define __ ACCESS_MASM(masm)
 | 
|  
 | 
|  static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
 | 
| 
 |