| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // Copyright 2012 the V8 project authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 7 | 7 |
| 8 #if V8_TARGET_ARCH_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 4028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4039 } | 4039 } |
| 4040 } else { | 4040 } else { |
| 4041 Jump(adaptor, RelocInfo::CODE_TARGET); | 4041 Jump(adaptor, RelocInfo::CODE_TARGET); |
| 4042 } | 4042 } |
| 4043 bind(®ular_invoke); | 4043 bind(®ular_invoke); |
| 4044 } | 4044 } |
| 4045 } | 4045 } |
| 4046 | 4046 |
| 4047 | 4047 |
| 4048 void MacroAssembler::InvokeCode(Register code, | 4048 void MacroAssembler::InvokeCode(Register code, |
| 4049 Register new_target, |
| 4049 const ParameterCount& expected, | 4050 const ParameterCount& expected, |
| 4050 const ParameterCount& actual, | 4051 const ParameterCount& actual, |
| 4051 InvokeFlag flag, | 4052 InvokeFlag flag, |
| 4052 const CallWrapper& call_wrapper) { | 4053 const CallWrapper& call_wrapper) { |
| 4053 // You can't call a function without a valid frame. | 4054 // You can't call a function without a valid frame. |
| 4054 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 4055 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
| 4055 | 4056 |
| 4057 // Ensure new target is passed in the correct register. Otherwise clear the |
| 4058 // appropriate register in case new target is not given. |
| 4059 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(a3)); |
| 4060 if (!new_target.is_valid()) { |
| 4061 LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
| 4062 } |
| 4063 |
| 4056 Label done; | 4064 Label done; |
| 4057 | |
| 4058 bool definitely_mismatches = false; | 4065 bool definitely_mismatches = false; |
| 4059 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, | 4066 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, |
| 4060 call_wrapper); | 4067 call_wrapper); |
| 4061 if (!definitely_mismatches) { | 4068 if (!definitely_mismatches) { |
| 4062 if (flag == CALL_FUNCTION) { | 4069 if (flag == CALL_FUNCTION) { |
| 4063 call_wrapper.BeforeCall(CallSize(code)); | 4070 call_wrapper.BeforeCall(CallSize(code)); |
| 4064 Call(code); | 4071 Call(code); |
| 4065 call_wrapper.AfterCall(); | 4072 call_wrapper.AfterCall(); |
| 4066 } else { | 4073 } else { |
| 4067 DCHECK(flag == JUMP_FUNCTION); | 4074 DCHECK(flag == JUMP_FUNCTION); |
| 4068 Jump(code); | 4075 Jump(code); |
| 4069 } | 4076 } |
| 4070 // Continue here if InvokePrologue does handle the invocation due to | 4077 // Continue here if InvokePrologue does handle the invocation due to |
| 4071 // mismatched parameter counts. | 4078 // mismatched parameter counts. |
| 4072 bind(&done); | 4079 bind(&done); |
| 4073 } | 4080 } |
| 4074 } | 4081 } |
| 4075 | 4082 |
| 4076 | 4083 |
| 4077 void MacroAssembler::InvokeFunction(Register function, | 4084 void MacroAssembler::InvokeFunction(Register function, |
| 4085 Register new_target, |
| 4078 const ParameterCount& actual, | 4086 const ParameterCount& actual, |
| 4079 InvokeFlag flag, | 4087 InvokeFlag flag, |
| 4080 const CallWrapper& call_wrapper) { | 4088 const CallWrapper& call_wrapper) { |
| 4081 // You can't call a function without a valid frame. | 4089 // You can't call a function without a valid frame. |
| 4082 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 4090 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
| 4083 | 4091 |
| 4084 // Contract with called JS functions requires that function is passed in a1. | 4092 // Contract with called JS functions requires that function is passed in a1. |
| 4085 DCHECK(function.is(a1)); | 4093 DCHECK(function.is(a1)); |
| 4086 Register expected_reg = a2; | 4094 Register expected_reg = a2; |
| 4087 Register code_reg = a3; | 4095 Register code_reg = t0; |
| 4088 | 4096 |
| 4089 lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 4097 lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 4090 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 4098 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 4091 lw(expected_reg, | 4099 lw(expected_reg, |
| 4092 FieldMemOperand(code_reg, | 4100 FieldMemOperand(code_reg, |
| 4093 SharedFunctionInfo::kFormalParameterCountOffset)); | 4101 SharedFunctionInfo::kFormalParameterCountOffset)); |
| 4094 sra(expected_reg, expected_reg, kSmiTagSize); | 4102 sra(expected_reg, expected_reg, kSmiTagSize); |
| 4095 lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 4103 lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
| 4096 | 4104 |
| 4097 ParameterCount expected(expected_reg); | 4105 ParameterCount expected(expected_reg); |
| 4098 InvokeCode(code_reg, expected, actual, flag, call_wrapper); | 4106 InvokeCode(code_reg, new_target, expected, actual, flag, call_wrapper); |
| 4099 } | 4107 } |
| 4100 | 4108 |
| 4101 | 4109 |
| 4102 void MacroAssembler::InvokeFunction(Register function, | 4110 void MacroAssembler::InvokeFunction(Register function, |
| 4103 const ParameterCount& expected, | 4111 const ParameterCount& expected, |
| 4104 const ParameterCount& actual, | 4112 const ParameterCount& actual, |
| 4105 InvokeFlag flag, | 4113 InvokeFlag flag, |
| 4106 const CallWrapper& call_wrapper) { | 4114 const CallWrapper& call_wrapper) { |
| 4107 // You can't call a function without a valid frame. | 4115 // You can't call a function without a valid frame. |
| 4108 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 4116 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
| 4109 | 4117 |
| 4110 // Contract with called JS functions requires that function is passed in a1. | 4118 // Contract with called JS functions requires that function is passed in a1. |
| 4111 DCHECK(function.is(a1)); | 4119 DCHECK(function.is(a1)); |
| 4112 | 4120 |
| 4113 // Get the function and setup the context. | 4121 // Get the function and setup the context. |
| 4114 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 4122 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 4115 | 4123 |
| 4116 // We call indirectly through the code field in the function to | 4124 // We call indirectly through the code field in the function to |
| 4117 // allow recompilation to take effect without changing any of the | 4125 // allow recompilation to take effect without changing any of the |
| 4118 // call sites. | 4126 // call sites. |
| 4119 lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 4127 lw(t0, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
| 4120 InvokeCode(a3, expected, actual, flag, call_wrapper); | 4128 InvokeCode(t0, no_reg, expected, actual, flag, call_wrapper); |
| 4121 } | 4129 } |
| 4122 | 4130 |
| 4123 | 4131 |
| 4124 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, | 4132 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, |
| 4125 const ParameterCount& expected, | 4133 const ParameterCount& expected, |
| 4126 const ParameterCount& actual, | 4134 const ParameterCount& actual, |
| 4127 InvokeFlag flag, | 4135 InvokeFlag flag, |
| 4128 const CallWrapper& call_wrapper) { | 4136 const CallWrapper& call_wrapper) { |
| 4129 li(a1, function); | 4137 li(a1, function); |
| 4130 InvokeFunction(a1, expected, actual, flag, call_wrapper); | 4138 InvokeFunction(a1, expected, actual, flag, call_wrapper); |
| (...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5845 if (mag.shift > 0) sra(result, result, mag.shift); | 5853 if (mag.shift > 0) sra(result, result, mag.shift); |
| 5846 srl(at, dividend, 31); | 5854 srl(at, dividend, 31); |
| 5847 Addu(result, result, Operand(at)); | 5855 Addu(result, result, Operand(at)); |
| 5848 } | 5856 } |
| 5849 | 5857 |
| 5850 | 5858 |
| 5851 } // namespace internal | 5859 } // namespace internal |
| 5852 } // namespace v8 | 5860 } // namespace v8 |
| 5853 | 5861 |
| 5854 #endif // V8_TARGET_ARCH_MIPS | 5862 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |