| 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 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2815 } | 2815 } |
| 2816 } | 2816 } |
| 2817 | 2817 |
| 2818 | 2818 |
| 2819 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2819 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
| 2820 ASSERT(ToRegister(instr->context()).is(cp)); | 2820 ASSERT(ToRegister(instr->context()).is(cp)); |
| 2821 ASSERT(ToRegister(instr->global_object()).is(a0)); | 2821 ASSERT(ToRegister(instr->global_object()).is(a0)); |
| 2822 ASSERT(ToRegister(instr->result()).is(v0)); | 2822 ASSERT(ToRegister(instr->result()).is(v0)); |
| 2823 | 2823 |
| 2824 __ li(a2, Operand(instr->name())); | 2824 __ li(a2, Operand(instr->name())); |
| 2825 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET | 2825 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
| 2826 : RelocInfo::CODE_TARGET_CONTEXT; | 2826 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
| 2827 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2827 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2828 CallCode(ic, mode, instr); | |
| 2829 } | 2828 } |
| 2830 | 2829 |
| 2831 | 2830 |
| 2832 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2831 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
| 2833 Register value = ToRegister(instr->value()); | 2832 Register value = ToRegister(instr->value()); |
| 2834 Register cell = scratch0(); | 2833 Register cell = scratch0(); |
| 2835 | 2834 |
| 2836 // Load the cell. | 2835 // Load the cell. |
| 2837 __ li(cell, Operand(instr->hydrogen()->cell().handle())); | 2836 __ li(cell, Operand(instr->hydrogen()->cell().handle())); |
| 2838 | 2837 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2853 // Cells are always rescanned, so no write barrier here. | 2852 // Cells are always rescanned, so no write barrier here. |
| 2854 } | 2853 } |
| 2855 | 2854 |
| 2856 | 2855 |
| 2857 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2856 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
| 2858 ASSERT(ToRegister(instr->context()).is(cp)); | 2857 ASSERT(ToRegister(instr->context()).is(cp)); |
| 2859 ASSERT(ToRegister(instr->global_object()).is(a1)); | 2858 ASSERT(ToRegister(instr->global_object()).is(a1)); |
| 2860 ASSERT(ToRegister(instr->value()).is(a0)); | 2859 ASSERT(ToRegister(instr->value()).is(a0)); |
| 2861 | 2860 |
| 2862 __ li(a2, Operand(instr->name())); | 2861 __ li(a2, Operand(instr->name())); |
| 2863 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 2862 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
| 2864 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2863 instr->strict_mode_flag(), |
| 2865 : isolate()->builtins()->StoreIC_Initialize(); | 2864 CONTEXTUAL); |
| 2866 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2865 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2867 } | 2866 } |
| 2868 | 2867 |
| 2869 | 2868 |
| 2870 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2869 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 2871 Register context = ToRegister(instr->context()); | 2870 Register context = ToRegister(instr->context()); |
| 2872 Register result = ToRegister(instr->result()); | 2871 Register result = ToRegister(instr->result()); |
| 2873 | 2872 |
| 2874 __ lw(result, ContextOperand(context, instr->slot_index())); | 2873 __ lw(result, ContextOperand(context, instr->slot_index())); |
| 2875 if (instr->hydrogen()->RequiresHoleCheck()) { | 2874 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2876 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2875 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2953 } | 2952 } |
| 2954 | 2953 |
| 2955 | 2954 |
| 2956 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2955 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
| 2957 ASSERT(ToRegister(instr->context()).is(cp)); | 2956 ASSERT(ToRegister(instr->context()).is(cp)); |
| 2958 ASSERT(ToRegister(instr->object()).is(a0)); | 2957 ASSERT(ToRegister(instr->object()).is(a0)); |
| 2959 ASSERT(ToRegister(instr->result()).is(v0)); | 2958 ASSERT(ToRegister(instr->result()).is(v0)); |
| 2960 | 2959 |
| 2961 // Name is always in a2. | 2960 // Name is always in a2. |
| 2962 __ li(a2, Operand(instr->name())); | 2961 __ li(a2, Operand(instr->name())); |
| 2963 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2962 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
| 2964 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2963 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2965 } | 2964 } |
| 2966 | 2965 |
| 2967 | 2966 |
| 2968 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 2967 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
| 2969 Register scratch = scratch0(); | 2968 Register scratch = scratch0(); |
| 2970 Register function = ToRegister(instr->function()); | 2969 Register function = ToRegister(instr->function()); |
| 2971 Register result = ToRegister(instr->result()); | 2970 Register result = ToRegister(instr->result()); |
| 2972 | 2971 |
| 2973 // Check that the function really is a function. Load map into the | 2972 // Check that the function really is a function. Load map into the |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3905 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 3904 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); |
| 3906 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3905 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3907 } | 3906 } |
| 3908 | 3907 |
| 3909 | 3908 |
| 3910 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 3909 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
| 3911 ASSERT(ToRegister(instr->context()).is(cp)); | 3910 ASSERT(ToRegister(instr->context()).is(cp)); |
| 3912 ASSERT(ToRegister(instr->result()).is(v0)); | 3911 ASSERT(ToRegister(instr->result()).is(v0)); |
| 3913 | 3912 |
| 3914 int arity = instr->arity(); | 3913 int arity = instr->arity(); |
| 3915 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | |
| 3916 Handle<Code> ic = | 3914 Handle<Code> ic = |
| 3917 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 3915 isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL); |
| 3918 __ li(a2, Operand(instr->name())); | 3916 __ li(a2, Operand(instr->name())); |
| 3919 CallCode(ic, mode, instr); | 3917 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3920 } | 3918 } |
| 3921 | 3919 |
| 3922 | 3920 |
| 3923 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 3921 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 3924 ASSERT(ToRegister(instr->context()).is(cp)); | 3922 ASSERT(ToRegister(instr->context()).is(cp)); |
| 3925 ASSERT(ToRegister(instr->function()).is(a1)); | 3923 ASSERT(ToRegister(instr->function()).is(a1)); |
| 3926 ASSERT(ToRegister(instr->result()).is(v0)); | 3924 ASSERT(ToRegister(instr->result()).is(v0)); |
| 3927 | 3925 |
| 3928 int arity = instr->arity(); | 3926 int arity = instr->arity(); |
| 3929 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 3927 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
| 3930 if (instr->hydrogen()->IsTailCall()) { | 3928 if (instr->hydrogen()->IsTailCall()) { |
| 3931 if (NeedsEagerFrame()) __ mov(sp, fp); | 3929 if (NeedsEagerFrame()) __ mov(sp, fp); |
| 3932 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 3930 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
| 3933 } else { | 3931 } else { |
| 3934 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3932 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 3935 } | 3933 } |
| 3936 } | 3934 } |
| 3937 | 3935 |
| 3938 | 3936 |
| 3939 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 3937 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 3940 ASSERT(ToRegister(instr->context()).is(cp)); | 3938 ASSERT(ToRegister(instr->context()).is(cp)); |
| 3941 ASSERT(ToRegister(instr->result()).is(v0)); | 3939 ASSERT(ToRegister(instr->result()).is(v0)); |
| 3942 | 3940 |
| 3943 int arity = instr->arity(); | 3941 int arity = instr->arity(); |
| 3944 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | |
| 3945 Handle<Code> ic = | 3942 Handle<Code> ic = |
| 3946 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 3943 isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL); |
| 3947 __ li(a2, Operand(instr->name())); | 3944 __ li(a2, Operand(instr->name())); |
| 3948 CallCode(ic, mode, instr); | 3945 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3949 } | 3946 } |
| 3950 | 3947 |
| 3951 | 3948 |
| 3952 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 3949 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
| 3953 ASSERT(ToRegister(instr->result()).is(v0)); | 3950 ASSERT(ToRegister(instr->result()).is(v0)); |
| 3954 CallKnownFunction(instr->hydrogen()->target(), | 3951 CallKnownFunction(instr->hydrogen()->target(), |
| 3955 instr->hydrogen()->formal_parameter_count(), | 3952 instr->hydrogen()->formal_parameter_count(), |
| 3956 instr->arity(), | 3953 instr->arity(), |
| 3957 instr, | 3954 instr, |
| 3958 CALL_AS_FUNCTION, | 3955 CALL_AS_FUNCTION, |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4135 } | 4132 } |
| 4136 | 4133 |
| 4137 | 4134 |
| 4138 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4135 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 4139 ASSERT(ToRegister(instr->context()).is(cp)); | 4136 ASSERT(ToRegister(instr->context()).is(cp)); |
| 4140 ASSERT(ToRegister(instr->object()).is(a1)); | 4137 ASSERT(ToRegister(instr->object()).is(a1)); |
| 4141 ASSERT(ToRegister(instr->value()).is(a0)); | 4138 ASSERT(ToRegister(instr->value()).is(a0)); |
| 4142 | 4139 |
| 4143 // Name is always in a2. | 4140 // Name is always in a2. |
| 4144 __ li(a2, Operand(instr->name())); | 4141 __ li(a2, Operand(instr->name())); |
| 4145 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 4142 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
| 4146 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4143 instr->strict_mode_flag(), |
| 4147 : isolate()->builtins()->StoreIC_Initialize(); | 4144 NOT_CONTEXTUAL); |
| 4148 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4145 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4149 } | 4146 } |
| 4150 | 4147 |
| 4151 | 4148 |
| 4152 void LCodeGen::ApplyCheckIf(Condition condition, | 4149 void LCodeGen::ApplyCheckIf(Condition condition, |
| 4153 LBoundsCheck* check, | 4150 LBoundsCheck* check, |
| 4154 Register src1, | 4151 Register src1, |
| 4155 const Operand& src2) { | 4152 const Operand& src2) { |
| 4156 if (FLAG_debug_code && check->hydrogen()->skip_check()) { | 4153 if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
| 4157 Label done; | 4154 Label done; |
| (...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5818 __ Subu(scratch, result, scratch); | 5815 __ Subu(scratch, result, scratch); |
| 5819 __ lw(result, FieldMemOperand(scratch, | 5816 __ lw(result, FieldMemOperand(scratch, |
| 5820 FixedArray::kHeaderSize - kPointerSize)); | 5817 FixedArray::kHeaderSize - kPointerSize)); |
| 5821 __ bind(&done); | 5818 __ bind(&done); |
| 5822 } | 5819 } |
| 5823 | 5820 |
| 5824 | 5821 |
| 5825 #undef __ | 5822 #undef __ |
| 5826 | 5823 |
| 5827 } } // namespace v8::internal | 5824 } } // namespace v8::internal |
| OLD | NEW |