| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 // If we are using the simulator then we should always align to the expected | 1013 // If we are using the simulator then we should always align to the expected |
| 1014 // alignment. As the simulator is used to generate snapshots we do not know | 1014 // alignment. As the simulator is used to generate snapshots we do not know |
| 1015 // if the target platform will need alignment, so this is controlled from a | 1015 // if the target platform will need alignment, so this is controlled from a |
| 1016 // flag. | 1016 // flag. |
| 1017 return FLAG_sim_stack_alignment; | 1017 return FLAG_sim_stack_alignment; |
| 1018 #endif // V8_HOST_ARCH_ARM | 1018 #endif // V8_HOST_ARCH_ARM |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 | 1021 |
| 1022 void MacroAssembler::LeaveExitFrame(bool save_doubles, | 1022 void MacroAssembler::LeaveExitFrame(bool save_doubles, |
| 1023 Register argument_count, | 1023 Register argument_count) { |
| 1024 bool restore_context) { | |
| 1025 // Optionally restore all double registers. | 1024 // Optionally restore all double registers. |
| 1026 if (save_doubles) { | 1025 if (save_doubles) { |
| 1027 // Calculate the stack location of the saved doubles and restore them. | 1026 // Calculate the stack location of the saved doubles and restore them. |
| 1028 const int offset = 2 * kPointerSize; | 1027 const int offset = 2 * kPointerSize; |
| 1029 sub(r3, fp, | 1028 sub(r3, fp, |
| 1030 Operand(offset + DwVfpRegister::kMaxNumRegisters * kDoubleSize)); | 1029 Operand(offset + DwVfpRegister::kMaxNumRegisters * kDoubleSize)); |
| 1031 RestoreFPRegs(r3, ip); | 1030 RestoreFPRegs(r3, ip); |
| 1032 } | 1031 } |
| 1033 | 1032 |
| 1034 // Clear top frame. | 1033 // Clear top frame. |
| 1035 mov(r3, Operand::Zero()); | 1034 mov(r3, Operand::Zero()); |
| 1036 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 1035 mov(ip, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
| 1037 str(r3, MemOperand(ip)); | 1036 str(r3, MemOperand(ip)); |
| 1038 | 1037 |
| 1039 | |
| 1040 // Restore current context from top and clear it in debug mode. | 1038 // Restore current context from top and clear it in debug mode. |
| 1041 if (restore_context) { | 1039 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); |
| 1042 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | 1040 ldr(cp, MemOperand(ip)); |
| 1043 ldr(cp, MemOperand(ip)); | |
| 1044 } | |
| 1045 #ifdef DEBUG | 1041 #ifdef DEBUG |
| 1046 mov(ip, Operand(ExternalReference(Isolate::kContextAddress, isolate()))); | |
| 1047 str(r3, MemOperand(ip)); | 1042 str(r3, MemOperand(ip)); |
| 1048 #endif | 1043 #endif |
| 1049 | 1044 |
| 1050 // Tear down the exit frame, pop the arguments, and return. | 1045 // Tear down the exit frame, pop the arguments, and return. |
| 1051 mov(sp, Operand(fp)); | 1046 mov(sp, Operand(fp)); |
| 1052 ldm(ia_w, sp, fp.bit() | lr.bit()); | 1047 ldm(ia_w, sp, fp.bit() | lr.bit()); |
| 1053 if (argument_count.is_valid()) { | 1048 if (argument_count.is_valid()) { |
| 1054 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); | 1049 add(sp, sp, Operand(argument_count, LSL, kPointerSizeLog2)); |
| 1055 } | 1050 } |
| 1056 } | 1051 } |
| (...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 stub->CompilingCallsToThisStubIsGCSafe(isolate())); | 2273 stub->CompilingCallsToThisStubIsGCSafe(isolate())); |
| 2279 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); | 2274 Jump(stub->GetCode(isolate()), RelocInfo::CODE_TARGET, cond); |
| 2280 } | 2275 } |
| 2281 | 2276 |
| 2282 | 2277 |
| 2283 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { | 2278 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { |
| 2284 return ref0.address() - ref1.address(); | 2279 return ref0.address() - ref1.address(); |
| 2285 } | 2280 } |
| 2286 | 2281 |
| 2287 | 2282 |
| 2288 void MacroAssembler::CallApiFunctionAndReturn( | 2283 void MacroAssembler::CallApiFunctionAndReturn(ExternalReference function, |
| 2289 ExternalReference function, | 2284 Address function_address, |
| 2290 Address function_address, | 2285 ExternalReference thunk_ref, |
| 2291 ExternalReference thunk_ref, | 2286 Register thunk_last_arg, |
| 2292 Register thunk_last_arg, | 2287 int stack_space, |
| 2293 int stack_space, | 2288 int return_value_offset) { |
| 2294 MemOperand return_value_operand, | |
| 2295 MemOperand* context_restore_operand) { | |
| 2296 ExternalReference next_address = | 2289 ExternalReference next_address = |
| 2297 ExternalReference::handle_scope_next_address(isolate()); | 2290 ExternalReference::handle_scope_next_address(isolate()); |
| 2298 const int kNextOffset = 0; | 2291 const int kNextOffset = 0; |
| 2299 const int kLimitOffset = AddressOffset( | 2292 const int kLimitOffset = AddressOffset( |
| 2300 ExternalReference::handle_scope_limit_address(isolate()), | 2293 ExternalReference::handle_scope_limit_address(isolate()), |
| 2301 next_address); | 2294 next_address); |
| 2302 const int kLevelOffset = AddressOffset( | 2295 const int kLevelOffset = AddressOffset( |
| 2303 ExternalReference::handle_scope_level_address(isolate()), | 2296 ExternalReference::handle_scope_level_address(isolate()), |
| 2304 next_address); | 2297 next_address); |
| 2305 | 2298 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2349 if (FLAG_log_timer_events) { | 2342 if (FLAG_log_timer_events) { |
| 2350 FrameScope frame(this, StackFrame::MANUAL); | 2343 FrameScope frame(this, StackFrame::MANUAL); |
| 2351 PushSafepointRegisters(); | 2344 PushSafepointRegisters(); |
| 2352 PrepareCallCFunction(1, r0); | 2345 PrepareCallCFunction(1, r0); |
| 2353 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2346 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
| 2354 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); | 2347 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); |
| 2355 PopSafepointRegisters(); | 2348 PopSafepointRegisters(); |
| 2356 } | 2349 } |
| 2357 | 2350 |
| 2358 Label promote_scheduled_exception; | 2351 Label promote_scheduled_exception; |
| 2359 Label exception_handled; | |
| 2360 Label delete_allocated_handles; | 2352 Label delete_allocated_handles; |
| 2361 Label leave_exit_frame; | 2353 Label leave_exit_frame; |
| 2362 Label return_value_loaded; | 2354 Label return_value_loaded; |
| 2363 | 2355 |
| 2364 // load value from ReturnValue | 2356 // load value from ReturnValue |
| 2365 ldr(r0, return_value_operand); | 2357 ldr(r0, MemOperand(fp, return_value_offset*kPointerSize)); |
| 2366 bind(&return_value_loaded); | 2358 bind(&return_value_loaded); |
| 2367 // No more valid handles (the result handle was the last one). Restore | 2359 // No more valid handles (the result handle was the last one). Restore |
| 2368 // previous handle scope. | 2360 // previous handle scope. |
| 2369 str(r4, MemOperand(r7, kNextOffset)); | 2361 str(r4, MemOperand(r7, kNextOffset)); |
| 2370 if (emit_debug_code()) { | 2362 if (emit_debug_code()) { |
| 2371 ldr(r1, MemOperand(r7, kLevelOffset)); | 2363 ldr(r1, MemOperand(r7, kLevelOffset)); |
| 2372 cmp(r1, r6); | 2364 cmp(r1, r6); |
| 2373 Check(eq, kUnexpectedLevelAfterReturnFromApiCall); | 2365 Check(eq, kUnexpectedLevelAfterReturnFromApiCall); |
| 2374 } | 2366 } |
| 2375 sub(r6, r6, Operand(1)); | 2367 sub(r6, r6, Operand(1)); |
| 2376 str(r6, MemOperand(r7, kLevelOffset)); | 2368 str(r6, MemOperand(r7, kLevelOffset)); |
| 2377 ldr(ip, MemOperand(r7, kLimitOffset)); | 2369 ldr(ip, MemOperand(r7, kLimitOffset)); |
| 2378 cmp(r5, ip); | 2370 cmp(r5, ip); |
| 2379 b(ne, &delete_allocated_handles); | 2371 b(ne, &delete_allocated_handles); |
| 2380 | 2372 |
| 2381 // Check if the function scheduled an exception. | 2373 // Check if the function scheduled an exception. |
| 2382 bind(&leave_exit_frame); | 2374 bind(&leave_exit_frame); |
| 2383 LoadRoot(r4, Heap::kTheHoleValueRootIndex); | 2375 LoadRoot(r4, Heap::kTheHoleValueRootIndex); |
| 2384 mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate()))); | 2376 mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate()))); |
| 2385 ldr(r5, MemOperand(ip)); | 2377 ldr(r5, MemOperand(ip)); |
| 2386 cmp(r4, r5); | 2378 cmp(r4, r5); |
| 2387 b(ne, &promote_scheduled_exception); | 2379 b(ne, &promote_scheduled_exception); |
| 2388 bind(&exception_handled); | |
| 2389 | 2380 |
| 2390 bool restore_context = context_restore_operand != NULL; | |
| 2391 if (restore_context) { | |
| 2392 ldr(cp, *context_restore_operand); | |
| 2393 } | |
| 2394 // LeaveExitFrame expects unwind space to be in a register. | 2381 // LeaveExitFrame expects unwind space to be in a register. |
| 2395 mov(r4, Operand(stack_space)); | 2382 mov(r4, Operand(stack_space)); |
| 2396 LeaveExitFrame(false, r4, !restore_context); | 2383 LeaveExitFrame(false, r4); |
| 2397 mov(pc, lr); | 2384 mov(pc, lr); |
| 2398 | 2385 |
| 2399 bind(&promote_scheduled_exception); | 2386 bind(&promote_scheduled_exception); |
| 2400 CallExternalReference( | 2387 TailCallExternalReference( |
| 2401 ExternalReference(Runtime::kPromoteScheduledException, isolate()), | 2388 ExternalReference(Runtime::kPromoteScheduledException, isolate()), |
| 2402 0); | 2389 0, |
| 2403 jmp(&exception_handled); | 2390 1); |
| 2404 | 2391 |
| 2405 // HandleScope limit has changed. Delete allocated extensions. | 2392 // HandleScope limit has changed. Delete allocated extensions. |
| 2406 bind(&delete_allocated_handles); | 2393 bind(&delete_allocated_handles); |
| 2407 str(r5, MemOperand(r7, kLimitOffset)); | 2394 str(r5, MemOperand(r7, kLimitOffset)); |
| 2408 mov(r4, r0); | 2395 mov(r4, r0); |
| 2409 PrepareCallCFunction(1, r5); | 2396 PrepareCallCFunction(1, r5); |
| 2410 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2397 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
| 2411 CallCFunction( | 2398 CallCFunction( |
| 2412 ExternalReference::delete_handle_scope_extensions(isolate()), 1); | 2399 ExternalReference::delete_handle_scope_extensions(isolate()), 1); |
| 2413 mov(r0, r4); | 2400 mov(r0, r4); |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3897 void CodePatcher::EmitCondition(Condition cond) { | 3884 void CodePatcher::EmitCondition(Condition cond) { |
| 3898 Instr instr = Assembler::instr_at(masm_.pc_); | 3885 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3899 instr = (instr & ~kCondMask) | cond; | 3886 instr = (instr & ~kCondMask) | cond; |
| 3900 masm_.emit(instr); | 3887 masm_.emit(instr); |
| 3901 } | 3888 } |
| 3902 | 3889 |
| 3903 | 3890 |
| 3904 } } // namespace v8::internal | 3891 } } // namespace v8::internal |
| 3905 | 3892 |
| 3906 #endif // V8_TARGET_ARCH_ARM | 3893 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |