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 #ifndef V8_DEBUG_H_ | 5 #ifndef V8_DEBUG_H_ |
6 #define V8_DEBUG_H_ | 6 #define V8_DEBUG_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 int step_count, | 431 int step_count, |
432 StackFrame::Id frame_id); | 432 StackFrame::Id frame_id); |
433 void ClearStepping(); | 433 void ClearStepping(); |
434 void ClearStepOut(); | 434 void ClearStepOut(); |
435 bool IsStepping() { return thread_local_.step_count_ > 0; } | 435 bool IsStepping() { return thread_local_.step_count_ > 0; } |
436 bool StepNextContinue(BreakLocation* location, JavaScriptFrame* frame); | 436 bool StepNextContinue(BreakLocation* location, JavaScriptFrame* frame); |
437 bool StepInActive() { return thread_local_.step_into_fp_ != 0; } | 437 bool StepInActive() { return thread_local_.step_into_fp_ != 0; } |
438 void HandleStepIn(Handle<Object> function_obj, bool is_constructor); | 438 void HandleStepIn(Handle<Object> function_obj, bool is_constructor); |
439 bool StepOutActive() { return thread_local_.step_out_fp_ != 0; } | 439 bool StepOutActive() { return thread_local_.step_out_fp_ != 0; } |
440 | 440 |
441 // Purge all code objects that have no debug break slots. | 441 void GetStepinPositions(JavaScriptFrame* frame, StackFrame::Id frame_id, |
442 void PrepareForBreakPoints(); | 442 List<int>* results_out); |
| 443 |
| 444 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); |
443 | 445 |
444 // Returns whether the operation succeeded. Compilation can only be triggered | 446 // Returns whether the operation succeeded. Compilation can only be triggered |
445 // if a valid closure is passed as the second argument, otherwise the shared | 447 // if a valid closure is passed as the second argument, otherwise the shared |
446 // function needs to be compiled already. | 448 // function needs to be compiled already. |
447 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, | 449 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, |
448 Handle<JSFunction> function); | 450 Handle<JSFunction> function); |
449 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); | 451 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); |
450 static bool HasDebugInfo(Handle<SharedFunctionInfo> shared); | |
451 | 452 |
452 template <typename C> | 453 template <typename C> |
453 bool CompileToRevealInnerFunctions(C* compilable); | 454 bool CompileToRevealInnerFunctions(C* compilable); |
454 | 455 |
455 // This function is used in FunctionNameUsing* tests. | 456 // This function is used in FunctionNameUsing* tests. |
456 Handle<Object> FindSharedFunctionInfoInScript(Handle<Script> script, | 457 Handle<Object> FindSharedFunctionInfoInScript(Handle<Script> script, |
457 int position); | 458 int position); |
458 | 459 |
459 // Returns true if the current stub call is patched to call the debugger. | 460 // Returns true if the current stub call is patched to call the debugger. |
460 static bool IsDebugBreak(Address addr); | 461 static bool IsDebugBreak(Address addr); |
(...skipping 24 matching lines...) Expand all Loading... |
485 void FreeThreadResources() { } | 486 void FreeThreadResources() { } |
486 | 487 |
487 // Record function from which eval was called. | 488 // Record function from which eval was called. |
488 static void RecordEvalCaller(Handle<Script> script); | 489 static void RecordEvalCaller(Handle<Script> script); |
489 | 490 |
490 bool CheckExecutionState(int id) { | 491 bool CheckExecutionState(int id) { |
491 return is_active() && !debug_context().is_null() && break_id() != 0 && | 492 return is_active() && !debug_context().is_null() && break_id() != 0 && |
492 break_id() == id; | 493 break_id() == id; |
493 } | 494 } |
494 | 495 |
| 496 bool RequiresEagerCompilation(bool allows_lazy_without_ctx = false) { |
| 497 return LiveEditFunctionTracker::IsActive(isolate_) || |
| 498 (is_active() && !allows_lazy_without_ctx); |
| 499 } |
| 500 |
495 // Flags and states. | 501 // Flags and states. |
496 DebugScope* debugger_entry() { | 502 DebugScope* debugger_entry() { |
497 return reinterpret_cast<DebugScope*>( | 503 return reinterpret_cast<DebugScope*>( |
498 base::NoBarrier_Load(&thread_local_.current_debug_scope_)); | 504 base::NoBarrier_Load(&thread_local_.current_debug_scope_)); |
499 } | 505 } |
500 inline Handle<Context> debug_context() { return debug_context_; } | 506 inline Handle<Context> debug_context() { return debug_context_; } |
501 void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; } | 507 void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; } |
502 bool live_edit_enabled() const { | 508 bool live_edit_enabled() const { |
503 return FLAG_enable_liveedit && live_edit_enabled_ ; | 509 return FLAG_enable_liveedit && live_edit_enabled_ ; |
504 } | 510 } |
505 | 511 |
506 inline bool is_active() const { return is_active_; } | 512 inline bool is_active() const { return is_active_; } |
507 inline bool is_loaded() const { return !debug_context_.is_null(); } | 513 inline bool is_loaded() const { return !debug_context_.is_null(); } |
508 inline bool has_break_points() const { return has_break_points_; } | |
509 inline bool in_debug_scope() const { | 514 inline bool in_debug_scope() const { |
510 return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); | 515 return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); |
511 } | 516 } |
512 void set_disable_break(bool v) { break_disabled_ = v; } | 517 void set_disable_break(bool v) { break_disabled_ = v; } |
513 | 518 |
514 StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } | 519 StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } |
515 int break_id() { return thread_local_.break_id_; } | 520 int break_id() { return thread_local_.break_id_; } |
516 | 521 |
517 // Support for embedding into generated code. | 522 // Support for embedding into generated code. |
518 Address is_active_address() { | 523 Address is_active_address() { |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 int call_argc = -1); | 802 int call_argc = -1); |
798 | 803 |
799 static void PatchDebugBreakSlot(Address pc, Handle<Code> code); | 804 static void PatchDebugBreakSlot(Address pc, Handle<Code> code); |
800 static void ClearDebugBreakSlot(Address pc); | 805 static void ClearDebugBreakSlot(Address pc); |
801 }; | 806 }; |
802 | 807 |
803 | 808 |
804 } } // namespace v8::internal | 809 } } // namespace v8::internal |
805 | 810 |
806 #endif // V8_DEBUG_H_ | 811 #endif // V8_DEBUG_H_ |
OLD | NEW |