libv8 5.7.492.65.1-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/libv8/.location.yml +1 -0
- data/ext/libv8/arch.rb +20 -0
- data/ext/libv8/location.rb +89 -0
- data/ext/libv8/paths.rb +41 -0
- data/lib/libv8.rb +9 -0
- data/lib/libv8/version.rb +3 -0
- data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
- data/vendor/v8/include/libplatform/libplatform.h +60 -0
- data/vendor/v8/include/libplatform/v8-tracing.h +270 -0
- data/vendor/v8/include/v8-debug.h +293 -0
- data/vendor/v8/include/v8-experimental.h +58 -0
- data/vendor/v8/include/v8-inspector-protocol.h +13 -0
- data/vendor/v8/include/v8-inspector.h +267 -0
- data/vendor/v8/include/v8-platform.h +219 -0
- data/vendor/v8/include/v8-profiler.h +897 -0
- data/vendor/v8/include/v8-testing.h +48 -0
- data/vendor/v8/include/v8-util.h +654 -0
- data/vendor/v8/include/v8-version-string.h +33 -0
- data/vendor/v8/include/v8-version.h +20 -0
- data/vendor/v8/include/v8.h +9866 -0
- data/vendor/v8/include/v8config.h +428 -0
- data/vendor/v8/out/arm64.release/libv8_base.a +0 -0
- data/vendor/v8/out/arm64.release/libv8_libbase.a +0 -0
- data/vendor/v8/out/arm64.release/libv8_libplatform.a +0 -0
- data/vendor/v8/out/arm64.release/libv8_libsampler.a +0 -0
- data/vendor/v8/out/arm64.release/libv8_nosnapshot.a +0 -0
- data/vendor/v8/out/arm64.release/libv8_snapshot.a +0 -0
- data/vendor/v8/out/arm64.release/obj.target/src/libv8_base.a +0 -0
- data/vendor/v8/out/arm64.release/obj.target/src/libv8_libbase.a +0 -0
- data/vendor/v8/out/arm64.release/obj.target/src/libv8_libplatform.a +0 -0
- data/vendor/v8/out/arm64.release/obj.target/src/libv8_libsampler.a +0 -0
- data/vendor/v8/out/arm64.release/obj.target/src/libv8_nosnapshot.a +0 -0
- data/vendor/v8/out/arm64.release/obj.target/src/libv8_snapshot.a +0 -0
- metadata +121 -0
@@ -0,0 +1,293 @@
|
|
1
|
+
// Copyright 2008 the V8 project authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
#ifndef V8_V8_DEBUG_H_
|
6
|
+
#define V8_V8_DEBUG_H_
|
7
|
+
|
8
|
+
#include "v8.h" // NOLINT(build/include)
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Debugger support for the V8 JavaScript engine.
|
12
|
+
*/
|
13
|
+
namespace v8 {
|
14
|
+
|
15
|
+
// Debug events which can occur in the V8 JavaScript engine.
|
16
|
+
enum DebugEvent {
|
17
|
+
Break = 1,
|
18
|
+
Exception = 2,
|
19
|
+
AfterCompile = 3,
|
20
|
+
CompileError = 4,
|
21
|
+
AsyncTaskEvent = 5,
|
22
|
+
};
|
23
|
+
|
24
|
+
class V8_EXPORT Debug {
|
25
|
+
public:
|
26
|
+
/**
|
27
|
+
* A client object passed to the v8 debugger whose ownership will be taken by
|
28
|
+
* it. v8 is always responsible for deleting the object.
|
29
|
+
*/
|
30
|
+
class ClientData {
|
31
|
+
public:
|
32
|
+
virtual ~ClientData() {}
|
33
|
+
};
|
34
|
+
|
35
|
+
|
36
|
+
/**
|
37
|
+
* A message object passed to the debug message handler.
|
38
|
+
*/
|
39
|
+
class Message {
|
40
|
+
public:
|
41
|
+
/**
|
42
|
+
* Check type of message.
|
43
|
+
*/
|
44
|
+
virtual bool IsEvent() const = 0;
|
45
|
+
virtual bool IsResponse() const = 0;
|
46
|
+
virtual DebugEvent GetEvent() const = 0;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Indicate whether this is a response to a continue command which will
|
50
|
+
* start the VM running after this is processed.
|
51
|
+
*/
|
52
|
+
virtual bool WillStartRunning() const = 0;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Access to execution state and event data. Don't store these cross
|
56
|
+
* callbacks as their content becomes invalid. These objects are from the
|
57
|
+
* debugger event that started the debug message loop.
|
58
|
+
*/
|
59
|
+
virtual Local<Object> GetExecutionState() const = 0;
|
60
|
+
virtual Local<Object> GetEventData() const = 0;
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Get the debugger protocol JSON.
|
64
|
+
*/
|
65
|
+
virtual Local<String> GetJSON() const = 0;
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Get the context active when the debug event happened. Note this is not
|
69
|
+
* the current active context as the JavaScript part of the debugger is
|
70
|
+
* running in its own context which is entered at this point.
|
71
|
+
*/
|
72
|
+
virtual Local<Context> GetEventContext() const = 0;
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Client data passed with the corresponding request if any. This is the
|
76
|
+
* client_data data value passed into Debug::SendCommand along with the
|
77
|
+
* request that led to the message or NULL if the message is an event. The
|
78
|
+
* debugger takes ownership of the data and will delete it even if there is
|
79
|
+
* no message handler.
|
80
|
+
*/
|
81
|
+
virtual ClientData* GetClientData() const = 0;
|
82
|
+
|
83
|
+
virtual Isolate* GetIsolate() const = 0;
|
84
|
+
|
85
|
+
virtual ~Message() {}
|
86
|
+
};
|
87
|
+
|
88
|
+
/**
|
89
|
+
* An event details object passed to the debug event listener.
|
90
|
+
*/
|
91
|
+
class EventDetails {
|
92
|
+
public:
|
93
|
+
/**
|
94
|
+
* Event type.
|
95
|
+
*/
|
96
|
+
virtual DebugEvent GetEvent() const = 0;
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Access to execution state and event data of the debug event. Don't store
|
100
|
+
* these cross callbacks as their content becomes invalid.
|
101
|
+
*/
|
102
|
+
virtual Local<Object> GetExecutionState() const = 0;
|
103
|
+
virtual Local<Object> GetEventData() const = 0;
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Get the context active when the debug event happened. Note this is not
|
107
|
+
* the current active context as the JavaScript part of the debugger is
|
108
|
+
* running in its own context which is entered at this point.
|
109
|
+
*/
|
110
|
+
virtual Local<Context> GetEventContext() const = 0;
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Client data passed with the corresponding callback when it was
|
114
|
+
* registered.
|
115
|
+
*/
|
116
|
+
virtual Local<Value> GetCallbackData() const = 0;
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Client data passed to DebugBreakForCommand function. The
|
120
|
+
* debugger takes ownership of the data and will delete it even if
|
121
|
+
* there is no message handler.
|
122
|
+
*/
|
123
|
+
virtual ClientData* GetClientData() const = 0;
|
124
|
+
|
125
|
+
virtual Isolate* GetIsolate() const = 0;
|
126
|
+
|
127
|
+
virtual ~EventDetails() {}
|
128
|
+
};
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Debug event callback function.
|
132
|
+
*
|
133
|
+
* \param event_details object providing information about the debug event
|
134
|
+
*
|
135
|
+
* A EventCallback2 does not take possession of the event data,
|
136
|
+
* and must not rely on the data persisting after the handler returns.
|
137
|
+
*/
|
138
|
+
typedef void (*EventCallback)(const EventDetails& event_details);
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Debug message callback function.
|
142
|
+
*
|
143
|
+
* \param message the debug message handler message object
|
144
|
+
*
|
145
|
+
* A MessageHandler does not take possession of the message data,
|
146
|
+
* and must not rely on the data persisting after the handler returns.
|
147
|
+
*/
|
148
|
+
typedef void (*MessageHandler)(const Message& message);
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Callback function for the host to ensure debug messages are processed.
|
152
|
+
*/
|
153
|
+
typedef void (*DebugMessageDispatchHandler)();
|
154
|
+
|
155
|
+
static bool SetDebugEventListener(Isolate* isolate, EventCallback that,
|
156
|
+
Local<Value> data = Local<Value>());
|
157
|
+
|
158
|
+
// Schedule a debugger break to happen when JavaScript code is run
|
159
|
+
// in the given isolate.
|
160
|
+
static void DebugBreak(Isolate* isolate);
|
161
|
+
|
162
|
+
// Remove scheduled debugger break in given isolate if it has not
|
163
|
+
// happened yet.
|
164
|
+
static void CancelDebugBreak(Isolate* isolate);
|
165
|
+
|
166
|
+
// Check if a debugger break is scheduled in the given isolate.
|
167
|
+
V8_DEPRECATED("No longer supported",
|
168
|
+
static bool CheckDebugBreak(Isolate* isolate));
|
169
|
+
|
170
|
+
// Message based interface. The message protocol is JSON.
|
171
|
+
V8_DEPRECATED("No longer supported",
|
172
|
+
static void SetMessageHandler(Isolate* isolate,
|
173
|
+
MessageHandler handler));
|
174
|
+
|
175
|
+
V8_DEPRECATED("No longer supported",
|
176
|
+
static void SendCommand(Isolate* isolate,
|
177
|
+
const uint16_t* command, int length,
|
178
|
+
ClientData* client_data = NULL));
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Run a JavaScript function in the debugger.
|
182
|
+
* \param fun the function to call
|
183
|
+
* \param data passed as second argument to the function
|
184
|
+
* With this call the debugger is entered and the function specified is called
|
185
|
+
* with the execution state as the first argument. This makes it possible to
|
186
|
+
* get access to information otherwise not available during normal JavaScript
|
187
|
+
* execution e.g. details on stack frames. Receiver of the function call will
|
188
|
+
* be the debugger context global object, however this is a subject to change.
|
189
|
+
* The following example shows a JavaScript function which when passed to
|
190
|
+
* v8::Debug::Call will return the current line of JavaScript execution.
|
191
|
+
*
|
192
|
+
* \code
|
193
|
+
* function frame_source_line(exec_state) {
|
194
|
+
* return exec_state.frame(0).sourceLine();
|
195
|
+
* }
|
196
|
+
* \endcode
|
197
|
+
*/
|
198
|
+
// TODO(dcarney): data arg should be a MaybeLocal
|
199
|
+
static MaybeLocal<Value> Call(Local<Context> context,
|
200
|
+
v8::Local<v8::Function> fun,
|
201
|
+
Local<Value> data = Local<Value>());
|
202
|
+
|
203
|
+
/**
|
204
|
+
* Returns a mirror object for the given object.
|
205
|
+
*/
|
206
|
+
V8_DEPRECATED("No longer supported",
|
207
|
+
static MaybeLocal<Value> GetMirror(Local<Context> context,
|
208
|
+
v8::Local<v8::Value> obj));
|
209
|
+
|
210
|
+
/**
|
211
|
+
* Makes V8 process all pending debug messages.
|
212
|
+
*
|
213
|
+
* From V8 point of view all debug messages come asynchronously (e.g. from
|
214
|
+
* remote debugger) but they all must be handled synchronously: V8 cannot
|
215
|
+
* do 2 things at one time so normal script execution must be interrupted
|
216
|
+
* for a while.
|
217
|
+
*
|
218
|
+
* Generally when message arrives V8 may be in one of 3 states:
|
219
|
+
* 1. V8 is running script; V8 will automatically interrupt and process all
|
220
|
+
* pending messages;
|
221
|
+
* 2. V8 is suspended on debug breakpoint; in this state V8 is dedicated
|
222
|
+
* to reading and processing debug messages;
|
223
|
+
* 3. V8 is not running at all or has called some long-working C++ function;
|
224
|
+
* by default it means that processing of all debug messages will be deferred
|
225
|
+
* until V8 gets control again; however, embedding application may improve
|
226
|
+
* this by manually calling this method.
|
227
|
+
*
|
228
|
+
* Technically this method in many senses is equivalent to executing empty
|
229
|
+
* script:
|
230
|
+
* 1. It does nothing except for processing all pending debug messages.
|
231
|
+
* 2. It should be invoked with the same precautions and from the same context
|
232
|
+
* as V8 script would be invoked from, because:
|
233
|
+
* a. with "evaluate" command it can do whatever normal script can do,
|
234
|
+
* including all native calls;
|
235
|
+
* b. no other thread should call V8 while this method is running
|
236
|
+
* (v8::Locker may be used here).
|
237
|
+
*
|
238
|
+
* "Evaluate" debug command behavior currently is not specified in scope
|
239
|
+
* of this method.
|
240
|
+
*/
|
241
|
+
V8_DEPRECATED("No longer supported",
|
242
|
+
static void ProcessDebugMessages(Isolate* isolate));
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Debugger is running in its own context which is entered while debugger
|
246
|
+
* messages are being dispatched. This is an explicit getter for this
|
247
|
+
* debugger context. Note that the content of the debugger context is subject
|
248
|
+
* to change. The Context exists only when the debugger is active, i.e. at
|
249
|
+
* least one DebugEventListener or MessageHandler is set.
|
250
|
+
*/
|
251
|
+
V8_DEPRECATED("Use v8-inspector",
|
252
|
+
static Local<Context> GetDebugContext(Isolate* isolate));
|
253
|
+
|
254
|
+
/**
|
255
|
+
* While in the debug context, this method returns the top-most non-debug
|
256
|
+
* context, if it exists.
|
257
|
+
*/
|
258
|
+
V8_DEPRECATED(
|
259
|
+
"No longer supported",
|
260
|
+
static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate));
|
261
|
+
|
262
|
+
/**
|
263
|
+
* Enable/disable LiveEdit functionality for the given Isolate
|
264
|
+
* (default Isolate if not provided). V8 will abort if LiveEdit is
|
265
|
+
* unexpectedly used. LiveEdit is enabled by default.
|
266
|
+
*/
|
267
|
+
static void SetLiveEditEnabled(Isolate* isolate, bool enable);
|
268
|
+
|
269
|
+
/**
|
270
|
+
* Returns array of internal properties specific to the value type. Result has
|
271
|
+
* the following format: [<name>, <value>,...,<name>, <value>]. Result array
|
272
|
+
* will be allocated in the current context.
|
273
|
+
*/
|
274
|
+
static MaybeLocal<Array> GetInternalProperties(Isolate* isolate,
|
275
|
+
Local<Value> value);
|
276
|
+
|
277
|
+
/**
|
278
|
+
* Defines if the ES2015 tail call elimination feature is enabled or not.
|
279
|
+
* The change of this flag triggers deoptimization of all functions that
|
280
|
+
* contain calls at tail position.
|
281
|
+
*/
|
282
|
+
static bool IsTailCallEliminationEnabled(Isolate* isolate);
|
283
|
+
static void SetTailCallEliminationEnabled(Isolate* isolate, bool enabled);
|
284
|
+
};
|
285
|
+
|
286
|
+
|
287
|
+
} // namespace v8
|
288
|
+
|
289
|
+
|
290
|
+
#undef EXPORT
|
291
|
+
|
292
|
+
|
293
|
+
#endif // V8_V8_DEBUG_H_
|
@@ -0,0 +1,58 @@
|
|
1
|
+
// Copyright 2015 the V8 project authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
/**
|
6
|
+
* This header contains a set of experimental V8 APIs. We hope these will
|
7
|
+
* become a part of standard V8, but they may also be removed if we deem the
|
8
|
+
* experiment to not be successul.
|
9
|
+
*/
|
10
|
+
#ifndef V8_INCLUDE_V8_EXPERIMENTAL_H_
|
11
|
+
#define V8_INCLUDE_V8_EXPERIMENTAL_H_
|
12
|
+
|
13
|
+
#include "v8.h" // NOLINT(build/include)
|
14
|
+
|
15
|
+
namespace v8 {
|
16
|
+
namespace experimental {
|
17
|
+
|
18
|
+
// Allow the embedder to construct accessors that V8 can compile and use
|
19
|
+
// directly, without jumping into the runtime.
|
20
|
+
class V8_EXPORT FastAccessorBuilder {
|
21
|
+
public:
|
22
|
+
struct ValueId {
|
23
|
+
size_t value_id;
|
24
|
+
};
|
25
|
+
struct LabelId {
|
26
|
+
size_t label_id;
|
27
|
+
};
|
28
|
+
|
29
|
+
static FastAccessorBuilder* New(Isolate* isolate);
|
30
|
+
|
31
|
+
ValueId IntegerConstant(int int_constant);
|
32
|
+
ValueId GetReceiver();
|
33
|
+
ValueId LoadInternalField(ValueId value_id, int field_no);
|
34
|
+
ValueId LoadInternalFieldUnchecked(ValueId value_id, int field_no);
|
35
|
+
ValueId LoadValue(ValueId value_id, int offset);
|
36
|
+
ValueId LoadObject(ValueId value_id, int offset);
|
37
|
+
ValueId ToSmi(ValueId value_id);
|
38
|
+
|
39
|
+
void ReturnValue(ValueId value_id);
|
40
|
+
void CheckFlagSetOrReturnNull(ValueId value_id, int mask);
|
41
|
+
void CheckNotZeroOrReturnNull(ValueId value_id);
|
42
|
+
LabelId MakeLabel();
|
43
|
+
void SetLabel(LabelId label_id);
|
44
|
+
void Goto(LabelId label_id);
|
45
|
+
void CheckNotZeroOrJump(ValueId value_id, LabelId label_id);
|
46
|
+
ValueId Call(v8::FunctionCallback callback, ValueId value_id);
|
47
|
+
|
48
|
+
private:
|
49
|
+
FastAccessorBuilder() = delete;
|
50
|
+
FastAccessorBuilder(const FastAccessorBuilder&) = delete;
|
51
|
+
~FastAccessorBuilder() = delete;
|
52
|
+
void operator=(const FastAccessorBuilder&) = delete;
|
53
|
+
};
|
54
|
+
|
55
|
+
} // namespace experimental
|
56
|
+
} // namespace v8
|
57
|
+
|
58
|
+
#endif // V8_INCLUDE_V8_EXPERIMENTAL_H_
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Copyright 2016 the V8 project authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
#ifndef V8_V8_INSPECTOR_PROTOCOL_H_
|
6
|
+
#define V8_V8_INSPECTOR_PROTOCOL_H_
|
7
|
+
|
8
|
+
#include "inspector/Debugger.h" // NOLINT(build/include)
|
9
|
+
#include "inspector/Runtime.h" // NOLINT(build/include)
|
10
|
+
#include "inspector/Schema.h" // NOLINT(build/include)
|
11
|
+
#include "v8-inspector.h" // NOLINT(build/include)
|
12
|
+
|
13
|
+
#endif // V8_V8_INSPECTOR_PROTOCOL_H_
|
@@ -0,0 +1,267 @@
|
|
1
|
+
// Copyright 2016 the V8 project authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
#ifndef V8_V8_INSPECTOR_H_
|
6
|
+
#define V8_V8_INSPECTOR_H_
|
7
|
+
|
8
|
+
#include <stdint.h>
|
9
|
+
#include <cctype>
|
10
|
+
|
11
|
+
#include <memory>
|
12
|
+
|
13
|
+
#include "v8.h" // NOLINT(build/include)
|
14
|
+
|
15
|
+
namespace v8_inspector {
|
16
|
+
|
17
|
+
namespace protocol {
|
18
|
+
namespace Debugger {
|
19
|
+
namespace API {
|
20
|
+
class SearchMatch;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
namespace Runtime {
|
24
|
+
namespace API {
|
25
|
+
class RemoteObject;
|
26
|
+
class StackTrace;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
namespace Schema {
|
30
|
+
namespace API {
|
31
|
+
class Domain;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
} // namespace protocol
|
35
|
+
|
36
|
+
class V8_EXPORT StringView {
|
37
|
+
public:
|
38
|
+
StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {}
|
39
|
+
|
40
|
+
StringView(const uint8_t* characters, size_t length)
|
41
|
+
: m_is8Bit(true), m_length(length), m_characters8(characters) {}
|
42
|
+
|
43
|
+
StringView(const uint16_t* characters, size_t length)
|
44
|
+
: m_is8Bit(false), m_length(length), m_characters16(characters) {}
|
45
|
+
|
46
|
+
bool is8Bit() const { return m_is8Bit; }
|
47
|
+
size_t length() const { return m_length; }
|
48
|
+
|
49
|
+
// TODO(dgozman): add DCHECK(m_is8Bit) to accessors once platform can be used
|
50
|
+
// here.
|
51
|
+
const uint8_t* characters8() const { return m_characters8; }
|
52
|
+
const uint16_t* characters16() const { return m_characters16; }
|
53
|
+
|
54
|
+
private:
|
55
|
+
bool m_is8Bit;
|
56
|
+
size_t m_length;
|
57
|
+
union {
|
58
|
+
const uint8_t* m_characters8;
|
59
|
+
const uint16_t* m_characters16;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
|
63
|
+
class V8_EXPORT StringBuffer {
|
64
|
+
public:
|
65
|
+
virtual ~StringBuffer() {}
|
66
|
+
virtual const StringView& string() = 0;
|
67
|
+
// This method copies contents.
|
68
|
+
static std::unique_ptr<StringBuffer> create(const StringView&);
|
69
|
+
};
|
70
|
+
|
71
|
+
class V8_EXPORT V8ContextInfo {
|
72
|
+
public:
|
73
|
+
V8ContextInfo(v8::Local<v8::Context> context, int contextGroupId,
|
74
|
+
const StringView& humanReadableName)
|
75
|
+
: context(context),
|
76
|
+
contextGroupId(contextGroupId),
|
77
|
+
humanReadableName(humanReadableName),
|
78
|
+
hasMemoryOnConsole(false) {}
|
79
|
+
|
80
|
+
v8::Local<v8::Context> context;
|
81
|
+
// Each v8::Context is a part of a group. The group id must be non-zero.
|
82
|
+
int contextGroupId;
|
83
|
+
StringView humanReadableName;
|
84
|
+
StringView origin;
|
85
|
+
StringView auxData;
|
86
|
+
bool hasMemoryOnConsole;
|
87
|
+
|
88
|
+
private:
|
89
|
+
// Disallow copying and allocating this one.
|
90
|
+
enum NotNullTagEnum { NotNullLiteral };
|
91
|
+
void* operator new(size_t) = delete;
|
92
|
+
void* operator new(size_t, NotNullTagEnum, void*) = delete;
|
93
|
+
void* operator new(size_t, void*) = delete;
|
94
|
+
V8ContextInfo(const V8ContextInfo&) = delete;
|
95
|
+
V8ContextInfo& operator=(const V8ContextInfo&) = delete;
|
96
|
+
};
|
97
|
+
|
98
|
+
class V8_EXPORT V8StackTrace {
|
99
|
+
public:
|
100
|
+
virtual bool isEmpty() const = 0;
|
101
|
+
virtual StringView topSourceURL() const = 0;
|
102
|
+
virtual int topLineNumber() const = 0;
|
103
|
+
virtual int topColumnNumber() const = 0;
|
104
|
+
virtual StringView topScriptId() const = 0;
|
105
|
+
virtual StringView topFunctionName() const = 0;
|
106
|
+
|
107
|
+
virtual ~V8StackTrace() {}
|
108
|
+
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
109
|
+
buildInspectorObject() const = 0;
|
110
|
+
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
111
|
+
|
112
|
+
// Safe to pass between threads, drops async chain.
|
113
|
+
virtual std::unique_ptr<V8StackTrace> clone() = 0;
|
114
|
+
};
|
115
|
+
|
116
|
+
class V8_EXPORT V8InspectorSession {
|
117
|
+
public:
|
118
|
+
virtual ~V8InspectorSession() {}
|
119
|
+
|
120
|
+
// Cross-context inspectable values (DOM nodes in different worlds, etc.).
|
121
|
+
class V8_EXPORT Inspectable {
|
122
|
+
public:
|
123
|
+
virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0;
|
124
|
+
virtual ~Inspectable() {}
|
125
|
+
};
|
126
|
+
virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0;
|
127
|
+
|
128
|
+
// Dispatching protocol messages.
|
129
|
+
static bool canDispatchMethod(const StringView& method);
|
130
|
+
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
131
|
+
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
132
|
+
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
133
|
+
supportedDomains() = 0;
|
134
|
+
|
135
|
+
// Debugger actions.
|
136
|
+
virtual void schedulePauseOnNextStatement(const StringView& breakReason,
|
137
|
+
const StringView& breakDetails) = 0;
|
138
|
+
virtual void cancelPauseOnNextStatement() = 0;
|
139
|
+
virtual void breakProgram(const StringView& breakReason,
|
140
|
+
const StringView& breakDetails) = 0;
|
141
|
+
virtual void setSkipAllPauses(bool) = 0;
|
142
|
+
virtual void resume() = 0;
|
143
|
+
virtual void stepOver() = 0;
|
144
|
+
virtual std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>>
|
145
|
+
searchInTextByLines(const StringView& text, const StringView& query,
|
146
|
+
bool caseSensitive, bool isRegex) = 0;
|
147
|
+
|
148
|
+
// Remote objects.
|
149
|
+
virtual std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(
|
150
|
+
v8::Local<v8::Context>, v8::Local<v8::Value>,
|
151
|
+
const StringView& groupName) = 0;
|
152
|
+
virtual bool unwrapObject(std::unique_ptr<StringBuffer>* error,
|
153
|
+
const StringView& objectId, v8::Local<v8::Value>*,
|
154
|
+
v8::Local<v8::Context>*,
|
155
|
+
std::unique_ptr<StringBuffer>* objectGroup) = 0;
|
156
|
+
virtual void releaseObjectGroup(const StringView&) = 0;
|
157
|
+
};
|
158
|
+
|
159
|
+
enum class V8ConsoleAPIType { kClear, kDebug, kLog, kInfo, kWarning, kError };
|
160
|
+
|
161
|
+
class V8_EXPORT V8InspectorClient {
|
162
|
+
public:
|
163
|
+
virtual ~V8InspectorClient() {}
|
164
|
+
|
165
|
+
virtual void runMessageLoopOnPause(int contextGroupId) {}
|
166
|
+
virtual void quitMessageLoopOnPause() {}
|
167
|
+
virtual void runIfWaitingForDebugger(int contextGroupId) {}
|
168
|
+
|
169
|
+
virtual void muteMetrics(int contextGroupId) {}
|
170
|
+
virtual void unmuteMetrics(int contextGroupId) {}
|
171
|
+
|
172
|
+
virtual void beginUserGesture() {}
|
173
|
+
virtual void endUserGesture() {}
|
174
|
+
|
175
|
+
virtual std::unique_ptr<StringBuffer> valueSubtype(v8::Local<v8::Value>) {
|
176
|
+
return nullptr;
|
177
|
+
}
|
178
|
+
virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) {
|
179
|
+
return false;
|
180
|
+
}
|
181
|
+
virtual bool isInspectableHeapObject(v8::Local<v8::Object>) { return true; }
|
182
|
+
|
183
|
+
virtual v8::Local<v8::Context> ensureDefaultContextInGroup(
|
184
|
+
int contextGroupId) {
|
185
|
+
return v8::Local<v8::Context>();
|
186
|
+
}
|
187
|
+
virtual void beginEnsureAllContextsInGroup(int contextGroupId) {}
|
188
|
+
virtual void endEnsureAllContextsInGroup(int contextGroupId) {}
|
189
|
+
|
190
|
+
virtual void installAdditionalCommandLineAPI(v8::Local<v8::Context>,
|
191
|
+
v8::Local<v8::Object>) {}
|
192
|
+
virtual void consoleAPIMessage(int contextGroupId, V8ConsoleAPIType,
|
193
|
+
const StringView& message,
|
194
|
+
const StringView& url, unsigned lineNumber,
|
195
|
+
unsigned columnNumber, V8StackTrace*) {}
|
196
|
+
virtual v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*,
|
197
|
+
v8::Local<v8::Context>) {
|
198
|
+
return v8::MaybeLocal<v8::Value>();
|
199
|
+
}
|
200
|
+
|
201
|
+
virtual void consoleTime(const StringView& title) {}
|
202
|
+
virtual void consoleTimeEnd(const StringView& title) {}
|
203
|
+
virtual void consoleTimeStamp(const StringView& title) {}
|
204
|
+
virtual double currentTimeMS() { return 0; }
|
205
|
+
typedef void (*TimerCallback)(void*);
|
206
|
+
virtual void startRepeatingTimer(double, TimerCallback, void* data) {}
|
207
|
+
virtual void cancelTimer(void* data) {}
|
208
|
+
|
209
|
+
// TODO(dgozman): this was added to support service worker shadow page. We
|
210
|
+
// should not connect at all.
|
211
|
+
virtual bool canExecuteScripts(int contextGroupId) { return true; }
|
212
|
+
};
|
213
|
+
|
214
|
+
class V8_EXPORT V8Inspector {
|
215
|
+
public:
|
216
|
+
static std::unique_ptr<V8Inspector> create(v8::Isolate*, V8InspectorClient*);
|
217
|
+
virtual ~V8Inspector() {}
|
218
|
+
|
219
|
+
// Contexts instrumentation.
|
220
|
+
virtual void contextCreated(const V8ContextInfo&) = 0;
|
221
|
+
virtual void contextDestroyed(v8::Local<v8::Context>) = 0;
|
222
|
+
virtual void resetContextGroup(int contextGroupId) = 0;
|
223
|
+
|
224
|
+
// Various instrumentation.
|
225
|
+
virtual void willExecuteScript(v8::Local<v8::Context>, int scriptId) = 0;
|
226
|
+
virtual void didExecuteScript(v8::Local<v8::Context>) = 0;
|
227
|
+
virtual void idleStarted() = 0;
|
228
|
+
virtual void idleFinished() = 0;
|
229
|
+
|
230
|
+
// Async stack traces instrumentation.
|
231
|
+
virtual void asyncTaskScheduled(const StringView& taskName, void* task,
|
232
|
+
bool recurring) = 0;
|
233
|
+
virtual void asyncTaskCanceled(void* task) = 0;
|
234
|
+
virtual void asyncTaskStarted(void* task) = 0;
|
235
|
+
virtual void asyncTaskFinished(void* task) = 0;
|
236
|
+
virtual void allAsyncTasksCanceled() = 0;
|
237
|
+
|
238
|
+
// Exceptions instrumentation.
|
239
|
+
virtual unsigned exceptionThrown(
|
240
|
+
v8::Local<v8::Context>, const StringView& message,
|
241
|
+
v8::Local<v8::Value> exception, const StringView& detailedMessage,
|
242
|
+
const StringView& url, unsigned lineNumber, unsigned columnNumber,
|
243
|
+
std::unique_ptr<V8StackTrace>, int scriptId) = 0;
|
244
|
+
virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId,
|
245
|
+
const StringView& message) = 0;
|
246
|
+
|
247
|
+
// Connection.
|
248
|
+
class V8_EXPORT Channel {
|
249
|
+
public:
|
250
|
+
virtual ~Channel() {}
|
251
|
+
virtual void sendResponse(int callId,
|
252
|
+
std::unique_ptr<StringBuffer> message) = 0;
|
253
|
+
virtual void sendNotification(std::unique_ptr<StringBuffer> message) = 0;
|
254
|
+
virtual void flushProtocolNotifications() = 0;
|
255
|
+
};
|
256
|
+
virtual std::unique_ptr<V8InspectorSession> connect(
|
257
|
+
int contextGroupId, Channel*, const StringView& state) = 0;
|
258
|
+
|
259
|
+
// API methods.
|
260
|
+
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
261
|
+
v8::Local<v8::StackTrace>) = 0;
|
262
|
+
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
263
|
+
};
|
264
|
+
|
265
|
+
} // namespace v8_inspector
|
266
|
+
|
267
|
+
#endif // V8_V8_INSPECTOR_H_
|