| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2774 }; | 2774 }; |
| 2775 | 2775 |
| 2776 DeferredInstanceOfKnownGlobal* deferred; | 2776 DeferredInstanceOfKnownGlobal* deferred; |
| 2777 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); | 2777 deferred = new(zone()) DeferredInstanceOfKnownGlobal(this, instr); |
| 2778 | 2778 |
| 2779 Label done, false_result; | 2779 Label done, false_result; |
| 2780 Register object = ToRegister(instr->value()); | 2780 Register object = ToRegister(instr->value()); |
| 2781 Register temp = ToRegister(instr->temp()); | 2781 Register temp = ToRegister(instr->temp()); |
| 2782 Register result = ToRegister(instr->result()); | 2782 Register result = ToRegister(instr->result()); |
| 2783 | 2783 |
| 2784 ASSERT(object.is(r0)); | |
| 2785 ASSERT(result.is(r0)); | |
| 2786 | |
| 2787 // A Smi is not instance of anything. | 2784 // A Smi is not instance of anything. |
| 2788 __ JumpIfSmi(object, &false_result); | 2785 __ JumpIfSmi(object, &false_result); |
| 2789 | 2786 |
| 2790 // This is the inlined call site instanceof cache. The two occurences of the | 2787 // This is the inlined call site instanceof cache. The two occurences of the |
| 2791 // hole value will be patched to the last map/result pair generated by the | 2788 // hole value will be patched to the last map/result pair generated by the |
| 2792 // instanceof stub. | 2789 // instanceof stub. |
| 2793 Label cache_miss; | 2790 Label cache_miss; |
| 2794 Register map = temp; | 2791 Register map = temp; |
| 2795 __ ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 2792 __ ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 2796 { | 2793 { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 | 2831 |
| 2835 // Here result has either true or false. Deferred code also produces true or | 2832 // Here result has either true or false. Deferred code also produces true or |
| 2836 // false object. | 2833 // false object. |
| 2837 __ bind(deferred->exit()); | 2834 __ bind(deferred->exit()); |
| 2838 __ bind(&done); | 2835 __ bind(&done); |
| 2839 } | 2836 } |
| 2840 | 2837 |
| 2841 | 2838 |
| 2842 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 2839 void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
| 2843 Label* map_check) { | 2840 Label* map_check) { |
| 2844 Register result = ToRegister(instr->result()); | |
| 2845 ASSERT(result.is(r0)); | |
| 2846 | |
| 2847 InstanceofStub::Flags flags = InstanceofStub::kNoFlags; | 2841 InstanceofStub::Flags flags = InstanceofStub::kNoFlags; |
| 2848 flags = static_cast<InstanceofStub::Flags>( | 2842 flags = static_cast<InstanceofStub::Flags>( |
| 2849 flags | InstanceofStub::kArgsInRegisters); | 2843 flags | InstanceofStub::kArgsInRegisters); |
| 2850 flags = static_cast<InstanceofStub::Flags>( | 2844 flags = static_cast<InstanceofStub::Flags>( |
| 2851 flags | InstanceofStub::kCallSiteInlineCheck); | 2845 flags | InstanceofStub::kCallSiteInlineCheck); |
| 2852 flags = static_cast<InstanceofStub::Flags>( | 2846 flags = static_cast<InstanceofStub::Flags>( |
| 2853 flags | InstanceofStub::kReturnTrueFalseObject); | 2847 flags | InstanceofStub::kReturnTrueFalseObject); |
| 2854 InstanceofStub stub(flags); | 2848 InstanceofStub stub(flags); |
| 2855 | 2849 |
| 2856 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 2850 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
| 2857 LoadContextFromDeferred(instr->context()); | 2851 LoadContextFromDeferred(instr->context()); |
| 2858 | 2852 |
| 2859 // Get the temp register reserved by the instruction. This needs to be r4 as | |
| 2860 // its slot of the pushing of safepoint registers is used to communicate the | |
| 2861 // offset to the location of the map check. | |
| 2862 Register temp = ToRegister(instr->temp()); | |
| 2863 ASSERT(temp.is(r4)); | |
| 2864 __ Move(InstanceofStub::right(), instr->function()); | 2853 __ Move(InstanceofStub::right(), instr->function()); |
| 2865 static const int kAdditionalDelta = 5; | 2854 static const int kAdditionalDelta = 4; |
| 2866 // Make sure that code size is predicable, since we use specific constants | 2855 // Make sure that code size is predicable, since we use specific constants |
| 2867 // offsets in the code to find embedded values.. | 2856 // offsets in the code to find embedded values.. |
| 2868 PredictableCodeSizeScope predictable(masm_, 6 * Assembler::kInstrSize); | 2857 PredictableCodeSizeScope predictable(masm_, 5 * Assembler::kInstrSize); |
| 2869 int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta; | 2858 int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta; |
| 2870 Label before_push_delta; | 2859 Label before_push_delta; |
| 2871 __ bind(&before_push_delta); | 2860 __ bind(&before_push_delta); |
| 2872 __ BlockConstPoolFor(kAdditionalDelta); | 2861 __ BlockConstPoolFor(kAdditionalDelta); |
| 2873 __ mov(temp, Operand(delta * kPointerSize)); | 2862 // r5 is used to communicate the offset to the location of the map check. |
| 2863 __ mov(r5, Operand(delta * kPointerSize)); |
| 2874 // The mov above can generate one or two instructions. The delta was computed | 2864 // The mov above can generate one or two instructions. The delta was computed |
| 2875 // for two instructions, so we need to pad here in case of one instruction. | 2865 // for two instructions, so we need to pad here in case of one instruction. |
| 2876 if (masm_->InstructionsGeneratedSince(&before_push_delta) != 2) { | 2866 if (masm_->InstructionsGeneratedSince(&before_push_delta) != 2) { |
| 2877 ASSERT_EQ(1, masm_->InstructionsGeneratedSince(&before_push_delta)); | 2867 ASSERT_EQ(1, masm_->InstructionsGeneratedSince(&before_push_delta)); |
| 2878 __ nop(); | 2868 __ nop(); |
| 2879 } | 2869 } |
| 2880 __ StoreToSafepointRegisterSlot(temp, temp); | |
| 2881 CallCodeGeneric(stub.GetCode(isolate()), | 2870 CallCodeGeneric(stub.GetCode(isolate()), |
| 2882 RelocInfo::CODE_TARGET, | 2871 RelocInfo::CODE_TARGET, |
| 2883 instr, | 2872 instr, |
| 2884 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 2873 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 2885 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); | 2874 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); |
| 2886 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 2875 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
| 2887 // Put the result value into the result register slot and | 2876 // Put the result value (r0) into the result register slot and |
| 2888 // restore all registers. | 2877 // restore all registers. |
| 2889 __ StoreToSafepointRegisterSlot(result, result); | 2878 __ StoreToSafepointRegisterSlot(r0, ToRegister(instr->result())); |
| 2890 } | 2879 } |
| 2891 | 2880 |
| 2892 | 2881 |
| 2893 void LCodeGen::DoCmpT(LCmpT* instr) { | 2882 void LCodeGen::DoCmpT(LCmpT* instr) { |
| 2894 ASSERT(ToRegister(instr->context()).is(cp)); | 2883 ASSERT(ToRegister(instr->context()).is(cp)); |
| 2895 Token::Value op = instr->op(); | 2884 Token::Value op = instr->op(); |
| 2896 | 2885 |
| 2897 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2886 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); |
| 2898 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2887 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2899 // This instruction also signals no smi code inlined. | 2888 // This instruction also signals no smi code inlined. |
| (...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5802 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5791 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5803 __ ldr(result, FieldMemOperand(scratch, | 5792 __ ldr(result, FieldMemOperand(scratch, |
| 5804 FixedArray::kHeaderSize - kPointerSize)); | 5793 FixedArray::kHeaderSize - kPointerSize)); |
| 5805 __ bind(&done); | 5794 __ bind(&done); |
| 5806 } | 5795 } |
| 5807 | 5796 |
| 5808 | 5797 |
| 5809 #undef __ | 5798 #undef __ |
| 5810 | 5799 |
| 5811 } } // namespace v8::internal | 5800 } } // namespace v8::internal |
| OLD | NEW |