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" |
11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
12 #include "src/compilation-cache.h" | 12 #include "src/compilation-cache.h" |
13 #include "src/compiler.h" | 13 #include "src/compiler.h" |
14 #include "src/deoptimizer.h" | 14 #include "src/deoptimizer.h" |
15 #include "src/execution.h" | 15 #include "src/execution.h" |
16 #include "src/frames-inl.h" | 16 #include "src/frames-inl.h" |
17 #include "src/full-codegen/full-codegen.h" | 17 #include "src/full-codegen/full-codegen.h" |
18 #include "src/global-handles.h" | 18 #include "src/global-handles.h" |
| 19 #include "src/globals.h" |
19 #include "src/interpreter/interpreter.h" | 20 #include "src/interpreter/interpreter.h" |
20 #include "src/isolate-inl.h" | 21 #include "src/isolate-inl.h" |
21 #include "src/list.h" | 22 #include "src/list.h" |
22 #include "src/log.h" | 23 #include "src/log.h" |
23 #include "src/messages.h" | 24 #include "src/messages.h" |
24 #include "src/snapshot/natives.h" | 25 #include "src/snapshot/natives.h" |
25 #include "src/wasm/wasm-debug.h" | 26 #include "src/wasm/wasm-debug.h" |
26 #include "src/wasm/wasm-module.h" | 27 #include "src/wasm/wasm-module.h" |
27 | 28 |
28 #include "include/v8-debug.h" | 29 #include "include/v8-debug.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 bitfield_ |= mask; | 460 bitfield_ |= mask; |
460 } | 461 } |
461 | 462 |
462 | 463 |
463 // Threading support. | 464 // Threading support. |
464 void Debug::ThreadInit() { | 465 void Debug::ThreadInit() { |
465 thread_local_.break_count_ = 0; | 466 thread_local_.break_count_ = 0; |
466 thread_local_.break_id_ = 0; | 467 thread_local_.break_id_ = 0; |
467 thread_local_.break_frame_id_ = StackFrame::NO_ID; | 468 thread_local_.break_frame_id_ = StackFrame::NO_ID; |
468 thread_local_.last_step_action_ = StepNone; | 469 thread_local_.last_step_action_ = StepNone; |
469 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; | 470 thread_local_.last_statement_position_ = kNoSourcePosition; |
470 thread_local_.last_fp_ = 0; | 471 thread_local_.last_fp_ = 0; |
471 thread_local_.target_fp_ = 0; | 472 thread_local_.target_fp_ = 0; |
472 thread_local_.return_value_ = Handle<Object>(); | 473 thread_local_.return_value_ = Handle<Object>(); |
473 clear_suspended_generator(); | 474 clear_suspended_generator(); |
474 // TODO(isolates): frames_are_dropped_? | 475 // TODO(isolates): frames_are_dropped_? |
475 base::NoBarrier_Store(&thread_local_.current_debug_scope_, | 476 base::NoBarrier_Store(&thread_local_.current_debug_scope_, |
476 static_cast<base::AtomicWord>(0)); | 477 static_cast<base::AtomicWord>(0)); |
477 } | 478 } |
478 | 479 |
479 | 480 |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 Deoptimizer::DeoptimizeFunction(frames_it.frame()->function()); | 1064 Deoptimizer::DeoptimizeFunction(frames_it.frame()->function()); |
1064 frames_it.Advance(); | 1065 frames_it.Advance(); |
1065 } | 1066 } |
1066 if (!frames_it.done()) { | 1067 if (!frames_it.done()) { |
1067 // Fill the caller function to return to with one-shot break points. | 1068 // Fill the caller function to return to with one-shot break points. |
1068 Handle<JSFunction> caller_function(frames_it.frame()->function()); | 1069 Handle<JSFunction> caller_function(frames_it.frame()->function()); |
1069 FloodWithOneShot(caller_function); | 1070 FloodWithOneShot(caller_function); |
1070 thread_local_.target_fp_ = frames_it.frame()->UnpaddedFP(); | 1071 thread_local_.target_fp_ = frames_it.frame()->UnpaddedFP(); |
1071 } | 1072 } |
1072 // Clear last position info. For stepping out it does not matter. | 1073 // Clear last position info. For stepping out it does not matter. |
1073 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; | 1074 thread_local_.last_statement_position_ = kNoSourcePosition; |
1074 thread_local_.last_fp_ = 0; | 1075 thread_local_.last_fp_ = 0; |
1075 break; | 1076 break; |
1076 case StepNext: | 1077 case StepNext: |
1077 thread_local_.target_fp_ = frame->UnpaddedFP(); | 1078 thread_local_.target_fp_ = frame->UnpaddedFP(); |
1078 FloodWithOneShot(function); | 1079 FloodWithOneShot(function); |
1079 break; | 1080 break; |
1080 case StepIn: | 1081 case StepIn: |
1081 FloodWithOneShot(function); | 1082 FloodWithOneShot(function); |
1082 break; | 1083 break; |
1083 case StepFrame: | 1084 case StepFrame: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 } | 1125 } |
1125 return locations; | 1126 return locations; |
1126 } | 1127 } |
1127 | 1128 |
1128 | 1129 |
1129 void Debug::ClearStepping() { | 1130 void Debug::ClearStepping() { |
1130 // Clear the various stepping setup. | 1131 // Clear the various stepping setup. |
1131 ClearOneShot(); | 1132 ClearOneShot(); |
1132 | 1133 |
1133 thread_local_.last_step_action_ = StepNone; | 1134 thread_local_.last_step_action_ = StepNone; |
1134 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; | 1135 thread_local_.last_statement_position_ = kNoSourcePosition; |
1135 thread_local_.last_fp_ = 0; | 1136 thread_local_.last_fp_ = 0; |
1136 thread_local_.target_fp_ = 0; | 1137 thread_local_.target_fp_ = 0; |
1137 } | 1138 } |
1138 | 1139 |
1139 | 1140 |
1140 // Clears all the one-shot break points that are currently set. Normally this | 1141 // Clears all the one-shot break points that are currently set. Normally this |
1141 // function is called each time a break point is hit as one shot break points | 1142 // function is called each time a break point is hit as one shot break points |
1142 // are used to support stepping. | 1143 // are used to support stepping. |
1143 void Debug::ClearOneShot() { | 1144 void Debug::ClearOneShot() { |
1144 // The current implementation just runs through all the breakpoints. When the | 1145 // The current implementation just runs through all the breakpoints. When the |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 DCHECK(!has_suspended_generator()); | 1387 DCHECK(!has_suspended_generator()); |
1387 thread_local_.suspended_generator_ = *generator_object; | 1388 thread_local_.suspended_generator_ = *generator_object; |
1388 ClearStepping(); | 1389 ClearStepping(); |
1389 } | 1390 } |
1390 | 1391 |
1391 class SharedFunctionInfoFinder { | 1392 class SharedFunctionInfoFinder { |
1392 public: | 1393 public: |
1393 explicit SharedFunctionInfoFinder(int target_position) | 1394 explicit SharedFunctionInfoFinder(int target_position) |
1394 : current_candidate_(NULL), | 1395 : current_candidate_(NULL), |
1395 current_candidate_closure_(NULL), | 1396 current_candidate_closure_(NULL), |
1396 current_start_position_(RelocInfo::kNoPosition), | 1397 current_start_position_(kNoSourcePosition), |
1397 target_position_(target_position) {} | 1398 target_position_(target_position) {} |
1398 | 1399 |
1399 void NewCandidate(SharedFunctionInfo* shared, JSFunction* closure = NULL) { | 1400 void NewCandidate(SharedFunctionInfo* shared, JSFunction* closure = NULL) { |
1400 if (!shared->IsSubjectToDebugging()) return; | 1401 if (!shared->IsSubjectToDebugging()) return; |
1401 int start_position = shared->function_token_position(); | 1402 int start_position = shared->function_token_position(); |
1402 if (start_position == RelocInfo::kNoPosition) { | 1403 if (start_position == kNoSourcePosition) { |
1403 start_position = shared->start_position(); | 1404 start_position = shared->start_position(); |
1404 } | 1405 } |
1405 | 1406 |
1406 if (start_position > target_position_) return; | 1407 if (start_position > target_position_) return; |
1407 if (target_position_ > shared->end_position()) return; | 1408 if (target_position_ > shared->end_position()) return; |
1408 | 1409 |
1409 if (current_candidate_ != NULL) { | 1410 if (current_candidate_ != NULL) { |
1410 if (current_start_position_ == start_position && | 1411 if (current_start_position_ == start_position && |
1411 shared->end_position() == current_candidate_->end_position()) { | 1412 shared->end_position() == current_candidate_->end_position()) { |
1412 // If we already have a matching closure, do not throw it away. | 1413 // If we already have a matching closure, do not throw it away. |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 } | 2592 } |
2592 | 2593 |
2593 | 2594 |
2594 void LockingCommandMessageQueue::Clear() { | 2595 void LockingCommandMessageQueue::Clear() { |
2595 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2596 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2596 queue_.Clear(); | 2597 queue_.Clear(); |
2597 } | 2598 } |
2598 | 2599 |
2599 } // namespace internal | 2600 } // namespace internal |
2600 } // namespace v8 | 2601 } // namespace v8 |
OLD | NEW |