| Index: src/arm/lithium-codegen-arm.cc
 | 
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
 | 
| index 97d763714b3646ca417d198fffafb771941f8bc0..50ff06c2f891e104af9f353011f57158eb5050e0 100644
 | 
| --- a/src/arm/lithium-codegen-arm.cc
 | 
| +++ b/src/arm/lithium-codegen-arm.cc
 | 
| @@ -98,24 +98,6 @@ void LCodeGen::Abort(BailoutReason reason) {
 | 
|  }
 | 
|  
 | 
|  
 | 
| -void LCodeGen::Comment(const char* format, ...) {
 | 
| -  if (!FLAG_code_comments) return;
 | 
| -  char buffer[4 * KB];
 | 
| -  StringBuilder builder(buffer, ARRAY_SIZE(buffer));
 | 
| -  va_list arguments;
 | 
| -  va_start(arguments, format);
 | 
| -  builder.AddFormattedList(format, arguments);
 | 
| -  va_end(arguments);
 | 
| -
 | 
| -  // Copy the string before recording it in the assembler to avoid
 | 
| -  // issues when the stack allocated buffer goes out of scope.
 | 
| -  size_t length = builder.position();
 | 
| -  Vector<char> copy = Vector<char>::New(length + 1);
 | 
| -  OS::MemCopy(copy.start(), builder.Finalize(), copy.length());
 | 
| -  masm()->RecordComment(copy.start());
 | 
| -}
 | 
| -
 | 
| -
 | 
|  bool LCodeGen::GeneratePrologue() {
 | 
|    ASSERT(is_generating());
 | 
|  
 | 
| @@ -271,37 +253,6 @@ void LCodeGen::GenerateOsrPrologue() {
 | 
|  }
 | 
|  
 | 
|  
 | 
| -bool LCodeGen::GenerateBody() {
 | 
| -  ASSERT(is_generating());
 | 
| -  bool emit_instructions = true;
 | 
| -  for (current_instruction_ = 0;
 | 
| -       !is_aborted() && current_instruction_ < instructions_->length();
 | 
| -       current_instruction_++) {
 | 
| -    LInstruction* instr = instructions_->at(current_instruction_);
 | 
| -
 | 
| -    // Don't emit code for basic blocks with a replacement.
 | 
| -    if (instr->IsLabel()) {
 | 
| -      emit_instructions = !LLabel::cast(instr)->HasReplacement();
 | 
| -    }
 | 
| -    if (!emit_instructions) continue;
 | 
| -
 | 
| -    if (FLAG_code_comments && instr->HasInterestingComment(this)) {
 | 
| -      Comment(";;; <@%d,#%d> %s",
 | 
| -              current_instruction_,
 | 
| -              instr->hydrogen_value()->id(),
 | 
| -              instr->Mnemonic());
 | 
| -    }
 | 
| -
 | 
| -    RecordAndUpdatePosition(instr->position());
 | 
| -
 | 
| -    instr->CompileToNative(this);
 | 
| -  }
 | 
| -  EnsureSpaceForLazyDeopt();
 | 
| -  last_lazy_deopt_pc_ = masm()->pc_offset();
 | 
| -  return !is_aborted();
 | 
| -}
 | 
| -
 | 
| -
 | 
|  bool LCodeGen::GenerateDeferredCode() {
 | 
|    ASSERT(is_generating());
 | 
|    if (deferred_.length() > 0) {
 | 
| @@ -729,7 +680,7 @@ void LCodeGen::CallCodeGeneric(Handle<Code> code,
 | 
|                                 LInstruction* instr,
 | 
|                                 SafepointMode safepoint_mode,
 | 
|                                 TargetAddressStorageMode storage_mode) {
 | 
| -  EnsureSpaceForLazyDeopt();
 | 
| +  EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
 | 
|    ASSERT(instr != NULL);
 | 
|    // Block literal pool emission to ensure nop indicating no inlined smi code
 | 
|    // is in the correct position.
 | 
| @@ -2193,13 +2144,6 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
 | 
|  }
 | 
|  
 | 
|  
 | 
| -int LCodeGen::GetNextEmittedBlock() const {
 | 
| -  for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
 | 
| -    if (!chunk_->GetLabel(i)->HasReplacement()) return i;
 | 
| -  }
 | 
| -  return -1;
 | 
| -}
 | 
| -
 | 
|  template<class InstrType>
 | 
|  void LCodeGen::EmitBranch(InstrType instr, Condition condition) {
 | 
|    int left_block = instr->TrueDestination(chunk_);
 | 
| @@ -5642,16 +5586,15 @@ void LCodeGen::EmitIsConstructCall(Register temp1, Register temp2) {
 | 
|  }
 | 
|  
 | 
|  
 | 
| -void LCodeGen::EnsureSpaceForLazyDeopt() {
 | 
| +void LCodeGen::EnsureSpaceForLazyDeopt(int space_needed) {
 | 
|    if (info()->IsStub()) return;
 | 
|    // Ensure that we have enough space after the previous lazy-bailout
 | 
|    // instruction for patching the code here.
 | 
|    int current_pc = masm()->pc_offset();
 | 
| -  int patch_size = Deoptimizer::patch_size();
 | 
| -  if (current_pc < last_lazy_deopt_pc_ + patch_size) {
 | 
| +  if (current_pc < last_lazy_deopt_pc_ + space_needed) {
 | 
|      // Block literal pool emission for duration of padding.
 | 
|      Assembler::BlockConstPoolScope block_const_pool(masm());
 | 
| -    int padding_size = last_lazy_deopt_pc_ + patch_size - current_pc;
 | 
| +    int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
 | 
|      ASSERT_EQ(0, padding_size % Assembler::kInstrSize);
 | 
|      while (padding_size > 0) {
 | 
|        __ nop();
 | 
| @@ -5662,7 +5605,7 @@ void LCodeGen::EnsureSpaceForLazyDeopt() {
 | 
|  
 | 
|  
 | 
|  void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
 | 
| -  EnsureSpaceForLazyDeopt();
 | 
| +  EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
 | 
|    last_lazy_deopt_pc_ = masm()->pc_offset();
 | 
|    ASSERT(instr->HasEnvironment());
 | 
|    LEnvironment* env = instr->environment();
 | 
| @@ -5732,7 +5675,7 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
 | 
|      CallCode(isolate()->builtins()->StackCheck(),
 | 
|                RelocInfo::CODE_TARGET,
 | 
|                instr);
 | 
| -    EnsureSpaceForLazyDeopt();
 | 
| +    EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
 | 
|      last_lazy_deopt_pc_ = masm()->pc_offset();
 | 
|      __ bind(&done);
 | 
|      RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
 | 
| @@ -5745,7 +5688,7 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
 | 
|      __ LoadRoot(ip, Heap::kStackLimitRootIndex);
 | 
|      __ cmp(sp, Operand(ip));
 | 
|      __ b(lo, deferred_stack_check->entry());
 | 
| -    EnsureSpaceForLazyDeopt();
 | 
| +    EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
 | 
|      last_lazy_deopt_pc_ = masm()->pc_offset();
 | 
|      __ bind(instr->done_label());
 | 
|      deferred_stack_check->SetExit(instr->done_label());
 | 
| 
 |