V8 Project
v8::internal::MessageImpl Class Reference

#include <debug.h>

+ Inheritance diagram for v8::internal::MessageImpl:
+ Collaboration diagram for v8::internal::MessageImpl:

Public Member Functions

virtual bool IsEvent () const
 Check type of message. More...
 
virtual bool IsResponse () const
 
virtual DebugEvent GetEvent () const
 
virtual bool WillStartRunning () const
 Indicate whether this is a response to a continue command which will start the VM running after this is processed. More...
 
virtual v8::Handle< v8::ObjectGetExecutionState () const
 Access to execution state and event data. More...
 
virtual v8::Handle< v8::ObjectGetEventData () const
 
virtual v8::Handle< v8::StringGetJSON () const
 Get the debugger protocol JSON. More...
 
virtual v8::Handle< v8::ContextGetEventContext () const
 Get the context active when the debug event happened. More...
 
virtual v8::Debug::ClientDataGetClientData () const
 Client data passed with the corresponding request if any. More...
 
virtual v8::IsolateGetIsolate () const
 
- Public Member Functions inherited from v8::Debug::Message
virtual ~Message ()
 

Static Public Member Functions

static MessageImpl NewEvent (DebugEvent event, bool running, Handle< JSObject > exec_state, Handle< JSObject > event_data)
 
static MessageImpl NewResponse (DebugEvent event, bool running, Handle< JSObject > exec_state, Handle< JSObject > event_data, Handle< String > response_json, v8::Debug::ClientData *client_data)
 

Private Member Functions

 MessageImpl (bool is_event, DebugEvent event, bool running, Handle< JSObject > exec_state, Handle< JSObject > event_data, Handle< String > response_json, v8::Debug::ClientData *client_data)
 

Private Attributes

bool is_event_
 
DebugEvent event_
 
bool running_
 
Handle< JSObjectexec_state_
 
Handle< JSObjectevent_data_
 
Handle< Stringresponse_json_
 
v8::Debug::ClientDataclient_data_
 

Detailed Description

Definition at line 202 of file debug.h.

Constructor & Destructor Documentation

◆ MessageImpl()

v8::internal::MessageImpl::MessageImpl ( bool  is_event,
DebugEvent  event,
bool  running,
Handle< JSObject exec_state,
Handle< JSObject event_data,
Handle< String response_json,
v8::Debug::ClientData client_data 
)
private

Definition at line 3149 of file debug.cc.

3156  : is_event_(is_event),
3157  event_(event),
3158  running_(running),
3159  exec_state_(exec_state),
3160  event_data_(event_data),
3161  response_json_(response_json),
3162  client_data_(client_data) {}
Handle< String > response_json_
Definition: debug.h:244
Handle< JSObject > event_data_
Definition: debug.h:243
Handle< JSObject > exec_state_
Definition: debug.h:242
v8::Debug::ClientData * client_data_
Definition: debug.h:245

Member Function Documentation

◆ GetClientData()

v8::Debug::ClientData * v8::internal::MessageImpl::GetClientData ( ) const
virtual

Client data passed with the corresponding request if any.

This is the client_data data value passed into Debug::SendCommand along with the request that led to the message or NULL if the message is an event. The debugger takes ownership of the data and will delete it even if there is no message handler.

Implements v8::Debug::Message.

Definition at line 3234 of file debug.cc.

3234  {
3235  return client_data_;
3236 }

References client_data_.

◆ GetEvent()

DebugEvent v8::internal::MessageImpl::GetEvent ( ) const
virtual

Implements v8::Debug::Message.

Definition at line 3175 of file debug.cc.

3175  {
3176  return event_;
3177 }

References event_.

◆ GetEventContext()

v8::Handle< v8::Context > v8::internal::MessageImpl::GetEventContext ( ) const
virtual

Get the context active when the debug event happened.

Note this is not the current active context as the JavaScript part of the debugger is running in its own context which is entered at this point.

Implements v8::Debug::Message.

Definition at line 3225 of file debug.cc.

3225  {
3226  Isolate* isolate = event_data_->GetIsolate();
3227  v8::Handle<v8::Context> context = GetDebugEventContext(isolate);
3228  // Isolate::context() may be NULL when "script collected" event occures.
3229  DCHECK(!context.IsEmpty());
3230  return context;
3231 }
bool IsEmpty() const
Returns true if the handle is empty.
Definition: v8.h:228
#define DCHECK(condition)
Definition: logging.h:205
static v8::Handle< v8::Context > GetDebugEventContext(Isolate *isolate)
Definition: debug.cc:52

References DCHECK, event_data_, v8::internal::GetDebugEventContext(), and v8::Handle< T >::IsEmpty().

+ Here is the call graph for this function:

◆ GetEventData()

v8::Handle< v8::Object > v8::internal::MessageImpl::GetEventData ( ) const
virtual

Implements v8::Debug::Message.

Definition at line 3195 of file debug.cc.

3195  {
3197 }
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)

References event_data_, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetExecutionState()

v8::Handle< v8::Object > v8::internal::MessageImpl::GetExecutionState ( ) const
virtual

Access to execution state and event data.

Don't store these cross callbacks as their content becomes invalid. These objects are from the debugger event that started the debug message loop.

Implements v8::Debug::Message.

Definition at line 3185 of file debug.cc.

3185  {
3187 }

References exec_state_, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetIsolate()

v8::Isolate * v8::internal::MessageImpl::GetIsolate ( ) const
virtual

Implements v8::Debug::Message.

Definition at line 3190 of file debug.cc.

3190  {
3191  return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate());
3192 }
Isolate represents an isolated instance of the V8 engine.
Definition: v8.h:4356

References exec_state_.

◆ GetJSON()

v8::Handle< v8::String > v8::internal::MessageImpl::GetJSON ( ) const
virtual

Get the debugger protocol JSON.

Implements v8::Debug::Message.

Definition at line 3200 of file debug.cc.

3200  {
3201  Isolate* isolate = event_data_->GetIsolate();
3202  v8::EscapableHandleScope scope(reinterpret_cast<v8::Isolate*>(isolate));
3203 
3204  if (IsEvent()) {
3205  // Call toJSONProtocol on the debug event object.
3206  Handle<Object> fun = Object::GetProperty(
3207  isolate, event_data_, "toJSONProtocol").ToHandleChecked();
3208  if (!fun->IsJSFunction()) {
3209  return v8::Handle<v8::String>();
3210  }
3211 
3212  MaybeHandle<Object> maybe_json =
3213  Execution::TryCall(Handle<JSFunction>::cast(fun), event_data_, 0, NULL);
3214  Handle<Object> json;
3215  if (!maybe_json.ToHandle(&json) || !json->IsString()) {
3216  return v8::Handle<v8::String>();
3217  }
3218  return scope.Escape(v8::Utils::ToLocal(Handle<String>::cast(json)));
3219  } else {
3221  }
3222 }
A HandleScope which first allocates a handle in the current scope which will be later filled with the...
Definition: v8.h:855
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
virtual bool IsEvent() const
Check type of message.
Definition: debug.cc:3165
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
Definition: objects.cc:109
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References v8::EscapableHandleScope::Escape(), event_data_, v8::internal::Object::GetProperty(), IsEvent(), NULL, response_json_, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ IsEvent()

bool v8::internal::MessageImpl::IsEvent ( ) const
virtual

Check type of message.

Implements v8::Debug::Message.

Definition at line 3165 of file debug.cc.

3165  {
3166  return is_event_;
3167 }

References is_event_.

Referenced by GetJSON().

+ Here is the caller graph for this function:

◆ IsResponse()

bool v8::internal::MessageImpl::IsResponse ( ) const
virtual

Implements v8::Debug::Message.

Definition at line 3170 of file debug.cc.

3170  {
3171  return !is_event_;
3172 }

References is_event_.

◆ NewEvent()

MessageImpl v8::internal::MessageImpl::NewEvent ( DebugEvent  event,
bool  running,
Handle< JSObject exec_state,
Handle< JSObject event_data 
)
static

Definition at line 3127 of file debug.cc.

3130  {
3131  MessageImpl message(true, event, running,
3132  exec_state, event_data, Handle<String>(), NULL);
3133  return message;
3134 }
MessageImpl(bool is_event, DebugEvent event, bool running, Handle< JSObject > exec_state, Handle< JSObject > event_data, Handle< String > response_json, v8::Debug::ClientData *client_data)
Definition: debug.cc:3149

References NULL.

Referenced by v8::internal::Debug::NotifyMessageHandler().

+ Here is the caller graph for this function:

◆ NewResponse()

MessageImpl v8::internal::MessageImpl::NewResponse ( DebugEvent  event,
bool  running,
Handle< JSObject exec_state,
Handle< JSObject event_data,
Handle< String response_json,
v8::Debug::ClientData client_data 
)
static

Definition at line 3137 of file debug.cc.

3142  {
3143  MessageImpl message(false, event, running,
3144  exec_state, event_data, response_json, client_data);
3145  return message;
3146 }

Referenced by v8::internal::Debug::NotifyMessageHandler().

+ Here is the caller graph for this function:

◆ WillStartRunning()

bool v8::internal::MessageImpl::WillStartRunning ( ) const
virtual

Indicate whether this is a response to a continue command which will start the VM running after this is processed.

Implements v8::Debug::Message.

Definition at line 3180 of file debug.cc.

3180  {
3181  return running_;
3182 }

References running_.

Member Data Documentation

◆ client_data_

v8::Debug::ClientData* v8::internal::MessageImpl::client_data_
private

Definition at line 245 of file debug.h.

Referenced by GetClientData().

◆ event_

DebugEvent v8::internal::MessageImpl::event_
private

Definition at line 240 of file debug.h.

Referenced by GetEvent().

◆ event_data_

Handle<JSObject> v8::internal::MessageImpl::event_data_
private

Definition at line 243 of file debug.h.

Referenced by GetEventContext(), GetEventData(), and GetJSON().

◆ exec_state_

Handle<JSObject> v8::internal::MessageImpl::exec_state_
private

Definition at line 242 of file debug.h.

Referenced by GetExecutionState(), and GetIsolate().

◆ is_event_

bool v8::internal::MessageImpl::is_event_
private

Definition at line 239 of file debug.h.

Referenced by IsEvent(), and IsResponse().

◆ response_json_

Handle<String> v8::internal::MessageImpl::response_json_
private

Definition at line 244 of file debug.h.

Referenced by GetJSON().

◆ running_

bool v8::internal::MessageImpl::running_
private

Definition at line 241 of file debug.h.

Referenced by WillStartRunning().


The documentation for this class was generated from the following files: