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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 thread_local_.last_step_action_ = StepNone; | 335 thread_local_.last_step_action_ = StepNone; |
336 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; | 336 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; |
337 thread_local_.step_count_ = 0; | 337 thread_local_.step_count_ = 0; |
338 thread_local_.last_fp_ = 0; | 338 thread_local_.last_fp_ = 0; |
339 thread_local_.queued_step_count_ = 0; | 339 thread_local_.queued_step_count_ = 0; |
340 thread_local_.step_out_fp_ = 0; | 340 thread_local_.step_out_fp_ = 0; |
341 thread_local_.step_in_enabled_ = false; | 341 thread_local_.step_in_enabled_ = false; |
342 // TODO(isolates): frames_are_dropped_? | 342 // TODO(isolates): frames_are_dropped_? |
343 base::NoBarrier_Store(&thread_local_.current_debug_scope_, | 343 base::NoBarrier_Store(&thread_local_.current_debug_scope_, |
344 static_cast<base::AtomicWord>(0)); | 344 static_cast<base::AtomicWord>(0)); |
| 345 thread_local_.restarter_frame_function_pointer_ = NULL; |
345 } | 346 } |
346 | 347 |
347 | 348 |
348 char* Debug::ArchiveDebug(char* storage) { | 349 char* Debug::ArchiveDebug(char* storage) { |
349 char* to = storage; | 350 char* to = storage; |
350 MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); | 351 MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); |
351 ThreadInit(); | 352 ThreadInit(); |
352 return storage + ArchiveSpacePerThread(); | 353 return storage + ArchiveSpacePerThread(); |
353 } | 354 } |
354 | 355 |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 // Set target frame pointer. | 930 // Set target frame pointer. |
930 ActivateStepOut(frames_it.frame()); | 931 ActivateStepOut(frames_it.frame()); |
931 } else { | 932 } else { |
932 // Stepping out to the embedder. Disable step-in to avoid stepping into | 933 // Stepping out to the embedder. Disable step-in to avoid stepping into |
933 // the next (unrelated) call that the embedder makes. | 934 // the next (unrelated) call that the embedder makes. |
934 thread_local_.step_in_enabled_ = false; | 935 thread_local_.step_in_enabled_ = false; |
935 } | 936 } |
936 return; | 937 return; |
937 } | 938 } |
938 | 939 |
| 940 STATIC_ASSERT(StepFrame > StepIn); |
| 941 if (step_action >= StepIn) { |
| 942 // If there's restarter frame on top of the stack, just get the pointer |
| 943 // to function which is going to be restarted. |
| 944 if (thread_local_.restarter_frame_function_pointer_ != NULL) { |
| 945 Handle<JSFunction> restarted_function( |
| 946 JSFunction::cast(*thread_local_.restarter_frame_function_pointer_)); |
| 947 FloodWithOneShot(restarted_function); |
| 948 } |
| 949 } |
| 950 |
939 // Fill the current function with one-shot break points even for step in on | 951 // Fill the current function with one-shot break points even for step in on |
940 // a call target as the function called might be a native function for | 952 // a call target as the function called might be a native function for |
941 // which step in will not stop. It also prepares for stepping in | 953 // which step in will not stop. It also prepares for stepping in |
942 // getters/setters. | 954 // getters/setters. |
943 // If we are stepping into another frame, only fill calls and returns. | 955 // If we are stepping into another frame, only fill calls and returns. |
944 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS | 956 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS |
945 : ALL_BREAK_LOCATIONS); | 957 : ALL_BREAK_LOCATIONS); |
946 | 958 |
947 // Remember source position and frame to handle step next. | 959 // Remember source position and frame to handle step next. |
948 thread_local_.last_statement_position_ = | 960 thread_local_.last_statement_position_ = |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 Address slot_pc = frame->pc() - Assembler::kDebugBreakSlotLength; | 1521 Address slot_pc = frame->pc() - Assembler::kDebugBreakSlotLength; |
1510 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); | 1522 int mask = RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); |
1511 for (RelocIterator it(*code, mask); !it.done(); it.next()) { | 1523 for (RelocIterator it(*code, mask); !it.done(); it.next()) { |
1512 if (it.rinfo()->pc() == slot_pc) return true; | 1524 if (it.rinfo()->pc() == slot_pc) return true; |
1513 } | 1525 } |
1514 return false; | 1526 return false; |
1515 } | 1527 } |
1516 | 1528 |
1517 | 1529 |
1518 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, | 1530 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, |
1519 LiveEdit::FrameDropMode mode) { | 1531 LiveEdit::FrameDropMode mode, |
| 1532 Object** restarter_frame_function_pointer) { |
1520 if (mode != LiveEdit::CURRENTLY_SET_MODE) { | 1533 if (mode != LiveEdit::CURRENTLY_SET_MODE) { |
1521 thread_local_.frame_drop_mode_ = mode; | 1534 thread_local_.frame_drop_mode_ = mode; |
1522 } | 1535 } |
1523 thread_local_.break_frame_id_ = new_break_frame_id; | 1536 thread_local_.break_frame_id_ = new_break_frame_id; |
| 1537 thread_local_.restarter_frame_function_pointer_ = |
| 1538 restarter_frame_function_pointer; |
1524 } | 1539 } |
1525 | 1540 |
1526 | 1541 |
1527 bool Debug::IsDebugGlobal(JSGlobalObject* global) { | 1542 bool Debug::IsDebugGlobal(JSGlobalObject* global) { |
1528 return is_loaded() && global == debug_context()->global_object(); | 1543 return is_loaded() && global == debug_context()->global_object(); |
1529 } | 1544 } |
1530 | 1545 |
1531 | 1546 |
1532 void Debug::ClearMirrorCache() { | 1547 void Debug::ClearMirrorCache() { |
1533 PostponeInterruptsScope postpone(isolate_); | 1548 PostponeInterruptsScope postpone(isolate_); |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 } | 2526 } |
2512 | 2527 |
2513 | 2528 |
2514 void LockingCommandMessageQueue::Clear() { | 2529 void LockingCommandMessageQueue::Clear() { |
2515 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2530 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2516 queue_.Clear(); | 2531 queue_.Clear(); |
2517 } | 2532 } |
2518 | 2533 |
2519 } // namespace internal | 2534 } // namespace internal |
2520 } // namespace v8 | 2535 } // namespace v8 |
OLD | NEW |