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_ARM | 9 #if V8_TARGET_ARCH_ARM |
10 | 10 |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 #else // V8_HOST_ARCH_ARM | 1111 #else // V8_HOST_ARCH_ARM |
1112 // If we are using the simulator then we should always align to the expected | 1112 // If we are using the simulator then we should always align to the expected |
1113 // alignment. As the simulator is used to generate snapshots we do not know | 1113 // alignment. As the simulator is used to generate snapshots we do not know |
1114 // if the target platform will need alignment, so this is controlled from a | 1114 // if the target platform will need alignment, so this is controlled from a |
1115 // flag. | 1115 // flag. |
1116 return FLAG_sim_stack_alignment; | 1116 return FLAG_sim_stack_alignment; |
1117 #endif // V8_HOST_ARCH_ARM | 1117 #endif // V8_HOST_ARCH_ARM |
1118 } | 1118 } |
1119 | 1119 |
1120 | 1120 |
1121 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 1121 void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count, |
1122 Register argument_count, | 1122 bool restore_context, |
1123 bool restore_context) { | 1123 bool argument_count_is_length) { |
1124 ConstantPoolUnavailableScope constant_pool_unavailable(this); | 1124 ConstantPoolUnavailableScope constant_pool_unavailable(this); |
1125 | 1125 |
1126 // Optionally restore all double registers. | 1126 // Optionally restore all double registers. |
1127 if (save_doubles) { | 1127 if (save_doubles) { |
1128 // Calculate the stack location of the saved doubles and restore them. | 1128 // Calculate the stack location of the saved doubles and restore them. |
1129 const int offset = ExitFrameConstants::kFrameSize; | 1129 const int offset = ExitFrameConstants::kFrameSize; |
1130 sub(r3, fp, | 1130 sub(r3, fp, |
1131 Operand(offset + DwVfpRegister::kMaxNumRegisters * kDoubleSize)); | 1131 Operand(offset + DwVfpRegister::kMaxNumRegisters * kDoubleSize)); |
1132 RestoreFPRegs(r3, ip); | 1132 RestoreFPRegs(r3, ip); |
1133 } | 1133 } |
(...skipping 13 matching lines...) Expand all Loading... |
1147 str(r3, MemOperand(ip)); | 1147 str(r3, MemOperand(ip)); |
1148 #endif | 1148 #endif |
1149 | 1149 |
1150 // Tear down the exit frame, pop the arguments, and return. | 1150 // Tear down the exit frame, pop the arguments, and return. |
1151 if (FLAG_enable_ool_constant_pool) { | 1151 if (FLAG_enable_ool_constant_pool) { |
1152 ldr(pp, MemOperand(fp, ExitFrameConstants::kConstantPoolOffset)); | 1152 ldr(pp, MemOperand(fp, ExitFrameConstants::kConstantPoolOffset)); |
1153 } | 1153 } |
1154 mov(sp, Operand(fp)); | 1154 mov(sp, Operand(fp)); |
1155 ldm(ia_w, sp, fp.bit() | lr.bit()); | 1155 ldm(ia_w, sp, fp.bit() | lr.bit()); |
1156 if (argument_count.is_valid()) { | 1156 if (argument_count.is_valid()) { |
1157 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); | 1157 if (argument_count_is_length) { |
| 1158 add(sp, sp, argument_count); |
| 1159 } else { |
| 1160 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
| 1161 } |
1158 } | 1162 } |
1159 } | 1163 } |
1160 | 1164 |
1161 | 1165 |
1162 void MacroAssembler::MovFromFloatResult(const DwVfpRegister dst) { | 1166 void MacroAssembler::MovFromFloatResult(const DwVfpRegister dst) { |
1163 if (use_eabi_hardfloat()) { | 1167 if (use_eabi_hardfloat()) { |
1164 Move(dst, d0); | 1168 Move(dst, d0); |
1165 } else { | 1169 } else { |
1166 vmov(dst, r0, r1); | 1170 vmov(dst, r0, r1); |
1167 } | 1171 } |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); | 2360 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); |
2357 } | 2361 } |
2358 | 2362 |
2359 | 2363 |
2360 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 2364 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
2361 return ref0.address() - ref1.address(); | 2365 return ref0.address() - ref1.address(); |
2362 } | 2366 } |
2363 | 2367 |
2364 | 2368 |
2365 void MacroAssembler::CallApiFunctionAndReturn( | 2369 void MacroAssembler::CallApiFunctionAndReturn( |
2366 Register function_address, | 2370 Register function_address, ExternalReference thunk_ref, int stack_space, |
2367 ExternalReference thunk_ref, | 2371 MemOperand* stack_space_operand, MemOperand return_value_operand, |
2368 int stack_space, | |
2369 MemOperand return_value_operand, | |
2370 MemOperand* context_restore_operand) { | 2372 MemOperand* context_restore_operand) { |
2371 ExternalReference next_address = | 2373 ExternalReference next_address = |
2372 ExternalReference::handle_scope_next_address(isolate()); | 2374 ExternalReference::handle_scope_next_address(isolate()); |
2373 const int kNextOffset = 0; | 2375 const int kNextOffset = 0; |
2374 const int kLimitOffset = AddressOffset( | 2376 const int kLimitOffset = AddressOffset( |
2375 ExternalReference::handle_scope_limit_address(isolate()), | 2377 ExternalReference::handle_scope_limit_address(isolate()), |
2376 next_address); | 2378 next_address); |
2377 const int kLevelOffset = AddressOffset( | 2379 const int kLevelOffset = AddressOffset( |
2378 ExternalReference::handle_scope_level_address(isolate()), | 2380 ExternalReference::handle_scope_level_address(isolate()), |
2379 next_address); | 2381 next_address); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 ldr(r5, MemOperand(ip)); | 2459 ldr(r5, MemOperand(ip)); |
2458 cmp(r4, r5); | 2460 cmp(r4, r5); |
2459 b(ne, &promote_scheduled_exception); | 2461 b(ne, &promote_scheduled_exception); |
2460 bind(&exception_handled); | 2462 bind(&exception_handled); |
2461 | 2463 |
2462 bool restore_context = context_restore_operand != NULL; | 2464 bool restore_context = context_restore_operand != NULL; |
2463 if (restore_context) { | 2465 if (restore_context) { |
2464 ldr(cp, *context_restore_operand); | 2466 ldr(cp, *context_restore_operand); |
2465 } | 2467 } |
2466 // LeaveExitFrame expects unwind space to be in a register. | 2468 // LeaveExitFrame expects unwind space to be in a register. |
2467 mov(r4, Operand(stack_space)); | 2469 if (stack_space_operand != NULL) { |
2468 LeaveExitFrame(false, r4, !restore_context); | 2470 ldr(r4, *stack_space_operand); |
| 2471 } else { |
| 2472 mov(r4, Operand(stack_space)); |
| 2473 } |
| 2474 LeaveExitFrame(false, r4, !restore_context, stack_space_operand != NULL); |
2469 mov(pc, lr); | 2475 mov(pc, lr); |
2470 | 2476 |
2471 bind(&promote_scheduled_exception); | 2477 bind(&promote_scheduled_exception); |
2472 { | 2478 { |
2473 FrameScope frame(this, StackFrame::INTERNAL); | 2479 FrameScope frame(this, StackFrame::INTERNAL); |
2474 CallExternalReference( | 2480 CallExternalReference( |
2475 ExternalReference(Runtime::kPromoteScheduledException, isolate()), | 2481 ExternalReference(Runtime::kPromoteScheduledException, isolate()), |
2476 0); | 2482 0); |
2477 } | 2483 } |
2478 jmp(&exception_handled); | 2484 jmp(&exception_handled); |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4086 } | 4092 } |
4087 } | 4093 } |
4088 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 4094 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
4089 add(result, result, Operand(dividend, LSR, 31)); | 4095 add(result, result, Operand(dividend, LSR, 31)); |
4090 } | 4096 } |
4091 | 4097 |
4092 } // namespace internal | 4098 } // namespace internal |
4093 } // namespace v8 | 4099 } // namespace v8 |
4094 | 4100 |
4095 #endif // V8_TARGET_ARCH_ARM | 4101 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |