| 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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 1330 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
| 1331 int handler_index) { | 1331 int handler_index) { |
| 1332 // Adjust this code if not the case. | 1332 // Adjust this code if not the case. |
| 1333 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 1333 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); |
| 1334 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); | 1334 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); |
| 1335 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 1335 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); |
| 1336 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 1336 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); |
| 1337 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 1337 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); |
| 1338 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | 1338 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); |
| 1339 | 1339 |
| 1340 // For the JSEntry handler, we must preserve r0-r4, r5-r7 are available. | 1340 // For the JSEntry handler, we must preserve r0-r4, r5-r6 are available. |
| 1341 // We will build up the handler from the bottom by pushing on the stack. | 1341 // We will build up the handler from the bottom by pushing on the stack. |
| 1342 // Set up the code object (r5) and the state (r6) for pushing. | 1342 // Set up the code object (r5) and the state (r6) for pushing. |
| 1343 unsigned state = | 1343 unsigned state = |
| 1344 StackHandler::IndexField::encode(handler_index) | | 1344 StackHandler::IndexField::encode(handler_index) | |
| 1345 StackHandler::KindField::encode(kind); | 1345 StackHandler::KindField::encode(kind); |
| 1346 mov(r5, Operand(CodeObject())); | 1346 mov(r5, Operand(CodeObject())); |
| 1347 mov(r6, Operand(state)); | 1347 mov(r6, Operand(state)); |
| 1348 | 1348 |
| 1349 // Push the frame pointer, context, state, and code object. | 1349 // Push the frame pointer, context, state, and code object. |
| 1350 if (kind == StackHandler::JS_ENTRY) { | 1350 if (kind == StackHandler::JS_ENTRY) { |
| 1351 mov(r7, Operand(Smi::FromInt(0))); // Indicates no context. | 1351 mov(cp, Operand(Smi::FromInt(0))); // Indicates no context. |
| 1352 mov(ip, Operand::Zero()); // NULL frame pointer. | 1352 mov(ip, Operand::Zero()); // NULL frame pointer. |
| 1353 stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | ip.bit()); | 1353 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | ip.bit()); |
| 1354 } else { | 1354 } else { |
| 1355 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | fp.bit()); | 1355 stm(db_w, sp, r5.bit() | r6.bit() | cp.bit() | fp.bit()); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 // Link the current handler as the next handler. | 1358 // Link the current handler as the next handler. |
| 1359 mov(r6, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | 1359 mov(r6, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
| 1360 ldr(r5, MemOperand(r6)); | 1360 ldr(r5, MemOperand(r6)); |
| 1361 push(r5); | 1361 push(r5); |
| 1362 // Set this new handler as the current one. | 1362 // Set this new handler as the current one. |
| 1363 str(sp, MemOperand(r6)); | 1363 str(sp, MemOperand(r6)); |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2298 ExternalReference next_address = | 2298 ExternalReference next_address = |
| 2299 ExternalReference::handle_scope_next_address(isolate()); | 2299 ExternalReference::handle_scope_next_address(isolate()); |
| 2300 const int kNextOffset = 0; | 2300 const int kNextOffset = 0; |
| 2301 const int kLimitOffset = AddressOffset( | 2301 const int kLimitOffset = AddressOffset( |
| 2302 ExternalReference::handle_scope_limit_address(isolate()), | 2302 ExternalReference::handle_scope_limit_address(isolate()), |
| 2303 next_address); | 2303 next_address); |
| 2304 const int kLevelOffset = AddressOffset( | 2304 const int kLevelOffset = AddressOffset( |
| 2305 ExternalReference::handle_scope_level_address(isolate()), | 2305 ExternalReference::handle_scope_level_address(isolate()), |
| 2306 next_address); | 2306 next_address); |
| 2307 | 2307 |
| 2308 ASSERT(!thunk_last_arg.is(r3)); |
| 2309 |
| 2308 // Allocate HandleScope in callee-save registers. | 2310 // Allocate HandleScope in callee-save registers. |
| 2309 mov(r7, Operand(next_address)); | 2311 mov(r9, Operand(next_address)); |
| 2310 ldr(r4, MemOperand(r7, kNextOffset)); | 2312 ldr(r4, MemOperand(r9, kNextOffset)); |
| 2311 ldr(r5, MemOperand(r7, kLimitOffset)); | 2313 ldr(r5, MemOperand(r9, kLimitOffset)); |
| 2312 ldr(r6, MemOperand(r7, kLevelOffset)); | 2314 ldr(r6, MemOperand(r9, kLevelOffset)); |
| 2313 add(r6, r6, Operand(1)); | 2315 add(r6, r6, Operand(1)); |
| 2314 str(r6, MemOperand(r7, kLevelOffset)); | 2316 str(r6, MemOperand(r9, kLevelOffset)); |
| 2315 | 2317 |
| 2316 if (FLAG_log_timer_events) { | 2318 if (FLAG_log_timer_events) { |
| 2317 FrameScope frame(this, StackFrame::MANUAL); | 2319 FrameScope frame(this, StackFrame::MANUAL); |
| 2318 PushSafepointRegisters(); | 2320 PushSafepointRegisters(); |
| 2319 PrepareCallCFunction(1, r0); | 2321 PrepareCallCFunction(1, r0); |
| 2320 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2322 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
| 2321 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); | 2323 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); |
| 2322 PopSafepointRegisters(); | 2324 PopSafepointRegisters(); |
| 2323 } | 2325 } |
| 2324 | 2326 |
| 2325 ASSERT(!thunk_last_arg.is(r3)); | |
| 2326 Label profiler_disabled; | 2327 Label profiler_disabled; |
| 2327 Label end_profiler_check; | 2328 Label end_profiler_check; |
| 2328 bool* is_profiling_flag = | 2329 bool* is_profiling_flag = |
| 2329 isolate()->cpu_profiler()->is_profiling_address(); | 2330 isolate()->cpu_profiler()->is_profiling_address(); |
| 2330 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); | 2331 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); |
| 2331 mov(r3, Operand(reinterpret_cast<int32_t>(is_profiling_flag))); | 2332 mov(r3, Operand(reinterpret_cast<int32_t>(is_profiling_flag))); |
| 2332 ldrb(r3, MemOperand(r3, 0)); | 2333 ldrb(r3, MemOperand(r3, 0)); |
| 2333 cmp(r3, Operand(0)); | 2334 cmp(r3, Operand(0)); |
| 2334 b(eq, &profiler_disabled); | 2335 b(eq, &profiler_disabled); |
| 2335 | 2336 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2361 Label exception_handled; | 2362 Label exception_handled; |
| 2362 Label delete_allocated_handles; | 2363 Label delete_allocated_handles; |
| 2363 Label leave_exit_frame; | 2364 Label leave_exit_frame; |
| 2364 Label return_value_loaded; | 2365 Label return_value_loaded; |
| 2365 | 2366 |
| 2366 // load value from ReturnValue | 2367 // load value from ReturnValue |
| 2367 ldr(r0, return_value_operand); | 2368 ldr(r0, return_value_operand); |
| 2368 bind(&return_value_loaded); | 2369 bind(&return_value_loaded); |
| 2369 // No more valid handles (the result handle was the last one). Restore | 2370 // No more valid handles (the result handle was the last one). Restore |
| 2370 // previous handle scope. | 2371 // previous handle scope. |
| 2371 str(r4, MemOperand(r7, kNextOffset)); | 2372 str(r4, MemOperand(r9, kNextOffset)); |
| 2372 if (emit_debug_code()) { | 2373 if (emit_debug_code()) { |
| 2373 ldr(r1, MemOperand(r7, kLevelOffset)); | 2374 ldr(r1, MemOperand(r9, kLevelOffset)); |
| 2374 cmp(r1, r6); | 2375 cmp(r1, r6); |
| 2375 Check(eq, kUnexpectedLevelAfterReturnFromApiCall); | 2376 Check(eq, kUnexpectedLevelAfterReturnFromApiCall); |
| 2376 } | 2377 } |
| 2377 sub(r6, r6, Operand(1)); | 2378 sub(r6, r6, Operand(1)); |
| 2378 str(r6, MemOperand(r7, kLevelOffset)); | 2379 str(r6, MemOperand(r9, kLevelOffset)); |
| 2379 ldr(ip, MemOperand(r7, kLimitOffset)); | 2380 ldr(ip, MemOperand(r9, kLimitOffset)); |
| 2380 cmp(r5, ip); | 2381 cmp(r5, ip); |
| 2381 b(ne, &delete_allocated_handles); | 2382 b(ne, &delete_allocated_handles); |
| 2382 | 2383 |
| 2383 // Check if the function scheduled an exception. | 2384 // Check if the function scheduled an exception. |
| 2384 bind(&leave_exit_frame); | 2385 bind(&leave_exit_frame); |
| 2385 LoadRoot(r4, Heap::kTheHoleValueRootIndex); | 2386 LoadRoot(r4, Heap::kTheHoleValueRootIndex); |
| 2386 mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate()))); | 2387 mov(ip, Operand(ExternalReference::scheduled_exception_address(isolate()))); |
| 2387 ldr(r5, MemOperand(ip)); | 2388 ldr(r5, MemOperand(ip)); |
| 2388 cmp(r4, r5); | 2389 cmp(r4, r5); |
| 2389 b(ne, &promote_scheduled_exception); | 2390 b(ne, &promote_scheduled_exception); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2402 { | 2403 { |
| 2403 FrameScope frame(this, StackFrame::INTERNAL); | 2404 FrameScope frame(this, StackFrame::INTERNAL); |
| 2404 CallExternalReference( | 2405 CallExternalReference( |
| 2405 ExternalReference(Runtime::kPromoteScheduledException, isolate()), | 2406 ExternalReference(Runtime::kPromoteScheduledException, isolate()), |
| 2406 0); | 2407 0); |
| 2407 } | 2408 } |
| 2408 jmp(&exception_handled); | 2409 jmp(&exception_handled); |
| 2409 | 2410 |
| 2410 // HandleScope limit has changed. Delete allocated extensions. | 2411 // HandleScope limit has changed. Delete allocated extensions. |
| 2411 bind(&delete_allocated_handles); | 2412 bind(&delete_allocated_handles); |
| 2412 str(r5, MemOperand(r7, kLimitOffset)); | 2413 str(r5, MemOperand(r9, kLimitOffset)); |
| 2413 mov(r4, r0); | 2414 mov(r4, r0); |
| 2414 PrepareCallCFunction(1, r5); | 2415 PrepareCallCFunction(1, r5); |
| 2415 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2416 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
| 2416 CallCFunction( | 2417 CallCFunction( |
| 2417 ExternalReference::delete_handle_scope_extensions(isolate()), 1); | 2418 ExternalReference::delete_handle_scope_extensions(isolate()), 1); |
| 2418 mov(r0, r4); | 2419 mov(r0, r4); |
| 2419 jmp(&leave_exit_frame); | 2420 jmp(&leave_exit_frame); |
| 2420 } | 2421 } |
| 2421 | 2422 |
| 2422 | 2423 |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3983 void CodePatcher::EmitCondition(Condition cond) { | 3984 void CodePatcher::EmitCondition(Condition cond) { |
| 3984 Instr instr = Assembler::instr_at(masm_.pc_); | 3985 Instr instr = Assembler::instr_at(masm_.pc_); |
| 3985 instr = (instr & ~kCondMask) | cond; | 3986 instr = (instr & ~kCondMask) | cond; |
| 3986 masm_.emit(instr); | 3987 masm_.emit(instr); |
| 3987 } | 3988 } |
| 3988 | 3989 |
| 3989 | 3990 |
| 3990 } } // namespace v8::internal | 3991 } } // namespace v8::internal |
| 3991 | 3992 |
| 3992 #endif // V8_TARGET_ARCH_ARM | 3993 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |