OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 __ bind(&l_call); | 2044 __ bind(&l_call); |
2045 __ lw(load_receiver, MemOperand(sp, kPointerSize)); | 2045 __ lw(load_receiver, MemOperand(sp, kPointerSize)); |
2046 __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); | 2046 __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); |
2047 __ li(LoadDescriptor::SlotRegister(), | 2047 __ li(LoadDescriptor::SlotRegister(), |
2048 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2048 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2049 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 2049 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2050 CallIC(ic, TypeFeedbackId::None()); | 2050 CallIC(ic, TypeFeedbackId::None()); |
2051 __ mov(a0, v0); | 2051 __ mov(a0, v0); |
2052 __ mov(a1, a0); | 2052 __ mov(a1, a0); |
2053 __ sw(a1, MemOperand(sp, 2 * kPointerSize)); | 2053 __ sw(a1, MemOperand(sp, 2 * kPointerSize)); |
2054 SetCallPosition(expr, 1); | 2054 SetCallPosition(expr); |
2055 __ li(a0, Operand(1)); | 2055 __ li(a0, Operand(1)); |
2056 __ Call( | 2056 __ Call( |
2057 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), | 2057 isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), |
2058 RelocInfo::CODE_TARGET); | 2058 RelocInfo::CODE_TARGET); |
2059 | 2059 |
2060 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2060 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2061 __ Drop(1); // The function is still on the stack; drop it. | 2061 __ Drop(1); // The function is still on the stack; drop it. |
2062 | 2062 |
2063 // if (!result.done) goto l_try; | 2063 // if (!result.done) goto l_try; |
2064 __ Move(load_receiver, v0); | 2064 __ Move(load_receiver, v0); |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2862 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { | 2862 void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { |
2863 // Load the arguments. | 2863 // Load the arguments. |
2864 ZoneList<Expression*>* args = expr->arguments(); | 2864 ZoneList<Expression*>* args = expr->arguments(); |
2865 int arg_count = args->length(); | 2865 int arg_count = args->length(); |
2866 for (int i = 0; i < arg_count; i++) { | 2866 for (int i = 0; i < arg_count; i++) { |
2867 VisitForStackValue(args->at(i)); | 2867 VisitForStackValue(args->at(i)); |
2868 } | 2868 } |
2869 | 2869 |
2870 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | 2870 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
2871 // Record source position of the IC call. | 2871 // Record source position of the IC call. |
2872 SetCallPosition(expr, arg_count); | 2872 SetCallPosition(expr); |
2873 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); | 2873 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); |
2874 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 2874 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
2875 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2875 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2876 // Don't assign a type feedback id to the IC, since type feedback is provided | 2876 // Don't assign a type feedback id to the IC, since type feedback is provided |
2877 // by the vector above. | 2877 // by the vector above. |
2878 CallIC(ic); | 2878 CallIC(ic); |
2879 | 2879 |
2880 RecordJSReturnSite(expr); | 2880 RecordJSReturnSite(expr); |
2881 // Restore context register. | 2881 // Restore context register. |
2882 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2882 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2969 // resolve eval. | 2969 // resolve eval. |
2970 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2970 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2971 __ push(a1); | 2971 __ push(a1); |
2972 EmitResolvePossiblyDirectEval(arg_count); | 2972 EmitResolvePossiblyDirectEval(arg_count); |
2973 | 2973 |
2974 // Touch up the stack with the resolved function. | 2974 // Touch up the stack with the resolved function. |
2975 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2975 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2976 | 2976 |
2977 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | 2977 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
2978 // Record source position for debugger. | 2978 // Record source position for debugger. |
2979 SetCallPosition(expr, arg_count); | 2979 SetCallPosition(expr); |
2980 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2980 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2981 __ li(a0, Operand(arg_count)); | 2981 __ li(a0, Operand(arg_count)); |
2982 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2982 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
2983 RecordJSReturnSite(expr); | 2983 RecordJSReturnSite(expr); |
2984 // Restore context register. | 2984 // Restore context register. |
2985 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2985 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2986 context()->DropAndPlug(1, v0); | 2986 context()->DropAndPlug(1, v0); |
2987 } | 2987 } |
2988 | 2988 |
2989 | 2989 |
(...skipping 11 matching lines...) Expand all Loading... |
3001 | 3001 |
3002 // Push the arguments ("left-to-right") on the stack. | 3002 // Push the arguments ("left-to-right") on the stack. |
3003 ZoneList<Expression*>* args = expr->arguments(); | 3003 ZoneList<Expression*>* args = expr->arguments(); |
3004 int arg_count = args->length(); | 3004 int arg_count = args->length(); |
3005 for (int i = 0; i < arg_count; i++) { | 3005 for (int i = 0; i < arg_count; i++) { |
3006 VisitForStackValue(args->at(i)); | 3006 VisitForStackValue(args->at(i)); |
3007 } | 3007 } |
3008 | 3008 |
3009 // Call the construct call builtin that handles allocation and | 3009 // Call the construct call builtin that handles allocation and |
3010 // constructor invocation. | 3010 // constructor invocation. |
3011 SetConstructCallPosition(expr, arg_count); | 3011 SetConstructCallPosition(expr); |
3012 | 3012 |
3013 // Load function and argument count into a1 and a0. | 3013 // Load function and argument count into a1 and a0. |
3014 __ li(a0, Operand(arg_count)); | 3014 __ li(a0, Operand(arg_count)); |
3015 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); | 3015 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
3016 | 3016 |
3017 // Record call targets in unoptimized code. | 3017 // Record call targets in unoptimized code. |
3018 __ EmitLoadTypeFeedbackVector(a2); | 3018 __ EmitLoadTypeFeedbackVector(a2); |
3019 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 3019 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
3020 | 3020 |
3021 Handle<Code> code = CodeFactory::ConstructIC(isolate()).code(); | 3021 Handle<Code> code = CodeFactory::ConstructIC(isolate()).code(); |
(...skipping 15 matching lines...) Expand all Loading... |
3037 | 3037 |
3038 // Push the arguments ("left-to-right") on the stack. | 3038 // Push the arguments ("left-to-right") on the stack. |
3039 ZoneList<Expression*>* args = expr->arguments(); | 3039 ZoneList<Expression*>* args = expr->arguments(); |
3040 int arg_count = args->length(); | 3040 int arg_count = args->length(); |
3041 for (int i = 0; i < arg_count; i++) { | 3041 for (int i = 0; i < arg_count; i++) { |
3042 VisitForStackValue(args->at(i)); | 3042 VisitForStackValue(args->at(i)); |
3043 } | 3043 } |
3044 | 3044 |
3045 // Call the construct call builtin that handles allocation and | 3045 // Call the construct call builtin that handles allocation and |
3046 // constructor invocation. | 3046 // constructor invocation. |
3047 SetConstructCallPosition(expr, arg_count); | 3047 SetConstructCallPosition(expr); |
3048 | 3048 |
3049 // Load new target into a3. | 3049 // Load new target into a3. |
3050 VisitForAccumulatorValue(super_call_ref->new_target_var()); | 3050 VisitForAccumulatorValue(super_call_ref->new_target_var()); |
3051 __ mov(a3, result_register()); | 3051 __ mov(a3, result_register()); |
3052 | 3052 |
3053 // Load function and argument count into a1 and a0. | 3053 // Load function and argument count into a1 and a0. |
3054 __ li(a0, Operand(arg_count)); | 3054 __ li(a0, Operand(arg_count)); |
3055 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); | 3055 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
3056 | 3056 |
3057 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 3057 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3787 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3787 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
3788 ZoneList<Expression*>* args = expr->arguments(); | 3788 ZoneList<Expression*>* args = expr->arguments(); |
3789 DCHECK(args->length() == 2); | 3789 DCHECK(args->length() == 2); |
3790 | 3790 |
3791 // Evaluate new.target and super constructor. | 3791 // Evaluate new.target and super constructor. |
3792 VisitForStackValue(args->at(0)); | 3792 VisitForStackValue(args->at(0)); |
3793 VisitForStackValue(args->at(1)); | 3793 VisitForStackValue(args->at(1)); |
3794 | 3794 |
3795 // Call the construct call builtin that handles allocation and | 3795 // Call the construct call builtin that handles allocation and |
3796 // constructor invocation. | 3796 // constructor invocation. |
3797 SetConstructCallPosition(expr, 0); | 3797 SetConstructCallPosition(expr); |
3798 | 3798 |
3799 // Load new target into a3. | 3799 // Load new target into a3. |
3800 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); | 3800 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); |
3801 | 3801 |
3802 // Check if the calling frame is an arguments adaptor frame. | 3802 // Check if the calling frame is an arguments adaptor frame. |
3803 Label adaptor_frame, args_set_up, runtime; | 3803 Label adaptor_frame, args_set_up, runtime; |
3804 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 3804 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
3805 __ lw(t0, MemOperand(a2, StandardFrameConstants::kContextOffset)); | 3805 __ lw(t0, MemOperand(a2, StandardFrameConstants::kContextOffset)); |
3806 __ Branch(&adaptor_frame, eq, t0, | 3806 __ Branch(&adaptor_frame, eq, t0, |
3807 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 3807 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4161 __ push(v0); | 4161 __ push(v0); |
4162 | 4162 |
4163 __ LoadNativeContextSlot(expr->context_index(), v0); | 4163 __ LoadNativeContextSlot(expr->context_index(), v0); |
4164 } | 4164 } |
4165 | 4165 |
4166 | 4166 |
4167 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4167 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4168 ZoneList<Expression*>* args = expr->arguments(); | 4168 ZoneList<Expression*>* args = expr->arguments(); |
4169 int arg_count = args->length(); | 4169 int arg_count = args->length(); |
4170 | 4170 |
4171 SetCallPosition(expr, arg_count); | 4171 SetCallPosition(expr); |
4172 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4172 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4173 __ li(a0, Operand(arg_count)); | 4173 __ li(a0, Operand(arg_count)); |
4174 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), | 4174 __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), |
4175 RelocInfo::CODE_TARGET); | 4175 RelocInfo::CODE_TARGET); |
4176 } | 4176 } |
4177 | 4177 |
4178 | 4178 |
4179 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4179 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4180 ZoneList<Expression*>* args = expr->arguments(); | 4180 ZoneList<Expression*>* args = expr->arguments(); |
4181 int arg_count = args->length(); | 4181 int arg_count = args->length(); |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4969 reinterpret_cast<uint32_t>( | 4969 reinterpret_cast<uint32_t>( |
4970 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4970 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4971 return OSR_AFTER_STACK_CHECK; | 4971 return OSR_AFTER_STACK_CHECK; |
4972 } | 4972 } |
4973 | 4973 |
4974 | 4974 |
4975 } // namespace internal | 4975 } // namespace internal |
4976 } // namespace v8 | 4976 } // namespace v8 |
4977 | 4977 |
4978 #endif // V8_TARGET_ARCH_MIPS | 4978 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |