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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1323 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 1323 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
1324 int handler_index) { | 1324 int handler_index) { |
1325 // Adjust this code if not the case. | 1325 // Adjust this code if not the case. |
1326 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 1326 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); |
1327 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); | 1327 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); |
1328 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 1328 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); |
1329 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 1329 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); |
1330 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 1330 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); |
1331 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | 1331 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); |
1332 | 1332 |
1333 // For the JSEntry handler, we must preserve r0-r4, r5-r7 are available. | 1333 // For the JSEntry handler, we must preserve r0-r4, r5-r6 are available. |
1334 // We will build up the handler from the bottom by pushing on the stack. | 1334 // We will build up the handler from the bottom by pushing on the stack. |
1335 // Set up the code object (r5) and the state (r6) for pushing. | 1335 // Set up the code object (r5) and the state (r6) for pushing. |
1336 unsigned state = | 1336 unsigned state = |
1337 StackHandler::IndexField::encode(handler_index) | | 1337 StackHandler::IndexField::encode(handler_index) | |
1338 StackHandler::KindField::encode(kind); | 1338 StackHandler::KindField::encode(kind); |
1339 mov(r5, Operand(CodeObject())); | 1339 mov(r5, Operand(CodeObject())); |
1340 mov(r6, Operand(state)); | 1340 mov(r6, Operand(state)); |
1341 | 1341 |
1342 // Push the frame pointer, context, state, and code object. | 1342 // Push the frame pointer, context, state, and code object. |
1343 if (kind == StackHandler::JS_ENTRY) { | 1343 if (kind == StackHandler::JS_ENTRY) { |
1344 mov(r7, Operand(Smi::FromInt(0))); // Indicates no context. | 1344 mov(cp, Operand(Smi::FromInt(0))); // Indicates no context. |
Rodolph Perfetta
2013/09/13 14:14:40
I don't know if this is related to your test flaky
ulan
2013/09/13 14:20:48
I also had this suspicion, but this case seems to
| |
1345 mov(ip, Operand::Zero()); // NULL frame pointer. | 1345 mov(ip, Operand::Zero()); // NULL frame pointer. |
1346 stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | ip.bit()); | 1346 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | ip.bit()); |
1347 } else { | 1347 } else { |
1348 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | fp.bit()); | 1348 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | fp.bit()); |
1349 } | 1349 } |
1350 | 1350 |
1351 // Link the current handler as the next handler. | 1351 // Link the current handler as the next handler. |
1352 mov(r6, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | 1352 mov(r6, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
1353 ldr(r5, MemOperand(r6)); | 1353 ldr(r5, MemOperand(r6)); |
1354 push(r5); | 1354 push(r5); |
1355 // Set this new handler as the current one. | 1355 // Set this new handler as the current one. |
1356 str(sp, MemOperand(r6)); | 1356 str(sp, MemOperand(r6)); |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2289 ExternalReference next_address = | 2289 ExternalReference next_address = |
2290 ExternalReference::handle_scope_next_address(isolate()); | 2290 ExternalReference::handle_scope_next_address(isolate()); |
2291 const int kNextOffset = 0; | 2291 const int kNextOffset = 0; |
2292 const int kLimitOffset = AddressOffset( | 2292 const int kLimitOffset = AddressOffset( |
2293 ExternalReference::handle_scope_limit_address(isolate()), | 2293 ExternalReference::handle_scope_limit_address(isolate()), |
2294 next_address); | 2294 next_address); |
2295 const int kLevelOffset = AddressOffset( | 2295 const int kLevelOffset = AddressOffset( |
2296 ExternalReference::handle_scope_level_address(isolate()), | 2296 ExternalReference::handle_scope_level_address(isolate()), |
2297 next_address); | 2297 next_address); |
2298 | 2298 |
2299 ASSERT(!thunk_last_arg.is(r3)); | |
2300 | |
2299 // Allocate HandleScope in callee-save registers. | 2301 // Allocate HandleScope in callee-save registers. |
2300 mov(r7, Operand(next_address)); | 2302 mov(r9, Operand(next_address)); |
2301 ldr(r4, MemOperand(r7, kNextOffset)); | 2303 ldr(r4, MemOperand(r9, kNextOffset)); |
2302 ldr(r5, MemOperand(r7, kLimitOffset)); | 2304 ldr(r5, MemOperand(r9, kLimitOffset)); |
2303 ldr(r6, MemOperand(r7, kLevelOffset)); | 2305 ldr(r6, MemOperand(r9, kLevelOffset)); |
2304 add(r6, r6, Operand(1)); | 2306 add(r6, r6, Operand(1)); |
2305 str(r6, MemOperand(r7, kLevelOffset)); | 2307 str(r6, MemOperand(r9, kLevelOffset)); |
2306 | 2308 |
2307 if (FLAG_log_timer_events) { | 2309 if (FLAG_log_timer_events) { |
2308 FrameScope frame(this, StackFrame::MANUAL); | 2310 FrameScope frame(this, StackFrame::MANUAL); |
2309 PushSafepointRegisters(); | 2311 PushSafepointRegisters(); |
2310 PrepareCallCFunction(1, r0); | 2312 PrepareCallCFunction(1, r0); |
2311 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2313 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2312 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); | 2314 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); |
2313 PopSafepointRegisters(); | 2315 PopSafepointRegisters(); |
2314 } | 2316 } |
2315 | 2317 |
2316 ASSERT(!thunk_last_arg.is(r3)); | |
2317 Label profiler_disabled; | 2318 Label profiler_disabled; |
2318 Label end_profiler_check; | 2319 Label end_profiler_check; |
2319 bool* is_profiling_flag = | 2320 bool* is_profiling_flag = |
2320 isolate()->cpu_profiler()->is_profiling_address(); | 2321 isolate()->cpu_profiler()->is_profiling_address(); |
2321 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); | 2322 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); |
2322 mov(r3, Operand(reinterpret_cast<int32_t>(is_profiling_flag))); | 2323 mov(r3, Operand(reinterpret_cast<int32_t>(is_profiling_flag))); |
2323 ldrb(r3, MemOperand(r3, 0)); | 2324 ldrb(r3, MemOperand(r3, 0)); |
2324 cmp(r3, Operand(0)); | 2325 cmp(r3, Operand(0)); |
2325 b(eq, &profiler_disabled); | 2326 b(eq, &profiler_disabled); |
2326 | 2327 |
(...skipping 24 matching lines...) Expand all Loading... | |
2351 Label promote_scheduled_exception; | 2352 Label promote_scheduled_exception; |
2352 Label delete_allocated_handles; | 2353 Label delete_allocated_handles; |
2353 Label leave_exit_frame; | 2354 Label leave_exit_frame; |
2354 Label return_value_loaded; | 2355 Label return_value_loaded; |
2355 | 2356 |
2356 // load value from ReturnValue | 2357 // load value from ReturnValue |
2357 ldr(r0, MemOperand(fp, return_value_offset*kPointerSize)); | 2358 ldr(r0, MemOperand(fp, return_value_offset*kPointerSize)); |
2358 bind(&return_value_loaded); | 2359 bind(&return_value_loaded); |
2359 // No more valid handles (the result handle was the last one). Restore | 2360 // No more valid handles (the result handle was the last one). Restore |
2360 // previous handle scope. | 2361 // previous handle scope. |
2361 str(r4, MemOperand(r7, kNextOffset)); | 2362 str(r4, MemOperand(r9, kNextOffset)); |
2362 if (emit_debug_code()) { | 2363 if (emit_debug_code()) { |
2363 ldr(r1, MemOperand(r7, kLevelOffset)); | 2364 ldr(r1, MemOperand(r9, kLevelOffset)); |
2364 cmp(r1, r6); | 2365 cmp(r1, r6); |
2365 Check(eq, kUnexpectedLevelAfterReturnFromApiCall); | 2366 Check(eq, kUnexpectedLevelAfterReturnFromApiCall); |
2366 } | 2367 } |
2367 sub(r6, r6, Operand(1)); | 2368 sub(r6, r6, Operand(1)); |
2368 str(r6, MemOperand(r7, kLevelOffset)); | 2369 str(r6, MemOperand(r9, kLevelOffset)); |
2369 ldr(ip, MemOperand(r7, kLimitOffset)); | 2370 ldr(ip, MemOperand(r9, kLimitOffset)); |
2370 cmp(r5, ip); | 2371 cmp(r5, ip); |
2371 b(ne, &delete_allocated_handles); | 2372 b(ne, &delete_allocated_handles); |
2372 | 2373 |
2373 // Check if the function scheduled an exception. | 2374 // Check if the function scheduled an exception. |
2374 bind(&leave_exit_frame); | 2375 bind(&leave_exit_frame); |
2375 LoadRoot(r4, Heap::kTheHoleValueRootIndex); | 2376 LoadRoot(r4, Heap::kTheHoleValueRootIndex); |
2376 mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate()))); | 2377 mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate()))); |
2377 ldr(r5, MemOperand(ip)); | 2378 ldr(r5, MemOperand(ip)); |
2378 cmp(r4, r5); | 2379 cmp(r4, r5); |
2379 b(ne, &promote_scheduled_exception); | 2380 b(ne, &promote_scheduled_exception); |
2380 | 2381 |
2381 // LeaveExitFrame expects unwind space to be in a register. | 2382 // LeaveExitFrame expects unwind space to be in a register. |
2382 mov(r4, Operand(stack_space)); | 2383 mov(r4, Operand(stack_space)); |
2383 LeaveExitFrame(false, r4); | 2384 LeaveExitFrame(false, r4); |
2384 mov(pc, lr); | 2385 mov(pc, lr); |
2385 | 2386 |
2386 bind(&promote_scheduled_exception); | 2387 bind(&promote_scheduled_exception); |
2387 TailCallExternalReference( | 2388 TailCallExternalReference( |
2388 ExternalReference(Runtime::kPromoteScheduledException, isolate()), | 2389 ExternalReference(Runtime::kPromoteScheduledException, isolate()), |
2389 0, | 2390 0, |
2390 1); | 2391 1); |
2391 | 2392 |
2392 // HandleScope limit has changed. Delete allocated extensions. | 2393 // HandleScope limit has changed. Delete allocated extensions. |
2393 bind(&delete_allocated_handles); | 2394 bind(&delete_allocated_handles); |
2394 str(r5, MemOperand(r7, kLimitOffset)); | 2395 str(r5, MemOperand(r9, kLimitOffset)); |
2395 mov(r4, r0); | 2396 mov(r4, r0); |
2396 PrepareCallCFunction(1, r5); | 2397 PrepareCallCFunction(1, r5); |
2397 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2398 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2398 CallCFunction( | 2399 CallCFunction( |
2399 ExternalReference::delete_handle_scope_extensions(isolate()), 1); | 2400 ExternalReference::delete_handle_scope_extensions(isolate()), 1); |
2400 mov(r0, r4); | 2401 mov(r0, r4); |
2401 jmp(&leave_exit_frame); | 2402 jmp(&leave_exit_frame); |
2402 } | 2403 } |
2403 | 2404 |
2404 | 2405 |
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3884 void CodePatcher::EmitCondition(Condition cond) { | 3885 void CodePatcher::EmitCondition(Condition cond) { |
3885 Instr instr = Assembler::instr_at(masm_.pc_); | 3886 Instr instr = Assembler::instr_at(masm_.pc_); |
3886 instr = (instr & ~kCondMask) | cond; | 3887 instr = (instr & ~kCondMask) | cond; |
3887 masm_.emit(instr); | 3888 masm_.emit(instr); |
3888 } | 3889 } |
3889 | 3890 |
3890 | 3891 |
3891 } } // namespace v8::internal | 3892 } } // namespace v8::internal |
3892 | 3893 |
3893 #endif // V8_TARGET_ARCH_ARM | 3894 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |