| 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 2929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2940 | 2940 |
| 2941 | 2941 |
| 2942 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2942 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
| 2943 // Load the arguments. | 2943 // Load the arguments. |
| 2944 ZoneList<Expression*>* args = expr->arguments(); | 2944 ZoneList<Expression*>* args = expr->arguments(); |
| 2945 int arg_count = args->length(); | 2945 int arg_count = args->length(); |
| 2946 for (int i = 0; i < arg_count; i++) { | 2946 for (int i = 0; i < arg_count; i++) { |
| 2947 VisitForStackValue(args->at(i)); | 2947 VisitForStackValue(args->at(i)); |
| 2948 } | 2948 } |
| 2949 | 2949 |
| 2950 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 2950 // Record source position of the IC call. | 2951 // Record source position of the IC call. |
| 2951 SetCallPosition(expr, arg_count); | 2952 SetCallPosition(expr, arg_count); |
| 2952 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 2953 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
| 2953 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 2954 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
| 2954 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2955 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2955 // Don't assign a type feedback id to the IC, since type feedback is provided | 2956 // Don't assign a type feedback id to the IC, since type feedback is provided |
| 2956 // by the vector above. | 2957 // by the vector above. |
| 2957 CallIC(ic); | 2958 CallIC(ic); |
| 2958 | 2959 |
| 2959 RecordJSReturnSite(expr); | 2960 RecordJSReturnSite(expr); |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3906 } | 3907 } |
| 3907 | 3908 |
| 3908 | 3909 |
| 3909 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 3910 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
| 3910 ZoneList<Expression*>* args = expr->arguments(); | 3911 ZoneList<Expression*>* args = expr->arguments(); |
| 3911 DCHECK_LE(2, args->length()); | 3912 DCHECK_LE(2, args->length()); |
| 3912 // Push target, receiver and arguments onto the stack. | 3913 // Push target, receiver and arguments onto the stack. |
| 3913 for (Expression* const arg : *args) { | 3914 for (Expression* const arg : *args) { |
| 3914 VisitForStackValue(arg); | 3915 VisitForStackValue(arg); |
| 3915 } | 3916 } |
| 3917 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 3916 // Move target to a1. | 3918 // Move target to a1. |
| 3917 int const argc = args->length() - 2; | 3919 int const argc = args->length() - 2; |
| 3918 __ lw(a1, MemOperand(sp, (argc + 1) * kPointerSize)); | 3920 __ lw(a1, MemOperand(sp, (argc + 1) * kPointerSize)); |
| 3919 // Call the target. | 3921 // Call the target. |
| 3920 __ li(a0, Operand(argc)); | 3922 __ li(a0, Operand(argc)); |
| 3921 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3923 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 3922 // Restore context register. | 3924 // Restore context register. |
| 3923 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3925 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 3924 // Discard the function left on TOS. | 3926 // Discard the function left on TOS. |
| 3925 context()->DropAndPlug(1, v0); | 3927 context()->DropAndPlug(1, v0); |
| 3926 } | 3928 } |
| 3927 | 3929 |
| 3928 | 3930 |
| 3929 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3931 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
| 3930 ZoneList<Expression*>* args = expr->arguments(); | 3932 ZoneList<Expression*>* args = expr->arguments(); |
| 3931 DCHECK(args->length() >= 2); | 3933 DCHECK(args->length() >= 2); |
| 3932 | 3934 |
| 3933 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3935 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
| 3934 for (int i = 0; i < arg_count + 1; i++) { | 3936 for (int i = 0; i < arg_count + 1; i++) { |
| 3935 VisitForStackValue(args->at(i)); | 3937 VisitForStackValue(args->at(i)); |
| 3936 } | 3938 } |
| 3937 VisitForAccumulatorValue(args->last()); // Function. | 3939 VisitForAccumulatorValue(args->last()); // Function. |
| 3938 | 3940 |
| 3941 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 3939 Label runtime, done; | 3942 Label runtime, done; |
| 3940 // Check for non-function argument (including proxy). | 3943 // Check for non-function argument (including proxy). |
| 3941 __ JumpIfSmi(v0, &runtime); | 3944 __ JumpIfSmi(v0, &runtime); |
| 3942 __ GetObjectType(v0, a1, a1); | 3945 __ GetObjectType(v0, a1, a1); |
| 3943 __ Branch(&runtime, ne, a1, Operand(JS_FUNCTION_TYPE)); | 3946 __ Branch(&runtime, ne, a1, Operand(JS_FUNCTION_TYPE)); |
| 3944 | 3947 |
| 3945 // InvokeFunction requires the function in a1. Move it in there. | 3948 // InvokeFunction requires the function in a1. Move it in there. |
| 3946 __ mov(a1, result_register()); | 3949 __ mov(a1, result_register()); |
| 3947 ParameterCount count(arg_count); | 3950 ParameterCount count(arg_count); |
| 3948 __ InvokeFunction(a1, count, CALL_FUNCTION, NullCallWrapper()); | 3951 __ InvokeFunction(a1, count, CALL_FUNCTION, NullCallWrapper()); |
| (...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5150 reinterpret_cast<uint32_t>( | 5153 reinterpret_cast<uint32_t>( |
| 5151 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5154 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5152 return OSR_AFTER_STACK_CHECK; | 5155 return OSR_AFTER_STACK_CHECK; |
| 5153 } | 5156 } |
| 5154 | 5157 |
| 5155 | 5158 |
| 5156 } // namespace internal | 5159 } // namespace internal |
| 5157 } // namespace v8 | 5160 } // namespace v8 |
| 5158 | 5161 |
| 5159 #endif // V8_TARGET_ARCH_MIPS | 5162 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |