OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 void BreakLocationIterator::SetDebugBreak() { | 278 void BreakLocationIterator::SetDebugBreak() { |
279 // If there is already a break point here just return. This might happen if | 279 // If there is already a break point here just return. This might happen if |
280 // the same code is flooded with break points twice. Flooding the same | 280 // the same code is flooded with break points twice. Flooding the same |
281 // function twice might happen when stepping in a function with an exception | 281 // function twice might happen when stepping in a function with an exception |
282 // handler as the handler and the function is the same. | 282 // handler as the handler and the function is the same. |
283 if (IsDebugBreak()) { | 283 if (IsDebugBreak()) { |
284 return; | 284 return; |
285 } | 285 } |
286 | 286 |
287 if (RelocInfo::IsJSReturn(rmode())) { | 287 if (RelocInfo::IsJSReturn(rmode())) { |
288 // This path is currently only used on IA32 as JSExitFrame on ARM uses a | 288 // Patch the frame exit code with a break point. |
289 // stub. | 289 SetDebugBreakAtReturn(); |
290 // Patch the JS frame exit code with a debug break call. See | |
291 // VisitReturnStatement and ExitJSFrame in codegen-ia32.cc for the | |
292 // precise return instructions sequence. | |
293 ASSERT(Debug::kIa32JSReturnSequenceLength >= | |
294 Debug::kIa32CallInstructionLength); | |
295 rinfo()->patch_code_with_call(Debug::debug_break_return_entry()->entry(), | |
296 Debug::kIa32JSReturnSequenceLength - Debug::kIa32CallInstructionLength); | |
297 } else { | 290 } else { |
298 // Patch the original code with the current address as the current address | 291 // Patch the original code with the current address as the current address |
299 // might have changed by the inline caching since the code was copied. | 292 // might have changed by the inline caching since the code was copied. |
300 original_rinfo()->set_target_address(rinfo()->target_address()); | 293 original_rinfo()->set_target_address(rinfo()->target_address()); |
301 | 294 |
302 // Patch the code to invoke the builtin debug break function matching the | 295 // Patch the code to invoke the builtin debug break function matching the |
303 // calling convention used by the call site. | 296 // calling convention used by the call site. |
304 Handle<Code> dbgbrk_code(Debug::FindDebugBreak(rinfo())); | 297 Handle<Code> dbgbrk_code(Debug::FindDebugBreak(rinfo())); |
305 rinfo()->set_target_address(dbgbrk_code->entry()); | 298 rinfo()->set_target_address(dbgbrk_code->entry()); |
306 } | 299 } |
307 ASSERT(IsDebugBreak()); | 300 ASSERT(IsDebugBreak()); |
308 } | 301 } |
309 | 302 |
310 | 303 |
311 void BreakLocationIterator::ClearDebugBreak() { | 304 void BreakLocationIterator::ClearDebugBreak() { |
312 if (RelocInfo::IsJSReturn(rmode())) { | 305 if (RelocInfo::IsJSReturn(rmode())) { |
313 // Restore the JS frame exit code. | 306 // Restore the frame exit code. |
314 rinfo()->patch_code(original_rinfo()->pc(), | 307 ClearDebugBreakAtReturn(); |
315 Debug::kIa32JSReturnSequenceLength); | |
316 } else { | 308 } else { |
317 // Patch the code to the original invoke. | 309 // Patch the code to the original invoke. |
318 rinfo()->set_target_address(original_rinfo()->target_address()); | 310 rinfo()->set_target_address(original_rinfo()->target_address()); |
319 } | 311 } |
320 ASSERT(!IsDebugBreak()); | 312 ASSERT(!IsDebugBreak()); |
321 } | 313 } |
322 | 314 |
323 | 315 |
324 void BreakLocationIterator::PrepareStepIn() { | 316 void BreakLocationIterator::PrepareStepIn() { |
325 // Step in can only be prepared if currently positioned on an IC call or | 317 // Step in can only be prepared if currently positioned on an IC call or |
(...skipping 26 matching lines...) Expand all Loading... |
352 | 344 |
353 | 345 |
354 bool BreakLocationIterator::HasBreakPoint() { | 346 bool BreakLocationIterator::HasBreakPoint() { |
355 return debug_info_->HasBreakPoint(code_position()); | 347 return debug_info_->HasBreakPoint(code_position()); |
356 } | 348 } |
357 | 349 |
358 | 350 |
359 // Check whether there is a debug break at the current position. | 351 // Check whether there is a debug break at the current position. |
360 bool BreakLocationIterator::IsDebugBreak() { | 352 bool BreakLocationIterator::IsDebugBreak() { |
361 if (RelocInfo::IsJSReturn(rmode())) { | 353 if (RelocInfo::IsJSReturn(rmode())) { |
362 // This is IA32 specific but works as long as the ARM version | 354 return IsDebugBreakAtReturn(); |
363 // still uses a stub for JSExitFrame. | |
364 // | |
365 // TODO(1240753): Make the test architecture independent or split | |
366 // parts of the debugger into architecture dependent files. | |
367 return (*(rinfo()->pc()) == 0xE8); | |
368 } else { | 355 } else { |
369 return Debug::IsDebugBreak(rinfo()->target_address()); | 356 return Debug::IsDebugBreak(rinfo()->target_address()); |
370 } | 357 } |
371 } | 358 } |
372 | 359 |
373 | 360 |
374 Object* BreakLocationIterator::BreakPointObjects() { | 361 Object* BreakLocationIterator::BreakPointObjects() { |
375 return debug_info_->GetBreakPointObjects(code_position()); | 362 return debug_info_->GetBreakPointObjects(code_position()); |
376 } | 363 } |
377 | 364 |
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 } | 2022 } |
2036 | 2023 |
2037 | 2024 |
2038 void LockingMessageQueue::Clear() { | 2025 void LockingMessageQueue::Clear() { |
2039 ScopedLock sl(lock_); | 2026 ScopedLock sl(lock_); |
2040 queue_.Clear(); | 2027 queue_.Clear(); |
2041 } | 2028 } |
2042 | 2029 |
2043 | 2030 |
2044 } } // namespace v8::internal | 2031 } } // namespace v8::internal |
OLD | NEW |