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 "src/debug/debug.h" | 5 #include "src/debug/debug.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 thread_local_.last_step_action_ = StepNone; | 329 thread_local_.last_step_action_ = StepNone; |
330 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; | 330 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; |
331 thread_local_.step_count_ = 0; | 331 thread_local_.step_count_ = 0; |
332 thread_local_.last_fp_ = 0; | 332 thread_local_.last_fp_ = 0; |
333 thread_local_.queued_step_count_ = 0; | 333 thread_local_.queued_step_count_ = 0; |
334 thread_local_.step_out_fp_ = 0; | 334 thread_local_.step_out_fp_ = 0; |
335 thread_local_.step_in_enabled_ = false; | 335 thread_local_.step_in_enabled_ = false; |
336 // TODO(isolates): frames_are_dropped_? | 336 // TODO(isolates): frames_are_dropped_? |
337 base::NoBarrier_Store(&thread_local_.current_debug_scope_, | 337 base::NoBarrier_Store(&thread_local_.current_debug_scope_, |
338 static_cast<base::AtomicWord>(0)); | 338 static_cast<base::AtomicWord>(0)); |
| 339 thread_local_.restarter_frame_function_pointer_ = NULL; |
339 } | 340 } |
340 | 341 |
341 | 342 |
342 char* Debug::ArchiveDebug(char* storage) { | 343 char* Debug::ArchiveDebug(char* storage) { |
343 char* to = storage; | 344 char* to = storage; |
344 MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); | 345 MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); |
345 ThreadInit(); | 346 ThreadInit(); |
346 return storage + ArchiveSpacePerThread(); | 347 return storage + ArchiveSpacePerThread(); |
347 } | 348 } |
348 | 349 |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 // Set target frame pointer. | 924 // Set target frame pointer. |
924 ActivateStepOut(frames_it.frame()); | 925 ActivateStepOut(frames_it.frame()); |
925 } else { | 926 } else { |
926 // Stepping out to the embedder. Disable step-in to avoid stepping into | 927 // Stepping out to the embedder. Disable step-in to avoid stepping into |
927 // the next (unrelated) call that the embedder makes. | 928 // the next (unrelated) call that the embedder makes. |
928 thread_local_.step_in_enabled_ = false; | 929 thread_local_.step_in_enabled_ = false; |
929 } | 930 } |
930 return; | 931 return; |
931 } | 932 } |
932 | 933 |
| 934 STATIC_ASSERT(StepFrame > StepIn); |
| 935 if (step_action >= StepIn) { |
| 936 // If there's restarter frame on top of the stack, just get the pointer |
| 937 // to function which is going to be restarted. |
| 938 if (thread_local_.restarter_frame_function_pointer_ != NULL) { |
| 939 Handle<JSFunction> restarted_function( |
| 940 JSFunction::cast(*thread_local_.restarter_frame_function_pointer_)); |
| 941 FloodWithOneShot(restarted_function); |
| 942 } |
| 943 } |
| 944 |
933 // Fill the current function with one-shot break points even for step in on | 945 // Fill the current function with one-shot break points even for step in on |
934 // a call target as the function called might be a native function for | 946 // a call target as the function called might be a native function for |
935 // which step in will not stop. It also prepares for stepping in | 947 // which step in will not stop. It also prepares for stepping in |
936 // getters/setters. | 948 // getters/setters. |
937 // If we are stepping into another frame, only fill calls and returns. | 949 // If we are stepping into another frame, only fill calls and returns. |
938 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS | 950 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS |
939 : ALL_BREAK_LOCATIONS); | 951 : ALL_BREAK_LOCATIONS); |
940 | 952 |
941 // Remember source position and frame to handle step next. | 953 // Remember source position and frame to handle step next. |
942 thread_local_.last_statement_position_ = | 954 thread_local_.last_statement_position_ = |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 Address slot_pc = frame->pc() - Assembler::kDebugBreakSlotLength; | 1515 Address slot_pc = frame->pc() - Assembler::kDebugBreakSlotLength; |
1504 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); | 1516 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); |
1505 for (RelocIterator it(*code, mask); !it.done(); it.next()) { | 1517 for (RelocIterator it(*code, mask); !it.done(); it.next()) { |
1506 if (it.rinfo()->pc() == slot_pc) return true; | 1518 if (it.rinfo()->pc() == slot_pc) return true; |
1507 } | 1519 } |
1508 return false; | 1520 return false; |
1509 } | 1521 } |
1510 | 1522 |
1511 | 1523 |
1512 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, | 1524 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, |
1513 LiveEdit::FrameDropMode mode) { | 1525 LiveEdit::FrameDropMode mode, |
| 1526 Object** restarter_frame_function_pointer) { |
1514 if (mode != LiveEdit::CURRENTLY_SET_MODE) { | 1527 if (mode != LiveEdit::CURRENTLY_SET_MODE) { |
1515 thread_local_.frame_drop_mode_ = mode; | 1528 thread_local_.frame_drop_mode_ = mode; |
1516 } | 1529 } |
1517 thread_local_.break_frame_id_ = new_break_frame_id; | 1530 thread_local_.break_frame_id_ = new_break_frame_id; |
| 1531 thread_local_.restarter_frame_function_pointer_ = |
| 1532 restarter_frame_function_pointer; |
1518 } | 1533 } |
1519 | 1534 |
1520 | 1535 |
1521 bool Debug::IsDebugGlobal(JSGlobalObject* global) { | 1536 bool Debug::IsDebugGlobal(JSGlobalObject* global) { |
1522 return is_loaded() && global == debug_context()->global_object(); | 1537 return is_loaded() && global == debug_context()->global_object(); |
1523 } | 1538 } |
1524 | 1539 |
1525 | 1540 |
1526 void Debug::ClearMirrorCache() { | 1541 void Debug::ClearMirrorCache() { |
1527 PostponeInterruptsScope postpone(isolate_); | 1542 PostponeInterruptsScope postpone(isolate_); |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2505 } | 2520 } |
2506 | 2521 |
2507 | 2522 |
2508 void LockingCommandMessageQueue::Clear() { | 2523 void LockingCommandMessageQueue::Clear() { |
2509 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2524 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2510 queue_.Clear(); | 2525 queue_.Clear(); |
2511 } | 2526 } |
2512 | 2527 |
2513 } // namespace internal | 2528 } // namespace internal |
2514 } // namespace v8 | 2529 } // namespace v8 |
OLD | NEW |