| Index: src/arm/lithium-codegen-arm.cc
 | 
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
 | 
| index 4be6d264a8f69d16cebe90c1a986703e2ccb0615..d1d6db5d17506894aad74195e18918210d94d651 100644
 | 
| --- a/src/arm/lithium-codegen-arm.cc
 | 
| +++ b/src/arm/lithium-codegen-arm.cc
 | 
| @@ -2369,24 +2369,6 @@ void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
 | 
|  
 | 
|  
 | 
|  void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
 | 
| -  class DeferredInstanceOfKnownGlobal: public LDeferredCode {
 | 
| -   public:
 | 
| -    DeferredInstanceOfKnownGlobal(LCodeGen* codegen,
 | 
| -                                  LInstanceOfKnownGlobal* instr)
 | 
| -        : LDeferredCode(codegen), instr_(instr) { }
 | 
| -    virtual void Generate() {
 | 
| -      codegen()->DoDeferredInstanceOfKnownGlobal(instr_, &map_check_);
 | 
| -    }
 | 
| -    virtual LInstruction* instr() { return instr_; }
 | 
| -    Label* map_check() { return &map_check_; }
 | 
| -   private:
 | 
| -    LInstanceOfKnownGlobal* instr_;
 | 
| -    Label map_check_;
 | 
| -  };
 | 
| -
 | 
| -  DeferredInstanceOfKnownGlobal* deferred;
 | 
| -  deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr);
 | 
| -
 | 
|    Label done, false_result;
 | 
|    Register object = ToRegister(instr->InputAt(0));
 | 
|    Register temp = ToRegister(instr->TempAt(0));
 | 
| @@ -2401,14 +2383,14 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
 | 
|    // This is the inlined call site instanceof cache. The two occurences of the
 | 
|    // hole value will be patched to the last map/result pair generated by the
 | 
|    // instanceof stub.
 | 
| -  Label cache_miss;
 | 
| +  Label cache_miss, map_check_site;
 | 
|    Register map = temp;
 | 
|    __ ldr(map, FieldMemOperand(object, HeapObject::kMapOffset));
 | 
|    {
 | 
|      // Block constant pool emission to ensure the positions of instructions are
 | 
|      // as expected by the patcher. See InstanceofStub::Generate().
 | 
|      Assembler::BlockConstPoolScope block_const_pool(masm());
 | 
| -    __ bind(deferred->map_check());  // Label for calculating code patching.
 | 
| +    __ bind(&map_check_site);  // Label for calculating code patching.
 | 
|      // We use Factory::the_hole_value() on purpose instead of loading from the
 | 
|      // root array to force relocation to be able to later patch with
 | 
|      // the cached map.
 | 
| @@ -2437,24 +2419,7 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
 | 
|    Condition is_string = masm_->IsObjectStringType(object, temp);
 | 
|    __ b(is_string, &false_result);
 | 
|  
 | 
| -  // Go to the deferred code.
 | 
| -  __ b(deferred->entry());
 | 
| -
 | 
| -  __ bind(&false_result);
 | 
| -  __ LoadRoot(result, Heap::kFalseValueRootIndex);
 | 
| -
 | 
| -  // Here result has either true or false. Deferred code also produces true or
 | 
| -  // false object.
 | 
| -  __ bind(deferred->exit());
 | 
| -  __ bind(&done);
 | 
| -}
 | 
| -
 | 
| -
 | 
| -void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
 | 
| -                                               Label* map_check) {
 | 
| -  Register result = ToRegister(instr->result());
 | 
| -  ASSERT(result.is(r0));
 | 
| -
 | 
| +  // Slow case.
 | 
|    InstanceofStub::Flags flags = InstanceofStub::kNoFlags;
 | 
|    flags = static_cast<InstanceofStub::Flags>(
 | 
|        flags | InstanceofStub::kArgsInRegisters);
 | 
| @@ -2464,30 +2429,35 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
 | 
|        flags | InstanceofStub::kReturnTrueFalseObject);
 | 
|    InstanceofStub stub(flags);
 | 
|  
 | 
| -  PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
 | 
| +  { PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
 | 
| +
 | 
| +    __ LoadHeapObject(InstanceofStub::right(), instr->function());
 | 
| +    static const int kAdditionalDelta = 4;
 | 
| +    int delta =
 | 
| +        masm()->InstructionsGeneratedSince(&map_check_site) + kAdditionalDelta;
 | 
| +    Label before_push_delta;
 | 
| +    __ bind(&before_push_delta);
 | 
| +    __ BlockConstPoolFor(kAdditionalDelta);
 | 
| +    __ mov(temp, Operand(delta * kPointerSize));
 | 
| +    __ StoreToSafepointRegisterSlot(temp, temp);
 | 
| +    CallCodeGeneric(stub.GetCode(),
 | 
| +                    RelocInfo::CODE_TARGET,
 | 
| +                    instr,
 | 
| +                    RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
 | 
| +    LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment();
 | 
| +    safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
 | 
| +    // Put the result value into the result register slot and
 | 
| +    // restore all registers.
 | 
| +    __ StoreToSafepointRegisterSlot(result, result);
 | 
| +    __ b(&done);
 | 
| +  }
 | 
|  
 | 
| -  // Get the temp register reserved by the instruction. This needs to be r4 as
 | 
| -  // its slot of the pushing of safepoint registers is used to communicate the
 | 
| -  // offset to the location of the map check.
 | 
| -  Register temp = ToRegister(instr->TempAt(0));
 | 
| -  ASSERT(temp.is(r4));
 | 
| -  __ LoadHeapObject(InstanceofStub::right(), instr->function());
 | 
| -  static const int kAdditionalDelta = 4;
 | 
| -  int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta;
 | 
| -  Label before_push_delta;
 | 
| -  __ bind(&before_push_delta);
 | 
| -  __ BlockConstPoolFor(kAdditionalDelta);
 | 
| -  __ mov(temp, Operand(delta * kPointerSize));
 | 
| -  __ StoreToSafepointRegisterSlot(temp, temp);
 | 
| -  CallCodeGeneric(stub.GetCode(),
 | 
| -                  RelocInfo::CODE_TARGET,
 | 
| -                  instr,
 | 
| -                  RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
 | 
| -  LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment();
 | 
| -  safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
 | 
| -  // Put the result value into the result register slot and
 | 
| -  // restore all registers.
 | 
| -  __ StoreToSafepointRegisterSlot(result, result);
 | 
| +  __ bind(&false_result);
 | 
| +  __ LoadRoot(result, Heap::kFalseValueRootIndex);
 | 
| +
 | 
| +  // Here result has either true or false. Deferred code also produces true or
 | 
| +  // false object.
 | 
| +  __ bind(&done);
 | 
|  }
 | 
|  
 | 
|  
 | 
| 
 |