diff options
author | Myles Borins <mylesborins@google.com> | 2018-04-10 21:39:51 -0400 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-04-11 13:22:42 -0400 |
commit | 12a1b9b8049462e47181a298120243dc83e81c55 (patch) | |
tree | 8605276308c8b4e3597516961266bae1af57557a /deps/v8/src/debug/debug.h | |
parent | 78cd8263354705b767ef8c6a651740efe4931ba0 (diff) | |
download | node-new-12a1b9b8049462e47181a298120243dc83e81c55.tar.gz |
deps: update V8 to 6.6.346.23
PR-URL: https://github.com/nodejs/node/pull/19201
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/src/debug/debug.h')
-rw-r--r-- | deps/v8/src/debug/debug.h | 81 |
1 files changed, 44 insertions, 37 deletions
diff --git a/deps/v8/src/debug/debug.h b/deps/v8/src/debug/debug.h index aec66f2f35..4ea9c2b872 100644 --- a/deps/v8/src/debug/debug.h +++ b/deps/v8/src/debug/debug.h @@ -25,12 +25,9 @@ #include "src/string-stream.h" #include "src/v8threads.h" -#include "include/v8-debug.h" - namespace v8 { namespace internal { - // Forward declarations. class DebugScope; @@ -51,13 +48,14 @@ enum ExceptionBreakType { BreakUncaughtException = 1 }; - enum DebugBreakType { NOT_DEBUG_BREAK, DEBUGGER_STATEMENT, DEBUG_BREAK_SLOT, DEBUG_BREAK_SLOT_AT_CALL, DEBUG_BREAK_SLOT_AT_RETURN, + DEBUG_BREAK_SLOT_AT_SUSPEND, + DEBUG_BREAK_AT_ENTRY, }; enum IgnoreBreakMode { @@ -74,12 +72,20 @@ class BreakLocation { JavaScriptFrame* frame, std::vector<BreakLocation>* result_out); + inline bool IsSuspend() const { return type_ == DEBUG_BREAK_SLOT_AT_SUSPEND; } inline bool IsReturn() const { return type_ == DEBUG_BREAK_SLOT_AT_RETURN; } + inline bool IsReturnOrSuspend() const { + return type_ >= DEBUG_BREAK_SLOT_AT_RETURN; + } inline bool IsCall() const { return type_ == DEBUG_BREAK_SLOT_AT_CALL; } inline bool IsDebugBreakSlot() const { return type_ >= DEBUG_BREAK_SLOT; } inline bool IsDebuggerStatement() const { return type_ == DEBUGGER_STATEMENT; } + inline bool IsDebugBreakAtEntry() const { + bool result = type_ == DEBUG_BREAK_AT_ENTRY; + return result; + } bool HasBreakPoint(Handle<DebugInfo> debug_info) const; @@ -87,16 +93,26 @@ class BreakLocation { debug::BreakLocationType type() const; + JSGeneratorObject* GetGeneratorObjectForSuspendedFrame( + JavaScriptFrame* frame) const; + private: BreakLocation(Handle<AbstractCode> abstract_code, DebugBreakType type, - int code_offset, int position) + int code_offset, int position, int generator_obj_reg_index) : abstract_code_(abstract_code), code_offset_(code_offset), type_(type), - position_(position) { + position_(position), + generator_obj_reg_index_(generator_obj_reg_index) { DCHECK_NE(NOT_DEBUG_BREAK, type_); } + BreakLocation(int position, DebugBreakType type) + : code_offset_(0), + type_(type), + position_(position), + generator_obj_reg_index_(0) {} + static int BreakIndexFromCodeOffset(Handle<DebugInfo> debug_info, Handle<AbstractCode> abstract_code, int offset); @@ -108,6 +124,7 @@ class BreakLocation { int code_offset_; DebugBreakType type_; int position_; + int generator_obj_reg_index_; friend class BreakIterator; }; @@ -215,19 +232,20 @@ class Debug { // Internal logic bool Load(); - void Break(JavaScriptFrame* frame); + // The break target may not be the top-most frame, since we may be + // breaking before entering a function that cannot contain break points. + void Break(JavaScriptFrame* frame, Handle<JSFunction> break_target); // Scripts handling. Handle<FixedArray> GetLoadedScripts(); // Break point handling. bool SetBreakPoint(Handle<JSFunction> function, - Handle<Object> break_point_object, - int* source_position); + Handle<BreakPoint> break_point, int* source_position); bool SetBreakPointForScript(Handle<Script> script, - Handle<Object> break_point_object, + Handle<BreakPoint> break_point, int* source_position); - void ClearBreakPoint(Handle<Object> break_point_object); + void ClearBreakPoint(Handle<BreakPoint> break_point); void ChangeBreakOnException(ExceptionBreakType type, bool enable); bool IsBreakOnException(ExceptionBreakType type); @@ -235,12 +253,11 @@ class Debug { int* offset, int* id); void RemoveBreakpoint(int id); - // The parameter is either a BreakPointInfo object, or a FixedArray of - // BreakPointInfo objects. + // The parameter is either a BreakPoint object, or a FixedArray of + // BreakPoint objects. // Returns an empty handle if no breakpoint is hit, or a FixedArray with all - // hit breakpoints. - MaybeHandle<FixedArray> GetHitBreakPointObjects( - Handle<Object> break_point_objects); + // hit BreakPoint objects. + MaybeHandle<FixedArray> GetHitBreakPoints(Handle<Object> break_points); // Stepping handling. void PrepareStep(StepAction step_action); @@ -256,8 +273,6 @@ class Debug { int end_position, bool restrict_to_function, std::vector<BreakLocation>* locations); - void RecordGenerator(Handle<JSGeneratorObject> generator_object); - void RunPromiseHook(PromiseHookType hook_type, Handle<JSPromise> promise, Handle<Object> parent); @@ -265,6 +280,8 @@ class Debug { bool IsBlackboxed(Handle<SharedFunctionInfo> shared); + bool CanBreakAtEntry(Handle<SharedFunctionInfo> shared); + void SetDebugDelegate(debug::DebugDelegate* delegate, bool pass_ownership); // Returns whether the operation succeeded. @@ -339,6 +356,10 @@ class Debug { inline bool in_debug_scope() const { return !!base::Relaxed_Load(&thread_local_.current_debug_scope_); } + inline bool needs_check_on_function_call() const { + return hook_on_function_call_; + } + void set_break_points_active(bool v) { break_points_active_ = v; } bool break_points_active() const { return break_points_active_; } @@ -376,6 +397,10 @@ class Debug { DebugFeatureTracker* feature_tracker() { return &feature_tracker_; } + // For functions in which we cannot set a break point, use a canonical + // source position for break points. + static const int kBreakAtEntryPosition = 0; + private: explicit Debug(Isolate* isolate); ~Debug() { DCHECK_NULL(debug_delegate_); } @@ -410,8 +435,6 @@ class Debug { // Constructors for debug event objects. MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); - MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( - Handle<Object> break_points_hit); MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( Handle<Object> exception, bool uncaught, @@ -445,7 +468,7 @@ class Debug { BreakLocation* location, bool* has_break_points = nullptr); bool IsMutedAtCurrentLocation(JavaScriptFrame* frame); - bool CheckBreakPoint(Handle<Object> break_point_object); + bool CheckBreakPoint(Handle<BreakPoint> break_point); MaybeHandle<Object> CallFunction(const char* name, int argc, Handle<Object> args[], bool catch_exceptions = true); @@ -577,7 +600,6 @@ class LegacyDebugDelegate : public v8::debug::DebugDelegate { bool has_compile_error) override; void BreakProgramRequested(v8::Local<v8::Context> paused_context, v8::Local<v8::Object> exec_state, - v8::Local<v8::Value> break_points_hit, const std::vector<debug::BreakpointId>&) override; void ExceptionThrown(v8::Local<v8::Context> paused_context, v8::Local<v8::Object> exec_state, @@ -599,20 +621,6 @@ class LegacyDebugDelegate : public v8::debug::DebugDelegate { Handle<JSObject> exec_state) = 0; }; -class JavaScriptDebugDelegate : public LegacyDebugDelegate { - public: - JavaScriptDebugDelegate(Isolate* isolate, Handle<JSFunction> listener, - Handle<Object> data); - virtual ~JavaScriptDebugDelegate(); - - private: - void ProcessDebugEvent(v8::DebugEvent event, Handle<JSObject> event_data, - Handle<JSObject> exec_state) override; - - Handle<JSFunction> listener_; - Handle<Object> data_; -}; - class NativeDebugDelegate : public LegacyDebugDelegate { public: NativeDebugDelegate(Isolate* isolate, v8::Debug::EventCallback callback, @@ -630,7 +638,6 @@ class NativeDebugDelegate : public LegacyDebugDelegate { virtual v8::Local<v8::Object> GetEventData() const; virtual v8::Local<v8::Context> GetEventContext() const; virtual v8::Local<v8::Value> GetCallbackData() const; - virtual v8::Debug::ClientData* GetClientData() const { return nullptr; } virtual v8::Isolate* GetIsolate() const; private: |