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 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS64 | 9 #if V8_TARGET_ARCH_MIPS64 |
10 | 10 |
(...skipping 4349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4360 | 4360 |
4361 | 4361 |
4362 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 4362 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
4363 int64_t offset = (ref0.address() - ref1.address()); | 4363 int64_t offset = (ref0.address() - ref1.address()); |
4364 DCHECK(static_cast<int>(offset) == offset); | 4364 DCHECK(static_cast<int>(offset) == offset); |
4365 return static_cast<int>(offset); | 4365 return static_cast<int>(offset); |
4366 } | 4366 } |
4367 | 4367 |
4368 | 4368 |
4369 void MacroAssembler::CallApiFunctionAndReturn( | 4369 void MacroAssembler::CallApiFunctionAndReturn( |
4370 Register function_address, | 4370 Register function_address, ExternalReference thunk_ref, int stack_space, |
4371 ExternalReference thunk_ref, | 4371 MemOperand* stack_space_operand, MemOperand return_value_operand, |
4372 int stack_space, | |
4373 MemOperand return_value_operand, | |
4374 MemOperand* context_restore_operand) { | 4372 MemOperand* context_restore_operand) { |
4375 ExternalReference next_address = | 4373 ExternalReference next_address = |
4376 ExternalReference::handle_scope_next_address(isolate()); | 4374 ExternalReference::handle_scope_next_address(isolate()); |
4377 const int kNextOffset = 0; | 4375 const int kNextOffset = 0; |
4378 const int kLimitOffset = AddressOffset( | 4376 const int kLimitOffset = AddressOffset( |
4379 ExternalReference::handle_scope_limit_address(isolate()), | 4377 ExternalReference::handle_scope_limit_address(isolate()), |
4380 next_address); | 4378 next_address); |
4381 const int kLevelOffset = AddressOffset( | 4379 const int kLevelOffset = AddressOffset( |
4382 ExternalReference::handle_scope_level_address(isolate()), | 4380 ExternalReference::handle_scope_level_address(isolate()), |
4383 next_address); | 4381 next_address); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4457 LoadRoot(a4, Heap::kTheHoleValueRootIndex); | 4455 LoadRoot(a4, Heap::kTheHoleValueRootIndex); |
4458 li(at, Operand(ExternalReference::scheduled_exception_address(isolate()))); | 4456 li(at, Operand(ExternalReference::scheduled_exception_address(isolate()))); |
4459 ld(a5, MemOperand(at)); | 4457 ld(a5, MemOperand(at)); |
4460 Branch(&promote_scheduled_exception, ne, a4, Operand(a5)); | 4458 Branch(&promote_scheduled_exception, ne, a4, Operand(a5)); |
4461 bind(&exception_handled); | 4459 bind(&exception_handled); |
4462 | 4460 |
4463 bool restore_context = context_restore_operand != NULL; | 4461 bool restore_context = context_restore_operand != NULL; |
4464 if (restore_context) { | 4462 if (restore_context) { |
4465 ld(cp, *context_restore_operand); | 4463 ld(cp, *context_restore_operand); |
4466 } | 4464 } |
4467 li(s0, Operand(stack_space)); | 4465 if (stack_space_operand != NULL) { |
4468 LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN); | 4466 lw(s0, *stack_space_operand); |
4469 | 4467 } else { |
| 4468 li(s0, Operand(stack_space)); |
| 4469 } |
| 4470 LeaveExitFrame(false, s0, !restore_context, EMIT_RETURN, |
| 4471 stack_space_operand != NULL); |
4470 bind(&promote_scheduled_exception); | 4472 bind(&promote_scheduled_exception); |
4471 { | 4473 { |
4472 FrameScope frame(this, StackFrame::INTERNAL); | 4474 FrameScope frame(this, StackFrame::INTERNAL); |
4473 CallExternalReference( | 4475 CallExternalReference( |
4474 ExternalReference(Runtime::kPromoteScheduledException, isolate()), | 4476 ExternalReference(Runtime::kPromoteScheduledException, isolate()), |
4475 0); | 4477 0); |
4476 } | 4478 } |
4477 jmp(&exception_handled); | 4479 jmp(&exception_handled); |
4478 | 4480 |
4479 // HandleScope limit has changed. Delete allocated extensions. | 4481 // HandleScope limit has changed. Delete allocated extensions. |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5109 And(sp, sp, Operand(-frame_alignment)); // Align stack. | 5111 And(sp, sp, Operand(-frame_alignment)); // Align stack. |
5110 } | 5112 } |
5111 | 5113 |
5112 // Set the exit frame sp value to point just before the return address | 5114 // Set the exit frame sp value to point just before the return address |
5113 // location. | 5115 // location. |
5114 daddiu(at, sp, kPointerSize); | 5116 daddiu(at, sp, kPointerSize); |
5115 sd(at, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 5117 sd(at, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
5116 } | 5118 } |
5117 | 5119 |
5118 | 5120 |
5119 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 5121 void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count, |
5120 Register argument_count, | 5122 bool restore_context, bool do_return, |
5121 bool restore_context, | 5123 bool argument_count_is_length) { |
5122 bool do_return) { | |
5123 // Optionally restore all double registers. | 5124 // Optionally restore all double registers. |
5124 if (save_doubles) { | 5125 if (save_doubles) { |
5125 // Remember: we only need to restore every 2nd double FPU value. | 5126 // Remember: we only need to restore every 2nd double FPU value. |
5126 int kNumOfSavedRegisters = FPURegister::kMaxNumRegisters / 2; | 5127 int kNumOfSavedRegisters = FPURegister::kMaxNumRegisters / 2; |
5127 Dsubu(t8, fp, Operand(ExitFrameConstants::kFrameSize + | 5128 Dsubu(t8, fp, Operand(ExitFrameConstants::kFrameSize + |
5128 kNumOfSavedRegisters * kDoubleSize)); | 5129 kNumOfSavedRegisters * kDoubleSize)); |
5129 for (int i = 0; i < kNumOfSavedRegisters; i++) { | 5130 for (int i = 0; i < kNumOfSavedRegisters; i++) { |
5130 FPURegister reg = FPURegister::from_code(2 * i); | 5131 FPURegister reg = FPURegister::from_code(2 * i); |
5131 ldc1(reg, MemOperand(t8, i * kDoubleSize)); | 5132 ldc1(reg, MemOperand(t8, i * kDoubleSize)); |
5132 } | 5133 } |
(...skipping 12 matching lines...) Expand all Loading... |
5145 li(t8, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 5146 li(t8, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
5146 sd(a3, MemOperand(t8)); | 5147 sd(a3, MemOperand(t8)); |
5147 #endif | 5148 #endif |
5148 | 5149 |
5149 // Pop the arguments, restore registers, and return. | 5150 // Pop the arguments, restore registers, and return. |
5150 mov(sp, fp); // Respect ABI stack constraint. | 5151 mov(sp, fp); // Respect ABI stack constraint. |
5151 ld(fp, MemOperand(sp, ExitFrameConstants::kCallerFPOffset)); | 5152 ld(fp, MemOperand(sp, ExitFrameConstants::kCallerFPOffset)); |
5152 ld(ra, MemOperand(sp, ExitFrameConstants::kCallerPCOffset)); | 5153 ld(ra, MemOperand(sp, ExitFrameConstants::kCallerPCOffset)); |
5153 | 5154 |
5154 if (argument_count.is_valid()) { | 5155 if (argument_count.is_valid()) { |
5155 dsll(t8, argument_count, kPointerSizeLog2); | 5156 if (argument_count_is_length) { |
5156 daddu(sp, sp, t8); | 5157 daddu(sp, sp, argument_count); |
| 5158 } else { |
| 5159 dsll(t8, argument_count, kPointerSizeLog2); |
| 5160 daddu(sp, sp, t8); |
| 5161 } |
5157 } | 5162 } |
5158 | 5163 |
5159 if (do_return) { | 5164 if (do_return) { |
5160 Ret(USE_DELAY_SLOT); | 5165 Ret(USE_DELAY_SLOT); |
5161 // If returning, the instruction in the delay slot will be the addiu below. | 5166 // If returning, the instruction in the delay slot will be the addiu below. |
5162 } | 5167 } |
5163 daddiu(sp, sp, 2 * kPointerSize); | 5168 daddiu(sp, sp, 2 * kPointerSize); |
5164 } | 5169 } |
5165 | 5170 |
5166 | 5171 |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6316 } | 6321 } |
6317 if (mag.shift > 0) sra(result, result, mag.shift); | 6322 if (mag.shift > 0) sra(result, result, mag.shift); |
6318 srl(at, dividend, 31); | 6323 srl(at, dividend, 31); |
6319 Addu(result, result, Operand(at)); | 6324 Addu(result, result, Operand(at)); |
6320 } | 6325 } |
6321 | 6326 |
6322 | 6327 |
6323 } } // namespace v8::internal | 6328 } } // namespace v8::internal |
6324 | 6329 |
6325 #endif // V8_TARGET_ARCH_MIPS64 | 6330 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |