| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 thread_local_.last_step_action_ = StepNone; | 395 thread_local_.last_step_action_ = StepNone; |
| 396 thread_local_.last_statement_position_ = kNoSourcePosition; | 396 thread_local_.last_statement_position_ = kNoSourcePosition; |
| 397 thread_local_.last_frame_count_ = -1; | 397 thread_local_.last_frame_count_ = -1; |
| 398 thread_local_.fast_forward_to_return_ = false; | 398 thread_local_.fast_forward_to_return_ = false; |
| 399 thread_local_.ignore_step_into_function_ = Smi::kZero; | 399 thread_local_.ignore_step_into_function_ = Smi::kZero; |
| 400 thread_local_.target_frame_count_ = -1; | 400 thread_local_.target_frame_count_ = -1; |
| 401 thread_local_.return_value_ = Smi::kZero; | 401 thread_local_.return_value_ = Smi::kZero; |
| 402 thread_local_.async_task_count_ = 0; | 402 thread_local_.async_task_count_ = 0; |
| 403 clear_suspended_generator(); | 403 clear_suspended_generator(); |
| 404 thread_local_.restart_fp_ = nullptr; | 404 thread_local_.restart_fp_ = nullptr; |
| 405 base::NoBarrier_Store(&thread_local_.current_debug_scope_, | 405 base::Relaxed_Store(&thread_local_.current_debug_scope_, |
| 406 static_cast<base::AtomicWord>(0)); | 406 static_cast<base::AtomicWord>(0)); |
| 407 UpdateHookOnFunctionCall(); | 407 UpdateHookOnFunctionCall(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 | 410 |
| 411 char* Debug::ArchiveDebug(char* storage) { | 411 char* Debug::ArchiveDebug(char* storage) { |
| 412 // Simply reset state. Don't archive anything. | 412 // Simply reset state. Don't archive anything. |
| 413 ThreadInit(); | 413 ThreadInit(); |
| 414 return storage + ArchiveSpacePerThread(); | 414 return storage + ArchiveSpacePerThread(); |
| 415 } | 415 } |
| 416 | 416 |
| (...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 } | 2218 } |
| 2219 #endif // DEBUG | 2219 #endif // DEBUG |
| 2220 | 2220 |
| 2221 DebugScope::DebugScope(Debug* debug) | 2221 DebugScope::DebugScope(Debug* debug) |
| 2222 : debug_(debug), | 2222 : debug_(debug), |
| 2223 prev_(debug->debugger_entry()), | 2223 prev_(debug->debugger_entry()), |
| 2224 save_(debug_->isolate_), | 2224 save_(debug_->isolate_), |
| 2225 no_termination_exceptons_(debug_->isolate_, | 2225 no_termination_exceptons_(debug_->isolate_, |
| 2226 StackGuard::TERMINATE_EXECUTION) { | 2226 StackGuard::TERMINATE_EXECUTION) { |
| 2227 // Link recursive debugger entry. | 2227 // Link recursive debugger entry. |
| 2228 base::NoBarrier_Store(&debug_->thread_local_.current_debug_scope_, | 2228 base::Relaxed_Store(&debug_->thread_local_.current_debug_scope_, |
| 2229 reinterpret_cast<base::AtomicWord>(this)); | 2229 reinterpret_cast<base::AtomicWord>(this)); |
| 2230 | 2230 |
| 2231 // Store the previous break id, frame id and return value. | 2231 // Store the previous break id, frame id and return value. |
| 2232 break_id_ = debug_->break_id(); | 2232 break_id_ = debug_->break_id(); |
| 2233 break_frame_id_ = debug_->break_frame_id(); | 2233 break_frame_id_ = debug_->break_frame_id(); |
| 2234 | 2234 |
| 2235 // Create the new break info. If there is no proper frames there is no break | 2235 // Create the new break info. If there is no proper frames there is no break |
| 2236 // frame id. | 2236 // frame id. |
| 2237 StackTraceFrameIterator it(isolate()); | 2237 StackTraceFrameIterator it(isolate()); |
| 2238 bool has_frames = !it.done(); | 2238 bool has_frames = !it.done(); |
| 2239 debug_->thread_local_.break_frame_id_ = | 2239 debug_->thread_local_.break_frame_id_ = |
| 2240 has_frames ? it.frame()->id() : StackFrame::NO_ID; | 2240 has_frames ? it.frame()->id() : StackFrame::NO_ID; |
| 2241 debug_->SetNextBreakId(); | 2241 debug_->SetNextBreakId(); |
| 2242 | 2242 |
| 2243 debug_->UpdateState(); | 2243 debug_->UpdateState(); |
| 2244 // Make sure that debugger is loaded and enter the debugger context. | 2244 // Make sure that debugger is loaded and enter the debugger context. |
| 2245 // The previous context is kept in save_. | 2245 // The previous context is kept in save_. |
| 2246 failed_ = !debug_->is_loaded(); | 2246 failed_ = !debug_->is_loaded(); |
| 2247 if (!failed_) isolate()->set_context(*debug->debug_context()); | 2247 if (!failed_) isolate()->set_context(*debug->debug_context()); |
| 2248 } | 2248 } |
| 2249 | 2249 |
| 2250 | 2250 |
| 2251 DebugScope::~DebugScope() { | 2251 DebugScope::~DebugScope() { |
| 2252 // Leaving this debugger entry. | 2252 // Leaving this debugger entry. |
| 2253 base::NoBarrier_Store(&debug_->thread_local_.current_debug_scope_, | 2253 base::Relaxed_Store(&debug_->thread_local_.current_debug_scope_, |
| 2254 reinterpret_cast<base::AtomicWord>(prev_)); | 2254 reinterpret_cast<base::AtomicWord>(prev_)); |
| 2255 | 2255 |
| 2256 // Restore to the previous break state. | 2256 // Restore to the previous break state. |
| 2257 debug_->thread_local_.break_frame_id_ = break_frame_id_; | 2257 debug_->thread_local_.break_frame_id_ = break_frame_id_; |
| 2258 debug_->thread_local_.break_id_ = break_id_; | 2258 debug_->thread_local_.break_id_ = break_id_; |
| 2259 | 2259 |
| 2260 debug_->UpdateState(); | 2260 debug_->UpdateState(); |
| 2261 } | 2261 } |
| 2262 | 2262 |
| 2263 ReturnValueScope::ReturnValueScope(Debug* debug) : debug_(debug) { | 2263 ReturnValueScope::ReturnValueScope(Debug* debug) : debug_(debug) { |
| 2264 return_value_ = debug_->return_value_handle(); | 2264 return_value_ = debug_->return_value_handle(); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 isolate_->Throw(*isolate_->factory()->NewEvalError( | 2448 isolate_->Throw(*isolate_->factory()->NewEvalError( |
| 2449 MessageTemplate::kNoSideEffectDebugEvaluate)); | 2449 MessageTemplate::kNoSideEffectDebugEvaluate)); |
| 2450 } | 2450 } |
| 2451 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); | 2451 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); |
| 2452 isolate_->debug()->UpdateHookOnFunctionCall(); | 2452 isolate_->debug()->UpdateHookOnFunctionCall(); |
| 2453 isolate_->debug()->side_effect_check_failed_ = false; | 2453 isolate_->debug()->side_effect_check_failed_ = false; |
| 2454 } | 2454 } |
| 2455 | 2455 |
| 2456 } // namespace internal | 2456 } // namespace internal |
| 2457 } // namespace v8 | 2457 } // namespace v8 |
| OLD | NEW |