libv8 5.7.492.65.1-universal-darwin-16 → 5.9.211.38.0beta0-universal-darwin-16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/libv8/version.rb +1 -1
- data/vendor/v8/include/libplatform/libplatform.h +7 -1
- data/vendor/v8/include/v8-debug.h +29 -67
- data/vendor/v8/include/v8-inspector.h +5 -5
- data/vendor/v8/include/v8-platform.h +8 -0
- data/vendor/v8/include/v8-profiler.h +22 -7
- data/vendor/v8/include/v8-util.h +2 -1
- data/vendor/v8/include/v8-version.h +3 -3
- data/vendor/v8/include/v8.h +468 -267
- data/vendor/v8/out/x64.release/libv8_base.a +0 -0
- data/vendor/v8/out/x64.release/libv8_libbase.a +0 -0
- data/vendor/v8/out/x64.release/libv8_libplatform.a +0 -0
- data/vendor/v8/out/x64.release/libv8_nosnapshot.a +0 -0
- data/vendor/v8/out/x64.release/libv8_snapshot.a +0 -0
- metadata +6 -7
- data/vendor/v8/include/v8-experimental.h +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: deda9834f7470b62e53febbe9543ba699b0cd084
|
4
|
+
data.tar.gz: c44a57e4a5e6d81c8dae4358f61c38e4099e7e3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e46494e7ce8bb4a9cd27daca71bf250bf67e81104dbb9b5335ba95be9be4d981f56ccde53439de44fa58f7c2a3fe81124420caed7f6a491bd4ba2c0eeab16a1c
|
7
|
+
data.tar.gz: 1bda44d95abb70a004927e7119bb63e5241f527178353369eac448e1a6e63ff7766936148cb721f198a0f1cab25d147705c42a1f411902de96366797a9b57421
|
data/lib/libv8/version.rb
CHANGED
@@ -12,6 +12,8 @@
|
|
12
12
|
namespace v8 {
|
13
13
|
namespace platform {
|
14
14
|
|
15
|
+
enum class IdleTaskSupport { kDisabled, kEnabled };
|
16
|
+
|
15
17
|
/**
|
16
18
|
* Returns a new instance of the default v8::Platform implementation.
|
17
19
|
*
|
@@ -19,9 +21,13 @@ namespace platform {
|
|
19
21
|
* is the number of worker threads to allocate for background jobs. If a value
|
20
22
|
* of zero is passed, a suitable default based on the current number of
|
21
23
|
* processors online will be chosen.
|
24
|
+
* If |idle_task_support| is enabled then the platform will accept idle
|
25
|
+
* tasks (IdleTasksEnabled will return true) and will rely on the embedder
|
26
|
+
* calling v8::platform::RunIdleTasks to process the idle tasks.
|
22
27
|
*/
|
23
28
|
V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform(
|
24
|
-
int thread_pool_size = 0
|
29
|
+
int thread_pool_size = 0,
|
30
|
+
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled);
|
25
31
|
|
26
32
|
/**
|
27
33
|
* Pumps the message loop for the given isolate.
|
@@ -8,7 +8,9 @@
|
|
8
8
|
#include "v8.h" // NOLINT(build/include)
|
9
9
|
|
10
10
|
/**
|
11
|
-
*
|
11
|
+
* ATTENTION: The debugger API exposed by this file is deprecated and will be
|
12
|
+
* removed by the end of 2017. Please use the V8 inspector declared
|
13
|
+
* in include/v8-inspector.h instead.
|
12
14
|
*/
|
13
15
|
namespace v8 {
|
14
16
|
|
@@ -116,9 +118,7 @@ class V8_EXPORT Debug {
|
|
116
118
|
virtual Local<Value> GetCallbackData() const = 0;
|
117
119
|
|
118
120
|
/**
|
119
|
-
*
|
120
|
-
* debugger takes ownership of the data and will delete it even if
|
121
|
-
* there is no message handler.
|
121
|
+
* This is now a dummy that returns nullptr.
|
122
122
|
*/
|
123
123
|
virtual ClientData* GetClientData() const = 0;
|
124
124
|
|
@@ -132,46 +132,40 @@ class V8_EXPORT Debug {
|
|
132
132
|
*
|
133
133
|
* \param event_details object providing information about the debug event
|
134
134
|
*
|
135
|
-
* A
|
135
|
+
* A EventCallback does not take possession of the event data,
|
136
136
|
* and must not rely on the data persisting after the handler returns.
|
137
137
|
*/
|
138
138
|
typedef void (*EventCallback)(const EventDetails& event_details);
|
139
139
|
|
140
140
|
/**
|
141
|
-
*
|
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.
|
141
|
+
* This is now a no-op.
|
147
142
|
*/
|
148
143
|
typedef void (*MessageHandler)(const Message& message);
|
149
144
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
typedef void (*DebugMessageDispatchHandler)();
|
154
|
-
|
155
|
-
static bool SetDebugEventListener(Isolate* isolate, EventCallback that,
|
156
|
-
Local<Value> data = Local<Value>());
|
145
|
+
V8_DEPRECATED("No longer supported", static bool SetDebugEventListener(
|
146
|
+
Isolate* isolate, EventCallback that,
|
147
|
+
Local<Value> data = Local<Value>()));
|
157
148
|
|
158
149
|
// Schedule a debugger break to happen when JavaScript code is run
|
159
150
|
// in the given isolate.
|
160
|
-
|
151
|
+
V8_DEPRECATED("No longer supported",
|
152
|
+
static void DebugBreak(Isolate* isolate));
|
161
153
|
|
162
154
|
// Remove scheduled debugger break in given isolate if it has not
|
163
155
|
// happened yet.
|
164
|
-
|
156
|
+
V8_DEPRECATED("No longer supported",
|
157
|
+
static void CancelDebugBreak(Isolate* isolate));
|
165
158
|
|
166
159
|
// Check if a debugger break is scheduled in the given isolate.
|
167
160
|
V8_DEPRECATED("No longer supported",
|
168
161
|
static bool CheckDebugBreak(Isolate* isolate));
|
169
162
|
|
170
|
-
//
|
163
|
+
// This is now a no-op.
|
171
164
|
V8_DEPRECATED("No longer supported",
|
172
165
|
static void SetMessageHandler(Isolate* isolate,
|
173
166
|
MessageHandler handler));
|
174
167
|
|
168
|
+
// This is now a no-op.
|
175
169
|
V8_DEPRECATED("No longer supported",
|
176
170
|
static void SendCommand(Isolate* isolate,
|
177
171
|
const uint16_t* command, int length,
|
@@ -195,49 +189,12 @@ class V8_EXPORT Debug {
|
|
195
189
|
* }
|
196
190
|
* \endcode
|
197
191
|
*/
|
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
192
|
V8_DEPRECATED("No longer supported",
|
207
|
-
static MaybeLocal<Value>
|
208
|
-
|
193
|
+
static MaybeLocal<Value> Call(
|
194
|
+
Local<Context> context, v8::Local<v8::Function> fun,
|
195
|
+
Local<Value> data = Local<Value>()));
|
209
196
|
|
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
|
-
*/
|
197
|
+
// This is now a no-op.
|
241
198
|
V8_DEPRECATED("No longer supported",
|
242
199
|
static void ProcessDebugMessages(Isolate* isolate));
|
243
200
|
|
@@ -264,23 +221,28 @@ class V8_EXPORT Debug {
|
|
264
221
|
* (default Isolate if not provided). V8 will abort if LiveEdit is
|
265
222
|
* unexpectedly used. LiveEdit is enabled by default.
|
266
223
|
*/
|
267
|
-
|
224
|
+
V8_DEPRECATED("No longer supported",
|
225
|
+
static void SetLiveEditEnabled(Isolate* isolate, bool enable));
|
268
226
|
|
269
227
|
/**
|
270
228
|
* Returns array of internal properties specific to the value type. Result has
|
271
229
|
* the following format: [<name>, <value>,...,<name>, <value>]. Result array
|
272
230
|
* will be allocated in the current context.
|
273
231
|
*/
|
274
|
-
|
275
|
-
|
232
|
+
V8_DEPRECATED("No longer supported",
|
233
|
+
static MaybeLocal<Array> GetInternalProperties(
|
234
|
+
Isolate* isolate, Local<Value> value));
|
276
235
|
|
277
236
|
/**
|
278
237
|
* Defines if the ES2015 tail call elimination feature is enabled or not.
|
279
238
|
* The change of this flag triggers deoptimization of all functions that
|
280
239
|
* contain calls at tail position.
|
281
240
|
*/
|
282
|
-
|
283
|
-
|
241
|
+
V8_DEPRECATED("No longer supported",
|
242
|
+
static bool IsTailCallEliminationEnabled(Isolate* isolate));
|
243
|
+
V8_DEPRECATED("No longer supported",
|
244
|
+
static void SetTailCallEliminationEnabled(Isolate* isolate,
|
245
|
+
bool enabled));
|
284
246
|
};
|
285
247
|
|
286
248
|
|
@@ -85,6 +85,8 @@ class V8_EXPORT V8ContextInfo {
|
|
85
85
|
StringView auxData;
|
86
86
|
bool hasMemoryOnConsole;
|
87
87
|
|
88
|
+
static int executionContextId(v8::Local<v8::Context> context);
|
89
|
+
|
88
90
|
private:
|
89
91
|
// Disallow copying and allocating this one.
|
90
92
|
enum NotNullTagEnum { NotNullLiteral };
|
@@ -156,8 +158,6 @@ class V8_EXPORT V8InspectorSession {
|
|
156
158
|
virtual void releaseObjectGroup(const StringView&) = 0;
|
157
159
|
};
|
158
160
|
|
159
|
-
enum class V8ConsoleAPIType { kClear, kDebug, kLog, kInfo, kWarning, kError };
|
160
|
-
|
161
161
|
class V8_EXPORT V8InspectorClient {
|
162
162
|
public:
|
163
163
|
virtual ~V8InspectorClient() {}
|
@@ -189,7 +189,8 @@ class V8_EXPORT V8InspectorClient {
|
|
189
189
|
|
190
190
|
virtual void installAdditionalCommandLineAPI(v8::Local<v8::Context>,
|
191
191
|
v8::Local<v8::Object>) {}
|
192
|
-
virtual void consoleAPIMessage(int contextGroupId,
|
192
|
+
virtual void consoleAPIMessage(int contextGroupId,
|
193
|
+
v8::Isolate::MessageErrorLevel level,
|
193
194
|
const StringView& message,
|
194
195
|
const StringView& url, unsigned lineNumber,
|
195
196
|
unsigned columnNumber, V8StackTrace*) {}
|
@@ -201,6 +202,7 @@ class V8_EXPORT V8InspectorClient {
|
|
201
202
|
virtual void consoleTime(const StringView& title) {}
|
202
203
|
virtual void consoleTimeEnd(const StringView& title) {}
|
203
204
|
virtual void consoleTimeStamp(const StringView& title) {}
|
205
|
+
virtual void consoleClear(int contextGroupId) {}
|
204
206
|
virtual double currentTimeMS() { return 0; }
|
205
207
|
typedef void (*TimerCallback)(void*);
|
206
208
|
virtual void startRepeatingTimer(double, TimerCallback, void* data) {}
|
@@ -222,8 +224,6 @@ class V8_EXPORT V8Inspector {
|
|
222
224
|
virtual void resetContextGroup(int contextGroupId) = 0;
|
223
225
|
|
224
226
|
// Various instrumentation.
|
225
|
-
virtual void willExecuteScript(v8::Local<v8::Context>, int scriptId) = 0;
|
226
|
-
virtual void didExecuteScript(v8::Local<v8::Context>) = 0;
|
227
227
|
virtual void idleStarted() = 0;
|
228
228
|
virtual void idleFinished() = 0;
|
229
229
|
|
@@ -212,6 +212,14 @@ class Platform {
|
|
212
212
|
|
213
213
|
/** Removes tracing state change observer. */
|
214
214
|
virtual void RemoveTraceStateObserver(TraceStateObserver*) {}
|
215
|
+
|
216
|
+
typedef void (*StackTracePrinter)();
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Returns a function pointer that print a stack trace of the current stack
|
220
|
+
* on invocation. Disables printing of the stack trace if nullptr.
|
221
|
+
*/
|
222
|
+
virtual StackTracePrinter GetStackTracePrinter() { return nullptr; }
|
215
223
|
};
|
216
224
|
|
217
225
|
} // namespace v8
|
@@ -5,6 +5,7 @@
|
|
5
5
|
#ifndef V8_V8_PROFILER_H_
|
6
6
|
#define V8_V8_PROFILER_H_
|
7
7
|
|
8
|
+
#include <unordered_set>
|
8
9
|
#include <vector>
|
9
10
|
#include "v8.h" // NOLINT(build/include)
|
10
11
|
|
@@ -392,8 +393,7 @@ class V8_EXPORT HeapGraphNode {
|
|
392
393
|
// snapshot items together.
|
393
394
|
kConsString = 10, // Concatenated string. A pair of pointers to strings.
|
394
395
|
kSlicedString = 11, // Sliced string. A fragment of another string.
|
395
|
-
kSymbol = 12
|
396
|
-
kSimdValue = 13 // A SIMD value stored in the heap (Proposed ES7).
|
396
|
+
kSymbol = 12 // A Symbol (ES6).
|
397
397
|
};
|
398
398
|
|
399
399
|
/** Returns node type (see HeapGraphNode::Type). */
|
@@ -630,6 +630,24 @@ class V8_EXPORT HeapProfiler {
|
|
630
630
|
kSamplingForceGC = 1 << 0,
|
631
631
|
};
|
632
632
|
|
633
|
+
typedef std::unordered_set<const v8::PersistentBase<v8::Value>*>
|
634
|
+
RetainerChildren;
|
635
|
+
typedef std::vector<std::pair<v8::RetainedObjectInfo*, RetainerChildren>>
|
636
|
+
RetainerGroups;
|
637
|
+
typedef std::vector<std::pair<const v8::PersistentBase<v8::Value>*,
|
638
|
+
const v8::PersistentBase<v8::Value>*>>
|
639
|
+
RetainerEdges;
|
640
|
+
|
641
|
+
struct RetainerInfos {
|
642
|
+
RetainerGroups groups;
|
643
|
+
RetainerEdges edges;
|
644
|
+
};
|
645
|
+
|
646
|
+
/**
|
647
|
+
* Callback function invoked to retrieve all RetainerInfos from the embedder.
|
648
|
+
*/
|
649
|
+
typedef RetainerInfos (*GetRetainerInfosCallback)(v8::Isolate* isolate);
|
650
|
+
|
633
651
|
/**
|
634
652
|
* Callback function invoked for obtaining RetainedObjectInfo for
|
635
653
|
* the given JavaScript wrapper object. It is prohibited to enter V8
|
@@ -782,6 +800,8 @@ class V8_EXPORT HeapProfiler {
|
|
782
800
|
uint16_t class_id,
|
783
801
|
WrapperInfoCallback callback);
|
784
802
|
|
803
|
+
void SetGetRetainerInfosCallback(GetRetainerInfosCallback callback);
|
804
|
+
|
785
805
|
/**
|
786
806
|
* Default value of persistent handle class ID. Must not be used to
|
787
807
|
* define a class. Can be used to reset a class of a persistent
|
@@ -792,11 +812,6 @@ class V8_EXPORT HeapProfiler {
|
|
792
812
|
/** Returns memory used for profiler internal data and snapshots. */
|
793
813
|
size_t GetProfilerMemorySize();
|
794
814
|
|
795
|
-
/**
|
796
|
-
* Sets a RetainedObjectInfo for an object group (see V8::SetObjectGroupId).
|
797
|
-
*/
|
798
|
-
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
|
799
|
-
|
800
815
|
private:
|
801
816
|
HeapProfiler();
|
802
817
|
~HeapProfiler();
|
data/vendor/v8/include/v8-util.h
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
#define V8_UTIL_H_
|
7
7
|
|
8
8
|
#include "v8.h" // NOLINT(build/include)
|
9
|
+
#include <assert.h>
|
9
10
|
#include <map>
|
10
11
|
#include <vector>
|
11
12
|
|
@@ -210,7 +211,7 @@ class PersistentValueMapBase {
|
|
210
211
|
* key.
|
211
212
|
*/
|
212
213
|
void RegisterExternallyReferencedObject(K& key) {
|
213
|
-
|
214
|
+
assert(Contains(key));
|
214
215
|
V8::RegisterExternallyReferencedObject(
|
215
216
|
reinterpret_cast<internal::Object**>(FromVal(Traits::Get(&impl_, key))),
|
216
217
|
reinterpret_cast<internal::Isolate*>(GetIsolate()));
|
@@ -9,9 +9,9 @@
|
|
9
9
|
// NOTE these macros are used by some of the tool scripts and the build
|
10
10
|
// system so their names cannot be changed without changing the scripts.
|
11
11
|
#define V8_MAJOR_VERSION 5
|
12
|
-
#define V8_MINOR_VERSION
|
13
|
-
#define V8_BUILD_NUMBER
|
14
|
-
#define V8_PATCH_LEVEL
|
12
|
+
#define V8_MINOR_VERSION 9
|
13
|
+
#define V8_BUILD_NUMBER 211
|
14
|
+
#define V8_PATCH_LEVEL 38
|
15
15
|
|
16
16
|
// Use 1 for candidates and 0 otherwise.
|
17
17
|
// (Boolean macro values are not supported by all preprocessors.)
|
data/vendor/v8/include/v8.h
CHANGED
@@ -108,6 +108,7 @@ class Private;
|
|
108
108
|
class Uint32;
|
109
109
|
class Utils;
|
110
110
|
class Value;
|
111
|
+
class WasmCompiledModule;
|
111
112
|
template <class T> class Local;
|
112
113
|
template <class T>
|
113
114
|
class MaybeLocal;
|
@@ -127,7 +128,6 @@ template<class V, class T> class PersistentValueVector;
|
|
127
128
|
template<class T, class P> class WeakCallbackObject;
|
128
129
|
class FunctionTemplate;
|
129
130
|
class ObjectTemplate;
|
130
|
-
class Data;
|
131
131
|
template<typename T> class FunctionCallbackInfo;
|
132
132
|
template<typename T> class PropertyCallbackInfo;
|
133
133
|
class StackTrace;
|
@@ -137,10 +137,6 @@ class CallHandlerHelper;
|
|
137
137
|
class EscapableHandleScope;
|
138
138
|
template<typename T> class ReturnValue;
|
139
139
|
|
140
|
-
namespace experimental {
|
141
|
-
class FastAccessorBuilder;
|
142
|
-
} // namespace experimental
|
143
|
-
|
144
140
|
namespace internal {
|
145
141
|
class Arguments;
|
146
142
|
class Heap;
|
@@ -155,30 +151,6 @@ class GlobalHandles;
|
|
155
151
|
} // namespace internal
|
156
152
|
|
157
153
|
|
158
|
-
/**
|
159
|
-
* General purpose unique identifier.
|
160
|
-
*/
|
161
|
-
class UniqueId {
|
162
|
-
public:
|
163
|
-
explicit UniqueId(intptr_t data)
|
164
|
-
: data_(data) {}
|
165
|
-
|
166
|
-
bool operator==(const UniqueId& other) const {
|
167
|
-
return data_ == other.data_;
|
168
|
-
}
|
169
|
-
|
170
|
-
bool operator!=(const UniqueId& other) const {
|
171
|
-
return data_ != other.data_;
|
172
|
-
}
|
173
|
-
|
174
|
-
bool operator<(const UniqueId& other) const {
|
175
|
-
return data_ < other.data_;
|
176
|
-
}
|
177
|
-
|
178
|
-
private:
|
179
|
-
intptr_t data_;
|
180
|
-
};
|
181
|
-
|
182
154
|
// --- Handles ---
|
183
155
|
|
184
156
|
#define TYPE_CHECK(T, S) \
|
@@ -186,7 +158,6 @@ class UniqueId {
|
|
186
158
|
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
|
187
159
|
}
|
188
160
|
|
189
|
-
|
190
161
|
/**
|
191
162
|
* An object reference managed by the v8 garbage collector.
|
192
163
|
*
|
@@ -200,10 +171,16 @@ class UniqueId {
|
|
200
171
|
* allocated on the heap.
|
201
172
|
*
|
202
173
|
* There are two types of handles: local and persistent handles.
|
174
|
+
*
|
203
175
|
* Local handles are light-weight and transient and typically used in
|
204
|
-
* local operations. They are managed by HandleScopes.
|
205
|
-
*
|
206
|
-
*
|
176
|
+
* local operations. They are managed by HandleScopes. That means that a
|
177
|
+
* HandleScope must exist on the stack when they are created and that they are
|
178
|
+
* only valid inside of the HandleScope active during their creation.
|
179
|
+
* For passing a local handle to an outer HandleScope, an EscapableHandleScope
|
180
|
+
* and its Escape() method must be used.
|
181
|
+
*
|
182
|
+
* Persistent handles can be used when storing objects across several
|
183
|
+
* independent operations and have to be explicitly deallocated when they're no
|
207
184
|
* longer used.
|
208
185
|
*
|
209
186
|
* It is safe to extract the object stored in the handle by
|
@@ -281,6 +258,11 @@ class Local {
|
|
281
258
|
return !operator==(that);
|
282
259
|
}
|
283
260
|
|
261
|
+
/**
|
262
|
+
* Cast a handle to a subclass, e.g. Local<Value> to Local<Object>.
|
263
|
+
* This is only valid if the handle actually refers to a value of the
|
264
|
+
* target type.
|
265
|
+
*/
|
284
266
|
template <class S> V8_INLINE static Local<T> Cast(Local<S> that) {
|
285
267
|
#ifdef V8_ENABLE_CHECKS
|
286
268
|
// If we're going to perform the type check then we have to check
|
@@ -290,6 +272,11 @@ class Local {
|
|
290
272
|
return Local<T>(T::Cast(*that));
|
291
273
|
}
|
292
274
|
|
275
|
+
/**
|
276
|
+
* Calling this is equivalent to Local<S>::Cast().
|
277
|
+
* In particular, this is only valid if the handle actually refers to a value
|
278
|
+
* of the target type.
|
279
|
+
*/
|
293
280
|
template <class S>
|
294
281
|
V8_INLINE Local<S> As() const {
|
295
282
|
return Local<S>::Cast(*this);
|
@@ -366,15 +353,26 @@ class MaybeLocal {
|
|
366
353
|
|
367
354
|
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
|
368
355
|
|
356
|
+
/**
|
357
|
+
* Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty,
|
358
|
+
* |false| is returned and |out| is left untouched.
|
359
|
+
*/
|
369
360
|
template <class S>
|
370
361
|
V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local<S>* out) const {
|
371
362
|
out->val_ = IsEmpty() ? nullptr : this->val_;
|
372
363
|
return !IsEmpty();
|
373
364
|
}
|
374
365
|
|
375
|
-
|
366
|
+
/**
|
367
|
+
* Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty,
|
368
|
+
* V8 will crash the process.
|
369
|
+
*/
|
376
370
|
V8_INLINE Local<T> ToLocalChecked();
|
377
371
|
|
372
|
+
/**
|
373
|
+
* Converts this MaybeLocal<> to a Local<>, using a default value if this
|
374
|
+
* MaybeLocal<> is empty.
|
375
|
+
*/
|
378
376
|
template <class S>
|
379
377
|
V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
|
380
378
|
return IsEmpty() ? default_value : Local<S>(val_);
|
@@ -384,28 +382,29 @@ class MaybeLocal {
|
|
384
382
|
T* val_;
|
385
383
|
};
|
386
384
|
|
387
|
-
|
388
|
-
|
385
|
+
/**
|
386
|
+
* Eternal handles are set-once handles that live for the lifetime of the
|
387
|
+
* isolate.
|
388
|
+
*/
|
389
389
|
template <class T> class Eternal {
|
390
390
|
public:
|
391
|
-
V8_INLINE Eternal() :
|
392
|
-
template<class S>
|
393
|
-
V8_INLINE Eternal(Isolate* isolate, Local<S> handle) :
|
391
|
+
V8_INLINE Eternal() : val_(nullptr) {}
|
392
|
+
template <class S>
|
393
|
+
V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : val_(nullptr) {
|
394
394
|
Set(isolate, handle);
|
395
395
|
}
|
396
396
|
// Can only be safely called if already set.
|
397
|
-
V8_INLINE Local<T> Get(Isolate* isolate);
|
398
|
-
V8_INLINE bool IsEmpty() { return
|
397
|
+
V8_INLINE Local<T> Get(Isolate* isolate) const;
|
398
|
+
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
|
399
399
|
template<class S> V8_INLINE void Set(Isolate* isolate, Local<S> handle);
|
400
400
|
|
401
401
|
private:
|
402
|
-
|
403
|
-
int index_;
|
402
|
+
T* val_;
|
404
403
|
};
|
405
404
|
|
406
405
|
|
407
406
|
static const int kInternalFieldsInWeakCallback = 2;
|
408
|
-
|
407
|
+
static const int kEmbedderFieldsInWeakCallback = 2;
|
409
408
|
|
410
409
|
template <typename T>
|
411
410
|
class WeakCallbackInfo {
|
@@ -413,11 +412,11 @@ class WeakCallbackInfo {
|
|
413
412
|
typedef void (*Callback)(const WeakCallbackInfo<T>& data);
|
414
413
|
|
415
414
|
WeakCallbackInfo(Isolate* isolate, T* parameter,
|
416
|
-
void*
|
415
|
+
void* embedder_fields[kEmbedderFieldsInWeakCallback],
|
417
416
|
Callback* callback)
|
418
417
|
: isolate_(isolate), parameter_(parameter), callback_(callback) {
|
419
|
-
for (int i = 0; i <
|
420
|
-
|
418
|
+
for (int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
|
419
|
+
embedder_fields_[i] = embedder_fields[i];
|
421
420
|
}
|
422
421
|
}
|
423
422
|
|
@@ -427,11 +426,11 @@ class WeakCallbackInfo {
|
|
427
426
|
|
428
427
|
V8_INLINE V8_DEPRECATED("use indexed version",
|
429
428
|
void* GetInternalField1() const) {
|
430
|
-
return
|
429
|
+
return embedder_fields_[0];
|
431
430
|
}
|
432
431
|
V8_INLINE V8_DEPRECATED("use indexed version",
|
433
432
|
void* GetInternalField2() const) {
|
434
|
-
return
|
433
|
+
return embedder_fields_[1];
|
435
434
|
}
|
436
435
|
|
437
436
|
V8_DEPRECATED("Not realiable once SetSecondPassCallback() was used.",
|
@@ -451,7 +450,7 @@ class WeakCallbackInfo {
|
|
451
450
|
Isolate* isolate_;
|
452
451
|
T* parameter_;
|
453
452
|
Callback* callback_;
|
454
|
-
void*
|
453
|
+
void* embedder_fields_[kEmbedderFieldsInWeakCallback];
|
455
454
|
};
|
456
455
|
|
457
456
|
|
@@ -466,10 +465,10 @@ enum class WeakCallbackType { kParameter, kInternalFields, kFinalizer };
|
|
466
465
|
* An object reference that is independent of any handle scope. Where
|
467
466
|
* a Local handle only lives as long as the HandleScope in which it was
|
468
467
|
* allocated, a PersistentBase handle remains valid until it is explicitly
|
469
|
-
* disposed.
|
468
|
+
* disposed using Reset().
|
470
469
|
*
|
471
470
|
* A persistent handle contains a reference to a storage cell within
|
472
|
-
* the
|
471
|
+
* the V8 engine which holds an object value and which is updated by
|
473
472
|
* the garbage collector whenever the object is moved. A new storage
|
474
473
|
* cell can be created using the constructor or PersistentBase::Reset and
|
475
474
|
* existing handles can be disposed using PersistentBase::Reset.
|
@@ -927,6 +926,11 @@ class V8_EXPORT EscapableHandleScope : public HandleScope {
|
|
927
926
|
internal::Object** escape_slot_;
|
928
927
|
};
|
929
928
|
|
929
|
+
/**
|
930
|
+
* A SealHandleScope acts like a handle scope in which no handle allocations
|
931
|
+
* are allowed. It can be useful for debugging handle leaks.
|
932
|
+
* Handles can be allocated within inner normal HandleScopes.
|
933
|
+
*/
|
930
934
|
class V8_EXPORT SealHandleScope {
|
931
935
|
public:
|
932
936
|
SealHandleScope(Isolate* isolate);
|
@@ -962,20 +966,31 @@ class V8_EXPORT Data {
|
|
962
966
|
class ScriptOriginOptions {
|
963
967
|
public:
|
964
968
|
V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false,
|
965
|
-
bool is_opaque = false, bool is_wasm = false
|
969
|
+
bool is_opaque = false, bool is_wasm = false,
|
970
|
+
bool is_module = false)
|
966
971
|
: flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
|
967
|
-
(is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0)
|
972
|
+
(is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
|
973
|
+
(is_module ? kIsModule : 0)) {}
|
968
974
|
V8_INLINE ScriptOriginOptions(int flags)
|
969
|
-
: flags_(flags &
|
975
|
+
: flags_(flags &
|
976
|
+
(kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
|
977
|
+
|
970
978
|
bool IsSharedCrossOrigin() const {
|
971
979
|
return (flags_ & kIsSharedCrossOrigin) != 0;
|
972
980
|
}
|
973
981
|
bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; }
|
974
982
|
bool IsWasm() const { return (flags_ & kIsWasm) != 0; }
|
983
|
+
bool IsModule() const { return (flags_ & kIsModule) != 0; }
|
984
|
+
|
975
985
|
int Flags() const { return flags_; }
|
976
986
|
|
977
987
|
private:
|
978
|
-
enum {
|
988
|
+
enum {
|
989
|
+
kIsSharedCrossOrigin = 1,
|
990
|
+
kIsOpaque = 1 << 1,
|
991
|
+
kIsWasm = 1 << 2,
|
992
|
+
kIsModule = 1 << 3
|
993
|
+
};
|
979
994
|
const int flags_;
|
980
995
|
};
|
981
996
|
|
@@ -992,7 +1007,8 @@ class ScriptOrigin {
|
|
992
1007
|
Local<Integer> script_id = Local<Integer>(),
|
993
1008
|
Local<Value> source_map_url = Local<Value>(),
|
994
1009
|
Local<Boolean> resource_is_opaque = Local<Boolean>(),
|
995
|
-
Local<Boolean> is_wasm = Local<Boolean>()
|
1010
|
+
Local<Boolean> is_wasm = Local<Boolean>(),
|
1011
|
+
Local<Boolean> is_module = Local<Boolean>());
|
996
1012
|
|
997
1013
|
V8_INLINE Local<Value> ResourceName() const;
|
998
1014
|
V8_INLINE Local<Integer> ResourceLineOffset() const;
|
@@ -1083,10 +1099,34 @@ class V8_EXPORT Module {
|
|
1083
1099
|
|
1084
1100
|
/**
|
1085
1101
|
* ModuleEvaluation
|
1102
|
+
*
|
1103
|
+
* Returns the completion value.
|
1086
1104
|
*/
|
1087
1105
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context);
|
1088
1106
|
};
|
1089
1107
|
|
1108
|
+
/**
|
1109
|
+
* This is an unfinished experimental feature, and is only exposed
|
1110
|
+
* here for internal testing purposes. DO NOT USE.
|
1111
|
+
*
|
1112
|
+
* A compiled JavaScript module.
|
1113
|
+
*/
|
1114
|
+
class V8_EXPORT DynamicImportResult {
|
1115
|
+
public:
|
1116
|
+
/**
|
1117
|
+
* Resolves the promise with the namespace object of the given
|
1118
|
+
* module.
|
1119
|
+
*/
|
1120
|
+
V8_WARN_UNUSED_RESULT bool FinishDynamicImportSuccess(Local<Context> context,
|
1121
|
+
Local<Module> module);
|
1122
|
+
|
1123
|
+
/**
|
1124
|
+
* Rejects the promise with the given exception.
|
1125
|
+
*/
|
1126
|
+
V8_WARN_UNUSED_RESULT bool FinishDynamicImportFailure(Local<Context> context,
|
1127
|
+
Local<Value> exception);
|
1128
|
+
};
|
1129
|
+
|
1090
1130
|
/**
|
1091
1131
|
* A compiled JavaScript script, tied to a Context which was active when the
|
1092
1132
|
* script was compiled.
|
@@ -1183,6 +1223,8 @@ class V8_EXPORT ScriptCompiler {
|
|
1183
1223
|
// alive.
|
1184
1224
|
V8_INLINE const CachedData* GetCachedData() const;
|
1185
1225
|
|
1226
|
+
V8_INLINE const ScriptOriginOptions& GetResourceOptions() const;
|
1227
|
+
|
1186
1228
|
// Prevent copying.
|
1187
1229
|
Source(const Source&) = delete;
|
1188
1230
|
Source& operator=(const Source&) = delete;
|
@@ -1375,7 +1417,7 @@ class V8_EXPORT ScriptCompiler {
|
|
1375
1417
|
* CachedData instance is still valid; the tag has no other meaing.
|
1376
1418
|
*
|
1377
1419
|
* Background: The data carried by CachedData may depend on the exact
|
1378
|
-
* V8 version number or
|
1420
|
+
* V8 version number or current compiler flags. This means that when
|
1379
1421
|
* persisting CachedData, the embedder must take care to not pass in
|
1380
1422
|
* data from another V8 version, or the same version with different
|
1381
1423
|
* features enabled.
|
@@ -1425,7 +1467,7 @@ class V8_EXPORT ScriptCompiler {
|
|
1425
1467
|
|
1426
1468
|
private:
|
1427
1469
|
static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
|
1428
|
-
Isolate* isolate, Source* source, CompileOptions options
|
1470
|
+
Isolate* isolate, Source* source, CompileOptions options);
|
1429
1471
|
};
|
1430
1472
|
|
1431
1473
|
|
@@ -1522,6 +1564,8 @@ class V8_EXPORT StackTrace {
|
|
1522
1564
|
/**
|
1523
1565
|
* Flags that determine what information is placed captured for each
|
1524
1566
|
* StackFrame when grabbing the current stack trace.
|
1567
|
+
* Note: these options are deprecated and we always collect all available
|
1568
|
+
* information (kDetailed).
|
1525
1569
|
*/
|
1526
1570
|
enum StackTraceOptions {
|
1527
1571
|
kLineNumber = 1,
|
@@ -1550,7 +1594,7 @@ class V8_EXPORT StackTrace {
|
|
1550
1594
|
/**
|
1551
1595
|
* Returns StackTrace as a v8::Array that contains StackFrame objects.
|
1552
1596
|
*/
|
1553
|
-
Local<Array> AsArray();
|
1597
|
+
V8_DEPRECATED("Use native API instead", Local<Array> AsArray());
|
1554
1598
|
|
1555
1599
|
/**
|
1556
1600
|
* Grab a snapshot of the current JavaScript execution stack.
|
@@ -1560,9 +1604,7 @@ class V8_EXPORT StackTrace {
|
|
1560
1604
|
* StackFrame.
|
1561
1605
|
*/
|
1562
1606
|
static Local<StackTrace> CurrentStackTrace(
|
1563
|
-
Isolate* isolate,
|
1564
|
-
int frame_limit,
|
1565
|
-
StackTraceOptions options = kOverview);
|
1607
|
+
Isolate* isolate, int frame_limit, StackTraceOptions options = kDetailed);
|
1566
1608
|
};
|
1567
1609
|
|
1568
1610
|
|
@@ -1626,6 +1668,11 @@ class V8_EXPORT StackFrame {
|
|
1626
1668
|
* constructor via "new".
|
1627
1669
|
*/
|
1628
1670
|
bool IsConstructor() const;
|
1671
|
+
|
1672
|
+
/**
|
1673
|
+
* Returns whether or not the associated functions is defined in wasm.
|
1674
|
+
*/
|
1675
|
+
bool IsWasm() const;
|
1629
1676
|
};
|
1630
1677
|
|
1631
1678
|
|
@@ -1695,21 +1742,21 @@ class V8_EXPORT ValueSerializer {
|
|
1695
1742
|
public:
|
1696
1743
|
virtual ~Delegate() {}
|
1697
1744
|
|
1698
|
-
|
1745
|
+
/**
|
1699
1746
|
* Handles the case where a DataCloneError would be thrown in the structured
|
1700
1747
|
* clone spec. Other V8 embedders may throw some other appropriate exception
|
1701
1748
|
* type.
|
1702
1749
|
*/
|
1703
1750
|
virtual void ThrowDataCloneError(Local<String> message) = 0;
|
1704
1751
|
|
1705
|
-
|
1752
|
+
/**
|
1706
1753
|
* The embedder overrides this method to write some kind of host object, if
|
1707
1754
|
* possible. If not, a suitable exception should be thrown and
|
1708
1755
|
* Nothing<bool>() returned.
|
1709
1756
|
*/
|
1710
1757
|
virtual Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object);
|
1711
1758
|
|
1712
|
-
|
1759
|
+
/**
|
1713
1760
|
* Called when the ValueSerializer is going to serialize a
|
1714
1761
|
* SharedArrayBuffer object. The embedder must return an ID for the
|
1715
1762
|
* object, using the same ID if this SharedArrayBuffer has already been
|
@@ -1722,42 +1769,50 @@ class V8_EXPORT ValueSerializer {
|
|
1722
1769
|
virtual Maybe<uint32_t> GetSharedArrayBufferId(
|
1723
1770
|
Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer);
|
1724
1771
|
|
1725
|
-
|
1772
|
+
virtual Maybe<uint32_t> GetWasmModuleTransferId(
|
1773
|
+
Isolate* isolate, Local<WasmCompiledModule> module);
|
1774
|
+
/**
|
1726
1775
|
* Allocates memory for the buffer of at least the size provided. The actual
|
1727
1776
|
* size (which may be greater or equal) is written to |actual_size|. If no
|
1728
1777
|
* buffer has been allocated yet, nullptr will be provided.
|
1778
|
+
*
|
1779
|
+
* If the memory cannot be allocated, nullptr should be returned.
|
1780
|
+
* |actual_size| will be ignored. It is assumed that |old_buffer| is still
|
1781
|
+
* valid in this case and has not been modified.
|
1729
1782
|
*/
|
1730
1783
|
virtual void* ReallocateBufferMemory(void* old_buffer, size_t size,
|
1731
1784
|
size_t* actual_size);
|
1732
1785
|
|
1733
|
-
|
1786
|
+
/**
|
1734
1787
|
* Frees a buffer allocated with |ReallocateBufferMemory|.
|
1735
1788
|
*/
|
1736
1789
|
virtual void FreeBufferMemory(void* buffer);
|
1737
1790
|
};
|
1738
1791
|
|
1792
|
+
static uint32_t GetCurrentDataFormatVersion();
|
1793
|
+
|
1739
1794
|
explicit ValueSerializer(Isolate* isolate);
|
1740
1795
|
ValueSerializer(Isolate* isolate, Delegate* delegate);
|
1741
1796
|
~ValueSerializer();
|
1742
1797
|
|
1743
|
-
|
1798
|
+
/**
|
1744
1799
|
* Writes out a header, which includes the format version.
|
1745
1800
|
*/
|
1746
1801
|
void WriteHeader();
|
1747
1802
|
|
1748
|
-
|
1803
|
+
/**
|
1749
1804
|
* Serializes a JavaScript value into the buffer.
|
1750
1805
|
*/
|
1751
1806
|
V8_WARN_UNUSED_RESULT Maybe<bool> WriteValue(Local<Context> context,
|
1752
1807
|
Local<Value> value);
|
1753
1808
|
|
1754
|
-
|
1809
|
+
/**
|
1755
1810
|
* Returns the stored data. This serializer should not be used once the buffer
|
1756
1811
|
* is released. The contents are undefined if a previous write has failed.
|
1757
1812
|
*/
|
1758
1813
|
V8_DEPRECATE_SOON("Use Release()", std::vector<uint8_t> ReleaseBuffer());
|
1759
1814
|
|
1760
|
-
|
1815
|
+
/**
|
1761
1816
|
* Returns the stored data (allocated using the delegate's
|
1762
1817
|
* AllocateBufferMemory) and its size. This serializer should not be used once
|
1763
1818
|
* the buffer is released. The contents are undefined if a previous write has
|
@@ -1765,15 +1820,15 @@ class V8_EXPORT ValueSerializer {
|
|
1765
1820
|
*/
|
1766
1821
|
V8_WARN_UNUSED_RESULT std::pair<uint8_t*, size_t> Release();
|
1767
1822
|
|
1768
|
-
|
1823
|
+
/**
|
1769
1824
|
* Marks an ArrayBuffer as havings its contents transferred out of band.
|
1770
|
-
* Pass the corresponding
|
1825
|
+
* Pass the corresponding ArrayBuffer in the deserializing context to
|
1771
1826
|
* ValueDeserializer::TransferArrayBuffer.
|
1772
1827
|
*/
|
1773
1828
|
void TransferArrayBuffer(uint32_t transfer_id,
|
1774
1829
|
Local<ArrayBuffer> array_buffer);
|
1775
1830
|
|
1776
|
-
|
1831
|
+
/**
|
1777
1832
|
* Similar to TransferArrayBuffer, but for SharedArrayBuffer.
|
1778
1833
|
*/
|
1779
1834
|
V8_DEPRECATE_SOON("Use Delegate::GetSharedArrayBufferId",
|
@@ -1781,7 +1836,16 @@ class V8_EXPORT ValueSerializer {
|
|
1781
1836
|
uint32_t transfer_id,
|
1782
1837
|
Local<SharedArrayBuffer> shared_array_buffer));
|
1783
1838
|
|
1784
|
-
|
1839
|
+
/**
|
1840
|
+
* Indicate whether to treat ArrayBufferView objects as host objects,
|
1841
|
+
* i.e. pass them to Delegate::WriteHostObject. This should not be
|
1842
|
+
* called when no Delegate was passed.
|
1843
|
+
*
|
1844
|
+
* The default is not to treat ArrayBufferViews as host objects.
|
1845
|
+
*/
|
1846
|
+
void SetTreatArrayBufferViewsAsHostObjects(bool mode);
|
1847
|
+
|
1848
|
+
/**
|
1785
1849
|
* Write raw data in various common formats to the buffer.
|
1786
1850
|
* Note that integer types are written in base-128 varint format, not with a
|
1787
1851
|
* binary copy. For use during an override of Delegate::WriteHostObject.
|
@@ -1813,12 +1877,19 @@ class V8_EXPORT ValueDeserializer {
|
|
1813
1877
|
public:
|
1814
1878
|
virtual ~Delegate() {}
|
1815
1879
|
|
1816
|
-
|
1880
|
+
/**
|
1817
1881
|
* The embedder overrides this method to read some kind of host object, if
|
1818
1882
|
* possible. If not, a suitable exception should be thrown and
|
1819
1883
|
* MaybeLocal<Object>() returned.
|
1820
1884
|
*/
|
1821
1885
|
virtual MaybeLocal<Object> ReadHostObject(Isolate* isolate);
|
1886
|
+
|
1887
|
+
/**
|
1888
|
+
* Get a WasmCompiledModule given a transfer_id previously provided
|
1889
|
+
* by ValueSerializer::GetWasmModuleTransferId
|
1890
|
+
*/
|
1891
|
+
virtual MaybeLocal<WasmCompiledModule> GetWasmModuleFromId(
|
1892
|
+
Isolate* isolate, uint32_t transfer_id);
|
1822
1893
|
};
|
1823
1894
|
|
1824
1895
|
ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size);
|
@@ -1826,25 +1897,25 @@ class V8_EXPORT ValueDeserializer {
|
|
1826
1897
|
Delegate* delegate);
|
1827
1898
|
~ValueDeserializer();
|
1828
1899
|
|
1829
|
-
|
1900
|
+
/**
|
1830
1901
|
* Reads and validates a header (including the format version).
|
1831
1902
|
* May, for example, reject an invalid or unsupported wire format.
|
1832
1903
|
*/
|
1833
1904
|
V8_WARN_UNUSED_RESULT Maybe<bool> ReadHeader(Local<Context> context);
|
1834
1905
|
|
1835
|
-
|
1906
|
+
/**
|
1836
1907
|
* Deserializes a JavaScript value from the buffer.
|
1837
1908
|
*/
|
1838
1909
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> ReadValue(Local<Context> context);
|
1839
1910
|
|
1840
|
-
|
1911
|
+
/**
|
1841
1912
|
* Accepts the array buffer corresponding to the one passed previously to
|
1842
1913
|
* ValueSerializer::TransferArrayBuffer.
|
1843
1914
|
*/
|
1844
1915
|
void TransferArrayBuffer(uint32_t transfer_id,
|
1845
1916
|
Local<ArrayBuffer> array_buffer);
|
1846
1917
|
|
1847
|
-
|
1918
|
+
/**
|
1848
1919
|
* Similar to TransferArrayBuffer, but for SharedArrayBuffer.
|
1849
1920
|
* The id is not necessarily in the same namespace as unshared ArrayBuffer
|
1850
1921
|
* objects.
|
@@ -1852,7 +1923,7 @@ class V8_EXPORT ValueDeserializer {
|
|
1852
1923
|
void TransferSharedArrayBuffer(uint32_t id,
|
1853
1924
|
Local<SharedArrayBuffer> shared_array_buffer);
|
1854
1925
|
|
1855
|
-
|
1926
|
+
/**
|
1856
1927
|
* Must be called before ReadHeader to enable support for reading the legacy
|
1857
1928
|
* wire format (i.e., which predates this being shipped).
|
1858
1929
|
*
|
@@ -1861,14 +1932,19 @@ class V8_EXPORT ValueDeserializer {
|
|
1861
1932
|
*/
|
1862
1933
|
void SetSupportsLegacyWireFormat(bool supports_legacy_wire_format);
|
1863
1934
|
|
1864
|
-
|
1935
|
+
/**
|
1936
|
+
* Expect inline wasm in the data stream (rather than in-memory transfer)
|
1937
|
+
*/
|
1938
|
+
void SetExpectInlineWasm(bool allow_inline_wasm);
|
1939
|
+
|
1940
|
+
/**
|
1865
1941
|
* Reads the underlying wire format version. Likely mostly to be useful to
|
1866
1942
|
* legacy code reading old wire format versions. Must be called after
|
1867
1943
|
* ReadHeader.
|
1868
1944
|
*/
|
1869
1945
|
uint32_t GetWireFormatVersion() const;
|
1870
1946
|
|
1871
|
-
|
1947
|
+
/**
|
1872
1948
|
* Reads raw data in various common formats to the buffer.
|
1873
1949
|
* Note that integer types are read in base-128 varint format, not with a
|
1874
1950
|
* binary copy. For use during an override of Delegate::ReadHostObject.
|
@@ -1895,7 +1971,7 @@ class V8_EXPORT NativeWeakMap : public Data {
|
|
1895
1971
|
public:
|
1896
1972
|
static Local<NativeWeakMap> New(Isolate* isolate);
|
1897
1973
|
void Set(Local<Value> key, Local<Value> value);
|
1898
|
-
Local<Value> Get(Local<Value> key);
|
1974
|
+
Local<Value> Get(Local<Value> key) const;
|
1899
1975
|
bool Has(Local<Value> key);
|
1900
1976
|
bool Delete(Local<Value> key);
|
1901
1977
|
};
|
@@ -2145,12 +2221,6 @@ class V8_EXPORT Value : public Data {
|
|
2145
2221
|
*/
|
2146
2222
|
bool IsFloat64Array() const;
|
2147
2223
|
|
2148
|
-
/**
|
2149
|
-
* Returns true if this value is a SIMD Float32x4.
|
2150
|
-
* This is an experimental feature.
|
2151
|
-
*/
|
2152
|
-
bool IsFloat32x4() const;
|
2153
|
-
|
2154
2224
|
/**
|
2155
2225
|
* Returns true if this value is a DataView.
|
2156
2226
|
*/
|
@@ -2299,9 +2369,25 @@ class V8_EXPORT Name : public Primitive {
|
|
2299
2369
|
static void CheckCast(Value* obj);
|
2300
2370
|
};
|
2301
2371
|
|
2372
|
+
/**
|
2373
|
+
* A flag describing different modes of string creation.
|
2374
|
+
*
|
2375
|
+
* Aside from performance implications there are no differences between the two
|
2376
|
+
* creation modes.
|
2377
|
+
*/
|
2378
|
+
enum class NewStringType {
|
2379
|
+
/**
|
2380
|
+
* Create a new string, always allocating new storage memory.
|
2381
|
+
*/
|
2382
|
+
kNormal,
|
2302
2383
|
|
2303
|
-
|
2304
|
-
|
2384
|
+
/**
|
2385
|
+
* Acts as a hint that the string should be created in the
|
2386
|
+
* old generation heap space and be deduplicated if an identical string
|
2387
|
+
* already exists.
|
2388
|
+
*/
|
2389
|
+
kInternalized
|
2390
|
+
};
|
2305
2391
|
|
2306
2392
|
/**
|
2307
2393
|
* A JavaScript string value (ECMA-262, 4.3.17).
|
@@ -2313,10 +2399,10 @@ class V8_EXPORT String : public Name {
|
|
2313
2399
|
enum Encoding {
|
2314
2400
|
UNKNOWN_ENCODING = 0x1,
|
2315
2401
|
TWO_BYTE_ENCODING = 0x0,
|
2316
|
-
ONE_BYTE_ENCODING =
|
2402
|
+
ONE_BYTE_ENCODING = 0x8
|
2317
2403
|
};
|
2318
2404
|
/**
|
2319
|
-
* Returns the number of characters in this string.
|
2405
|
+
* Returns the number of characters (UTF-16 code units) in this string.
|
2320
2406
|
*/
|
2321
2407
|
int Length() const;
|
2322
2408
|
|
@@ -2327,14 +2413,16 @@ class V8_EXPORT String : public Name {
|
|
2327
2413
|
int Utf8Length() const;
|
2328
2414
|
|
2329
2415
|
/**
|
2330
|
-
* Returns whether this string is known to contain only one byte data
|
2416
|
+
* Returns whether this string is known to contain only one byte data,
|
2417
|
+
* i.e. ISO-8859-1 code points.
|
2331
2418
|
* Does not read the string.
|
2332
2419
|
* False negatives are possible.
|
2333
2420
|
*/
|
2334
2421
|
bool IsOneByte() const;
|
2335
2422
|
|
2336
2423
|
/**
|
2337
|
-
* Returns whether this string contain only one byte data
|
2424
|
+
* Returns whether this string contain only one byte data,
|
2425
|
+
* i.e. ISO-8859-1 code points.
|
2338
2426
|
* Will read the entire string in some cases.
|
2339
2427
|
*/
|
2340
2428
|
bool ContainsOnlyOneByte() const;
|
@@ -2429,6 +2517,7 @@ class V8_EXPORT String : public Name {
|
|
2429
2517
|
|
2430
2518
|
private:
|
2431
2519
|
friend class internal::Heap;
|
2520
|
+
friend class v8::String;
|
2432
2521
|
};
|
2433
2522
|
|
2434
2523
|
/**
|
@@ -2640,7 +2729,7 @@ class V8_EXPORT String : public Name {
|
|
2640
2729
|
};
|
2641
2730
|
|
2642
2731
|
/**
|
2643
|
-
* Converts an object to a two-byte string.
|
2732
|
+
* Converts an object to a two-byte (UTF-16-encoded) string.
|
2644
2733
|
* If conversion to a string fails (eg. due to an exception in the toString()
|
2645
2734
|
* method of the object) then the length() method returns 0 and the * operator
|
2646
2735
|
* returns NULL.
|
@@ -2675,22 +2764,30 @@ class V8_EXPORT String : public Name {
|
|
2675
2764
|
*/
|
2676
2765
|
class V8_EXPORT Symbol : public Name {
|
2677
2766
|
public:
|
2678
|
-
|
2767
|
+
/**
|
2768
|
+
* Returns the print name string of the symbol, or undefined if none.
|
2769
|
+
*/
|
2679
2770
|
Local<Value> Name() const;
|
2680
2771
|
|
2681
|
-
|
2772
|
+
/**
|
2773
|
+
* Create a symbol. If name is not empty, it will be used as the description.
|
2774
|
+
*/
|
2682
2775
|
static Local<Symbol> New(Isolate* isolate,
|
2683
2776
|
Local<String> name = Local<String>());
|
2684
2777
|
|
2685
|
-
|
2686
|
-
|
2687
|
-
|
2688
|
-
|
2689
|
-
|
2778
|
+
/**
|
2779
|
+
* Access global symbol registry.
|
2780
|
+
* Note that symbols created this way are never collected, so
|
2781
|
+
* they should only be used for statically fixed properties.
|
2782
|
+
* Also, there is only one global name space for the names used as keys.
|
2783
|
+
* To minimize the potential for clashes, use qualified names as keys.
|
2784
|
+
*/
|
2690
2785
|
static Local<Symbol> For(Isolate *isolate, Local<String> name);
|
2691
2786
|
|
2692
|
-
|
2693
|
-
|
2787
|
+
/**
|
2788
|
+
* Retrieve a global symbol. Similar to |For|, but using a separate
|
2789
|
+
* registry that is not accessible by (and cannot clash with) JavaScript code.
|
2790
|
+
*/
|
2694
2791
|
static Local<Symbol> ForApi(Isolate *isolate, Local<String> name);
|
2695
2792
|
|
2696
2793
|
// Well-known symbols
|
@@ -2715,20 +2812,26 @@ class V8_EXPORT Symbol : public Name {
|
|
2715
2812
|
*/
|
2716
2813
|
class V8_EXPORT Private : public Data {
|
2717
2814
|
public:
|
2718
|
-
|
2815
|
+
/**
|
2816
|
+
* Returns the print name string of the private symbol, or undefined if none.
|
2817
|
+
*/
|
2719
2818
|
Local<Value> Name() const;
|
2720
2819
|
|
2721
|
-
|
2820
|
+
/**
|
2821
|
+
* Create a private symbol. If name is not empty, it will be the description.
|
2822
|
+
*/
|
2722
2823
|
static Local<Private> New(Isolate* isolate,
|
2723
2824
|
Local<String> name = Local<String>());
|
2724
2825
|
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2826
|
+
/**
|
2827
|
+
* Retrieve a global private symbol. If a symbol with this name has not
|
2828
|
+
* been retrieved in the same isolate before, it is created.
|
2829
|
+
* Note that private symbols created this way are never collected, so
|
2830
|
+
* they should only be used for statically fixed properties.
|
2831
|
+
* Also, there is only one global name space for the names used as keys.
|
2832
|
+
* To minimize the potential for clashes, use qualified names as keys,
|
2833
|
+
* e.g., "Class#property".
|
2834
|
+
*/
|
2732
2835
|
static Local<Private> ForApi(Isolate* isolate, Local<String> name);
|
2733
2836
|
|
2734
2837
|
private:
|
@@ -2994,15 +3097,16 @@ class V8_EXPORT Object : public Value {
|
|
2994
3097
|
Local<Value> key);
|
2995
3098
|
|
2996
3099
|
V8_DEPRECATE_SOON("Use maybe version", bool Delete(Local<Value> key));
|
2997
|
-
|
2998
|
-
|
3100
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
|
3101
|
+
Local<Value> key);
|
2999
3102
|
|
3000
3103
|
V8_DEPRECATED("Use maybe version", bool Has(uint32_t index));
|
3001
|
-
V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
|
3104
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
|
3105
|
+
uint32_t index);
|
3002
3106
|
|
3003
3107
|
V8_DEPRECATED("Use maybe version", bool Delete(uint32_t index));
|
3004
|
-
|
3005
|
-
|
3108
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
|
3109
|
+
uint32_t index);
|
3006
3110
|
|
3007
3111
|
V8_DEPRECATED("Use maybe version",
|
3008
3112
|
bool SetAccessor(Local<String> name,
|
@@ -3018,8 +3122,8 @@ class V8_EXPORT Object : public Value {
|
|
3018
3122
|
Local<Value> data = Local<Value>(),
|
3019
3123
|
AccessControl settings = DEFAULT,
|
3020
3124
|
PropertyAttribute attribute = None));
|
3021
|
-
|
3022
|
-
|
3125
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(Local<Context> context,
|
3126
|
+
Local<Name> name,
|
3023
3127
|
AccessorNameGetterCallback getter,
|
3024
3128
|
AccessorNameSetterCallback setter = 0,
|
3025
3129
|
MaybeLocal<Value> data = MaybeLocal<Value>(),
|
@@ -3719,6 +3823,10 @@ class V8_EXPORT Function : public Object {
|
|
3719
3823
|
static void CheckCast(Value* obj);
|
3720
3824
|
};
|
3721
3825
|
|
3826
|
+
#ifndef V8_PROMISE_INTERNAL_FIELD_COUNT
|
3827
|
+
// The number of required internal fields can be defined by embedder.
|
3828
|
+
#define V8_PROMISE_INTERNAL_FIELD_COUNT 0
|
3829
|
+
#endif
|
3722
3830
|
|
3723
3831
|
/**
|
3724
3832
|
* An instance of the built-in Promise constructor (ES6 draft).
|
@@ -3751,12 +3859,12 @@ class V8_EXPORT Promise : public Object {
|
|
3751
3859
|
* Ignored if the promise is no longer pending.
|
3752
3860
|
*/
|
3753
3861
|
V8_DEPRECATE_SOON("Use maybe version", void Resolve(Local<Value> value));
|
3754
|
-
|
3755
|
-
|
3862
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> Resolve(Local<Context> context,
|
3863
|
+
Local<Value> value);
|
3756
3864
|
|
3757
3865
|
V8_DEPRECATE_SOON("Use maybe version", void Reject(Local<Value> value));
|
3758
|
-
|
3759
|
-
|
3866
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> Reject(Local<Context> context,
|
3867
|
+
Local<Value> value);
|
3760
3868
|
|
3761
3869
|
V8_INLINE static Resolver* Cast(Value* obj);
|
3762
3870
|
|
@@ -3800,6 +3908,8 @@ class V8_EXPORT Promise : public Object {
|
|
3800
3908
|
|
3801
3909
|
V8_INLINE static Promise* Cast(Value* obj);
|
3802
3910
|
|
3911
|
+
static const int kEmbedderFieldCount = V8_PROMISE_INTERNAL_FIELD_COUNT;
|
3912
|
+
|
3803
3913
|
private:
|
3804
3914
|
Promise();
|
3805
3915
|
static void CheckCast(Value* obj);
|
@@ -3903,11 +4013,44 @@ class V8_EXPORT Proxy : public Object {
|
|
3903
4013
|
static void CheckCast(Value* obj);
|
3904
4014
|
};
|
3905
4015
|
|
4016
|
+
// TODO(mtrofin): rename WasmCompiledModule to WasmModuleObject, for
|
4017
|
+
// consistency with internal APIs.
|
3906
4018
|
class V8_EXPORT WasmCompiledModule : public Object {
|
3907
4019
|
public:
|
3908
4020
|
typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule;
|
3909
4021
|
// A buffer that is owned by the caller.
|
3910
4022
|
typedef std::pair<const uint8_t*, size_t> CallerOwnedBuffer;
|
4023
|
+
|
4024
|
+
// An opaque, native heap object for transferring wasm modules. It
|
4025
|
+
// supports move semantics, and does not support copy semantics.
|
4026
|
+
class TransferrableModule final {
|
4027
|
+
public:
|
4028
|
+
TransferrableModule(TransferrableModule&& src) = default;
|
4029
|
+
TransferrableModule(const TransferrableModule& src) = delete;
|
4030
|
+
|
4031
|
+
TransferrableModule& operator=(TransferrableModule&& src) = default;
|
4032
|
+
TransferrableModule& operator=(const TransferrableModule& src) = delete;
|
4033
|
+
|
4034
|
+
private:
|
4035
|
+
typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> OwnedBuffer;
|
4036
|
+
friend class WasmCompiledModule;
|
4037
|
+
TransferrableModule(OwnedBuffer&& code, OwnedBuffer&& bytes)
|
4038
|
+
: compiled_code(std::move(code)), wire_bytes(std::move(bytes)) {}
|
4039
|
+
|
4040
|
+
OwnedBuffer compiled_code = {nullptr, 0};
|
4041
|
+
OwnedBuffer wire_bytes = {nullptr, 0};
|
4042
|
+
};
|
4043
|
+
|
4044
|
+
// Get an in-memory, non-persistable, and context-independent (meaning,
|
4045
|
+
// suitable for transfer to another Isolate and Context) representation
|
4046
|
+
// of this wasm compiled module.
|
4047
|
+
TransferrableModule GetTransferrableModule();
|
4048
|
+
|
4049
|
+
// Efficiently re-create a WasmCompiledModule, without recompiling, from
|
4050
|
+
// a TransferrableModule.
|
4051
|
+
static MaybeLocal<WasmCompiledModule> FromTransferrableModule(
|
4052
|
+
Isolate* isolate, const TransferrableModule&);
|
4053
|
+
|
3911
4054
|
// Get the wasm-encoded bytes that were used to compile this module.
|
3912
4055
|
Local<String> GetWasmWireBytes();
|
3913
4056
|
|
@@ -3923,16 +4066,49 @@ class V8_EXPORT WasmCompiledModule : public Object {
|
|
3923
4066
|
V8_INLINE static WasmCompiledModule* Cast(Value* obj);
|
3924
4067
|
|
3925
4068
|
private:
|
4069
|
+
// TODO(ahaas): please remove the friend once streamed compilation is
|
4070
|
+
// implemented
|
4071
|
+
friend class WasmModuleObjectBuilder;
|
4072
|
+
|
3926
4073
|
static MaybeLocal<WasmCompiledModule> Deserialize(
|
3927
4074
|
Isolate* isolate, const CallerOwnedBuffer& serialized_module,
|
3928
4075
|
const CallerOwnedBuffer& wire_bytes);
|
3929
4076
|
static MaybeLocal<WasmCompiledModule> Compile(Isolate* isolate,
|
3930
4077
|
const uint8_t* start,
|
3931
4078
|
size_t length);
|
4079
|
+
static CallerOwnedBuffer AsCallerOwned(
|
4080
|
+
const TransferrableModule::OwnedBuffer& buff) {
|
4081
|
+
return {buff.first.get(), buff.second};
|
4082
|
+
}
|
4083
|
+
|
3932
4084
|
WasmCompiledModule();
|
3933
4085
|
static void CheckCast(Value* obj);
|
3934
4086
|
};
|
3935
4087
|
|
4088
|
+
class V8_EXPORT WasmModuleObjectBuilder final {
|
4089
|
+
public:
|
4090
|
+
WasmModuleObjectBuilder(Isolate* isolate) : isolate_(isolate) {}
|
4091
|
+
// The buffer passed into OnBytesReceived is owned by the caller.
|
4092
|
+
void OnBytesReceived(const uint8_t*, size_t size);
|
4093
|
+
MaybeLocal<WasmCompiledModule> Finish();
|
4094
|
+
|
4095
|
+
private:
|
4096
|
+
Isolate* isolate_ = nullptr;
|
4097
|
+
// TODO(ahaas): We probably need none of this below here once streamed
|
4098
|
+
// compilation is implemented.
|
4099
|
+
typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> Buffer;
|
4100
|
+
|
4101
|
+
// Disable copy semantics *in this implementation*. We can choose to
|
4102
|
+
// relax this, albeit it's not clear why.
|
4103
|
+
WasmModuleObjectBuilder(const WasmModuleObjectBuilder&) = delete;
|
4104
|
+
WasmModuleObjectBuilder(WasmModuleObjectBuilder&&) = default;
|
4105
|
+
WasmModuleObjectBuilder& operator=(const WasmModuleObjectBuilder&) = delete;
|
4106
|
+
WasmModuleObjectBuilder& operator=(WasmModuleObjectBuilder&&) = default;
|
4107
|
+
|
4108
|
+
std::vector<Buffer> received_buffers_;
|
4109
|
+
size_t total_size_ = 0;
|
4110
|
+
};
|
4111
|
+
|
3936
4112
|
#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
|
3937
4113
|
// The number of required internal fields can be defined by embedder.
|
3938
4114
|
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
|
@@ -3987,7 +4163,8 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
3987
4163
|
/**
|
3988
4164
|
* malloc/free based convenience allocator.
|
3989
4165
|
*
|
3990
|
-
* Caller takes ownership.
|
4166
|
+
* Caller takes ownership, i.e. the returned object needs to be freed using
|
4167
|
+
* |delete allocator| once it is no longer in use.
|
3991
4168
|
*/
|
3992
4169
|
static Allocator* NewDefaultAllocator();
|
3993
4170
|
};
|
@@ -4031,8 +4208,11 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
4031
4208
|
/**
|
4032
4209
|
* Create a new ArrayBuffer over an existing memory block.
|
4033
4210
|
* The created array buffer is by default immediately in externalized state.
|
4034
|
-
*
|
4035
|
-
* is garbage-collected.
|
4211
|
+
* In externalized state, the memory block will not be reclaimed when a
|
4212
|
+
* created ArrayBuffer is garbage-collected.
|
4213
|
+
* In internalized state, the memory block will be released using
|
4214
|
+
* |Allocator::Free| once all ArrayBuffers referencing it are collected by
|
4215
|
+
* the garbage collector.
|
4036
4216
|
*/
|
4037
4217
|
static Local<ArrayBuffer> New(
|
4038
4218
|
Isolate* isolate, void* data, size_t byte_length,
|
@@ -4083,6 +4263,7 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
4083
4263
|
V8_INLINE static ArrayBuffer* Cast(Value* obj);
|
4084
4264
|
|
4085
4265
|
static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
|
4266
|
+
static const int kEmbedderFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
|
4086
4267
|
|
4087
4268
|
private:
|
4088
4269
|
ArrayBuffer();
|
@@ -4136,6 +4317,8 @@ class V8_EXPORT ArrayBufferView : public Object {
|
|
4136
4317
|
|
4137
4318
|
static const int kInternalFieldCount =
|
4138
4319
|
V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT;
|
4320
|
+
static const int kEmbedderFieldCount =
|
4321
|
+
V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT;
|
4139
4322
|
|
4140
4323
|
private:
|
4141
4324
|
ArrayBufferView();
|
@@ -4545,11 +4728,12 @@ class V8_EXPORT RegExp : public Object {
|
|
4545
4728
|
*/
|
4546
4729
|
enum Flags {
|
4547
4730
|
kNone = 0,
|
4548
|
-
kGlobal = 1,
|
4549
|
-
kIgnoreCase =
|
4550
|
-
kMultiline =
|
4551
|
-
kSticky =
|
4552
|
-
kUnicode =
|
4731
|
+
kGlobal = 1 << 0,
|
4732
|
+
kIgnoreCase = 1 << 1,
|
4733
|
+
kMultiline = 1 << 2,
|
4734
|
+
kSticky = 1 << 3,
|
4735
|
+
kUnicode = 1 << 4,
|
4736
|
+
kDotAll = 1 << 5,
|
4553
4737
|
};
|
4554
4738
|
|
4555
4739
|
/**
|
@@ -4600,8 +4784,12 @@ class V8_EXPORT External : public Value {
|
|
4600
4784
|
static void CheckCast(v8::Value* obj);
|
4601
4785
|
};
|
4602
4786
|
|
4603
|
-
|
4604
|
-
|
4787
|
+
#define V8_INTRINSICS_LIST(F) \
|
4788
|
+
F(ArrayProto_entries, array_entries_iterator) \
|
4789
|
+
F(ArrayProto_forEach, array_for_each_iterator) \
|
4790
|
+
F(ArrayProto_keys, array_keys_iterator) \
|
4791
|
+
F(ArrayProto_values, array_values_iterator) \
|
4792
|
+
F(IteratorPrototype, initial_iterator_prototype)
|
4605
4793
|
|
4606
4794
|
enum Intrinsic {
|
4607
4795
|
#define V8_DECL_INTRINSIC(name, iname) k##name,
|
@@ -5097,16 +5285,6 @@ class V8_EXPORT FunctionTemplate : public Template {
|
|
5097
5285
|
static MaybeLocal<FunctionTemplate> FromSnapshot(Isolate* isolate,
|
5098
5286
|
size_t index);
|
5099
5287
|
|
5100
|
-
/**
|
5101
|
-
* Creates a function template with a fast handler. If a fast handler is set,
|
5102
|
-
* the callback cannot be null.
|
5103
|
-
*/
|
5104
|
-
static Local<FunctionTemplate> NewWithFastHandler(
|
5105
|
-
Isolate* isolate, FunctionCallback callback,
|
5106
|
-
experimental::FastAccessorBuilder* fast_handler = nullptr,
|
5107
|
-
Local<Value> data = Local<Value>(),
|
5108
|
-
Local<Signature> signature = Local<Signature>(), int length = 0);
|
5109
|
-
|
5110
5288
|
/**
|
5111
5289
|
* Creates a function template backed/cached by a private property.
|
5112
5290
|
*/
|
@@ -5134,9 +5312,8 @@ class V8_EXPORT FunctionTemplate : public Template {
|
|
5134
5312
|
* callback is called whenever the function created from this
|
5135
5313
|
* FunctionTemplate is called.
|
5136
5314
|
*/
|
5137
|
-
void SetCallHandler(
|
5138
|
-
|
5139
|
-
experimental::FastAccessorBuilder* fast_handler = nullptr);
|
5315
|
+
void SetCallHandler(FunctionCallback callback,
|
5316
|
+
Local<Value> data = Local<Value>());
|
5140
5317
|
|
5141
5318
|
/** Set the predefined length property for the FunctionTemplate. */
|
5142
5319
|
void SetLength(int length);
|
@@ -5799,6 +5976,25 @@ typedef void (*BeforeCallEnteredCallback)(Isolate*);
|
|
5799
5976
|
typedef void (*CallCompletedCallback)(Isolate*);
|
5800
5977
|
typedef void (*DeprecatedCallCompletedCallback)();
|
5801
5978
|
|
5979
|
+
/**
|
5980
|
+
* HostImportDynamicallyCallback is called when we require the
|
5981
|
+
* embedder to load a module. This is used as part of the dynamic
|
5982
|
+
* import syntax. The behavior of this callback is not specified in
|
5983
|
+
* EcmaScript.
|
5984
|
+
*
|
5985
|
+
* The referrer is the name of the file which calls the dynamic
|
5986
|
+
* import. The referrer can be used to resolve the module location.
|
5987
|
+
*
|
5988
|
+
* The specifier is the name of the module that should be imported.
|
5989
|
+
*
|
5990
|
+
* The DynamicImportResult object is used to signal success or failure
|
5991
|
+
* by calling it's respective methods.
|
5992
|
+
*
|
5993
|
+
*/
|
5994
|
+
typedef void (*HostImportModuleDynamicallyCallback)(
|
5995
|
+
Isolate* isolate, Local<String> referrer, Local<String> specifier,
|
5996
|
+
Local<DynamicImportResult> result);
|
5997
|
+
|
5802
5998
|
/**
|
5803
5999
|
* PromiseHook with type kInit is called when a new promise is
|
5804
6000
|
* created. When a new promise is created as part of the chain in the
|
@@ -5923,19 +6119,7 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
|
|
5923
6119
|
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context);
|
5924
6120
|
|
5925
6121
|
// --- WASM compilation callbacks ---
|
5926
|
-
|
5927
|
-
/**
|
5928
|
-
* Callback to check if a buffer source may be compiled to WASM, given
|
5929
|
-
* the compilation is attempted as a promise or not.
|
5930
|
-
*/
|
5931
|
-
|
5932
|
-
typedef bool (*AllowWasmCompileCallback)(Isolate* isolate, Local<Value> source,
|
5933
|
-
bool as_promise);
|
5934
|
-
|
5935
|
-
typedef bool (*AllowWasmInstantiateCallback)(Isolate* isolate,
|
5936
|
-
Local<Value> module_or_bytes,
|
5937
|
-
MaybeLocal<Value> ffi,
|
5938
|
-
bool as_promise);
|
6122
|
+
typedef bool (*ExtensionCallback)(const FunctionCallbackInfo<Value>&);
|
5939
6123
|
|
5940
6124
|
// --- Garbage Collection Callbacks ---
|
5941
6125
|
|
@@ -5998,6 +6182,12 @@ class V8_EXPORT HeapStatistics {
|
|
5998
6182
|
size_t heap_size_limit() { return heap_size_limit_; }
|
5999
6183
|
size_t malloced_memory() { return malloced_memory_; }
|
6000
6184
|
size_t peak_malloced_memory() { return peak_malloced_memory_; }
|
6185
|
+
|
6186
|
+
/**
|
6187
|
+
* Returns a 0/1 boolean, which signifies whether the |--zap_code_space|
|
6188
|
+
* option is enabled or not, which makes V8 overwrite heap garbage with a bit
|
6189
|
+
* pattern.
|
6190
|
+
*/
|
6001
6191
|
size_t does_zap_garbage() { return does_zap_garbage_; }
|
6002
6192
|
|
6003
6193
|
private:
|
@@ -6246,7 +6436,7 @@ class V8_EXPORT EmbedderHeapTracer {
|
|
6246
6436
|
* wrappers from them when called through |AdvanceTracing|.
|
6247
6437
|
*/
|
6248
6438
|
virtual void RegisterV8References(
|
6249
|
-
const std::vector<std::pair<void*, void*> >&
|
6439
|
+
const std::vector<std::pair<void*, void*> >& embedder_fields) = 0;
|
6250
6440
|
|
6251
6441
|
/**
|
6252
6442
|
* Called at the beginning of a GC cycle.
|
@@ -6309,6 +6499,9 @@ struct SerializeInternalFieldsCallback {
|
|
6309
6499
|
CallbackFunction callback;
|
6310
6500
|
void* data;
|
6311
6501
|
};
|
6502
|
+
// Note that these fields are called "internal fields" in the API and called
|
6503
|
+
// "embedder fields" within V8.
|
6504
|
+
typedef SerializeInternalFieldsCallback SerializeEmbedderFieldsCallback;
|
6312
6505
|
|
6313
6506
|
/**
|
6314
6507
|
* Callback and supporting data used to implement embedder logic to deserialize
|
@@ -6324,6 +6517,7 @@ struct DeserializeInternalFieldsCallback {
|
|
6324
6517
|
void* data);
|
6325
6518
|
void* data;
|
6326
6519
|
};
|
6520
|
+
typedef DeserializeInternalFieldsCallback DeserializeEmbedderFieldsCallback;
|
6327
6521
|
|
6328
6522
|
/**
|
6329
6523
|
* Isolate represents an isolated instance of the V8 engine. V8 isolates have
|
@@ -6347,14 +6541,17 @@ class V8_EXPORT Isolate {
|
|
6347
6541
|
create_histogram_callback(nullptr),
|
6348
6542
|
add_histogram_sample_callback(nullptr),
|
6349
6543
|
array_buffer_allocator(nullptr),
|
6350
|
-
external_references(nullptr)
|
6544
|
+
external_references(nullptr),
|
6545
|
+
allow_atomics_wait(true),
|
6546
|
+
host_import_module_dynamically_callback_(nullptr) {}
|
6351
6547
|
|
6352
6548
|
/**
|
6353
6549
|
* The optional entry_hook allows the host application to provide the
|
6354
6550
|
* address of a function that's invoked on entry to every V8-generated
|
6355
6551
|
* function. Note that entry_hook is invoked at the very start of each
|
6356
|
-
* generated function.
|
6357
|
-
*
|
6552
|
+
* generated function.
|
6553
|
+
* An entry_hook can only be provided in no-snapshot builds; in snapshot
|
6554
|
+
* builds it must be nullptr.
|
6358
6555
|
*/
|
6359
6556
|
FunctionEntryHook entry_hook;
|
6360
6557
|
|
@@ -6403,6 +6600,22 @@ class V8_EXPORT Isolate {
|
|
6403
6600
|
* entire lifetime of the isolate.
|
6404
6601
|
*/
|
6405
6602
|
intptr_t* external_references;
|
6603
|
+
|
6604
|
+
/**
|
6605
|
+
* Whether calling Atomics.wait (a function that may block) is allowed in
|
6606
|
+
* this isolate.
|
6607
|
+
*/
|
6608
|
+
bool allow_atomics_wait;
|
6609
|
+
|
6610
|
+
/**
|
6611
|
+
* This is an unfinished experimental feature, and is only exposed
|
6612
|
+
* here for internal testing purposes. DO NOT USE.
|
6613
|
+
*
|
6614
|
+
* This specifies the callback called by the upcoming dynamic
|
6615
|
+
* import() language feature to load modules.
|
6616
|
+
*/
|
6617
|
+
HostImportModuleDynamicallyCallback
|
6618
|
+
host_import_module_dynamically_callback_;
|
6406
6619
|
};
|
6407
6620
|
|
6408
6621
|
|
@@ -6628,6 +6841,12 @@ class V8_EXPORT Isolate {
|
|
6628
6841
|
*/
|
6629
6842
|
void Dispose();
|
6630
6843
|
|
6844
|
+
/**
|
6845
|
+
* Dumps activated low-level V8 internal stats. This can be used instead
|
6846
|
+
* of performing a full isolate disposal.
|
6847
|
+
*/
|
6848
|
+
void DumpAndResetStats();
|
6849
|
+
|
6631
6850
|
/**
|
6632
6851
|
* Discards all V8 thread-specific data for the Isolate. Should be used
|
6633
6852
|
* if a thread is terminating and it has used an Isolate that will outlive
|
@@ -6776,6 +6995,14 @@ class V8_EXPORT Isolate {
|
|
6776
6995
|
/** Returns the last context entered through V8's C++ API. */
|
6777
6996
|
Local<Context> GetEnteredContext();
|
6778
6997
|
|
6998
|
+
/**
|
6999
|
+
* Returns either the last context entered through V8's C++ API, or the
|
7000
|
+
* context of the currently running microtask while processing microtasks.
|
7001
|
+
* If a context is entered while executing a microtask, that context is
|
7002
|
+
* returned.
|
7003
|
+
*/
|
7004
|
+
Local<Context> GetEnteredOrMicrotaskContext();
|
7005
|
+
|
6779
7006
|
/**
|
6780
7007
|
* Schedules an exception to be thrown when returning to JavaScript. When an
|
6781
7008
|
* exception has been scheduled it is illegal to invoke any JavaScript
|
@@ -6784,45 +7011,6 @@ class V8_EXPORT Isolate {
|
|
6784
7011
|
*/
|
6785
7012
|
Local<Value> ThrowException(Local<Value> exception);
|
6786
7013
|
|
6787
|
-
/**
|
6788
|
-
* Allows the host application to group objects together. If one
|
6789
|
-
* object in the group is alive, all objects in the group are alive.
|
6790
|
-
* After each garbage collection, object groups are removed. It is
|
6791
|
-
* intended to be used in the before-garbage-collection callback
|
6792
|
-
* function, for instance to simulate DOM tree connections among JS
|
6793
|
-
* wrapper objects. Object groups for all dependent handles need to
|
6794
|
-
* be provided for kGCTypeMarkSweepCompact collections, for all other
|
6795
|
-
* garbage collection types it is sufficient to provide object groups
|
6796
|
-
* for partially dependent handles only.
|
6797
|
-
*/
|
6798
|
-
template <typename T>
|
6799
|
-
V8_DEPRECATE_SOON("Use EmbedderHeapTracer",
|
6800
|
-
void SetObjectGroupId(const Persistent<T>& object,
|
6801
|
-
UniqueId id));
|
6802
|
-
|
6803
|
-
/**
|
6804
|
-
* Allows the host application to declare implicit references from an object
|
6805
|
-
* group to an object. If the objects of the object group are alive, the child
|
6806
|
-
* object is alive too. After each garbage collection, all implicit references
|
6807
|
-
* are removed. It is intended to be used in the before-garbage-collection
|
6808
|
-
* callback function.
|
6809
|
-
*/
|
6810
|
-
template <typename T>
|
6811
|
-
V8_DEPRECATE_SOON("Use EmbedderHeapTracer",
|
6812
|
-
void SetReferenceFromGroup(UniqueId id,
|
6813
|
-
const Persistent<T>& child));
|
6814
|
-
|
6815
|
-
/**
|
6816
|
-
* Allows the host application to declare implicit references from an object
|
6817
|
-
* to another object. If the parent object is alive, the child object is alive
|
6818
|
-
* too. After each garbage collection, all implicit references are removed. It
|
6819
|
-
* is intended to be used in the before-garbage-collection callback function.
|
6820
|
-
*/
|
6821
|
-
template <typename T, typename S>
|
6822
|
-
V8_DEPRECATE_SOON("Use EmbedderHeapTracer",
|
6823
|
-
void SetReference(const Persistent<T>& parent,
|
6824
|
-
const Persistent<S>& child));
|
6825
|
-
|
6826
7014
|
typedef void (*GCCallback)(Isolate* isolate, GCType type,
|
6827
7015
|
GCCallbackFlags flags);
|
6828
7016
|
|
@@ -7184,14 +7372,12 @@ class V8_EXPORT Isolate {
|
|
7184
7372
|
AllowCodeGenerationFromStringsCallback callback);
|
7185
7373
|
|
7186
7374
|
/**
|
7187
|
-
*
|
7188
|
-
* the specified object is allowed. By default, wasm compilation
|
7189
|
-
* is allowed.
|
7190
|
-
*
|
7191
|
-
* Similar for instantiate.
|
7375
|
+
* Embedder over{ride|load} injection points for wasm APIs.
|
7192
7376
|
*/
|
7193
|
-
void
|
7194
|
-
void
|
7377
|
+
void SetWasmModuleCallback(ExtensionCallback callback);
|
7378
|
+
void SetWasmCompileCallback(ExtensionCallback callback);
|
7379
|
+
void SetWasmInstanceCallback(ExtensionCallback callback);
|
7380
|
+
void SetWasmInstantiateCallback(ExtensionCallback callback);
|
7195
7381
|
|
7196
7382
|
/**
|
7197
7383
|
* Check if V8 is dead and therefore unusable. This is the case after
|
@@ -7288,9 +7474,6 @@ class V8_EXPORT Isolate {
|
|
7288
7474
|
template <class K, class V, class Traits>
|
7289
7475
|
friend class PersistentValueMapBase;
|
7290
7476
|
|
7291
|
-
void SetObjectGroupId(internal::Object** object, UniqueId id);
|
7292
|
-
void SetReferenceFromGroup(UniqueId id, internal::Object** object);
|
7293
|
-
void SetReference(internal::Object** parent, internal::Object** child);
|
7294
7477
|
void ReportExternalAllocationLimitReached();
|
7295
7478
|
};
|
7296
7479
|
|
@@ -7651,6 +7834,35 @@ class V8_EXPORT V8 {
|
|
7651
7834
|
*/
|
7652
7835
|
static void ShutdownPlatform();
|
7653
7836
|
|
7837
|
+
#if V8_OS_LINUX && V8_TARGET_ARCH_X64 && !V8_OS_ANDROID
|
7838
|
+
/**
|
7839
|
+
* Give the V8 signal handler a chance to handle a fault.
|
7840
|
+
*
|
7841
|
+
* This function determines whether a memory access violation can be recovered
|
7842
|
+
* by V8. If so, it will return true and modify context to return to a code
|
7843
|
+
* fragment that can recover from the fault. Otherwise, TryHandleSignal will
|
7844
|
+
* return false.
|
7845
|
+
*
|
7846
|
+
* The parameters to this function correspond to those passed to a Linux
|
7847
|
+
* signal handler.
|
7848
|
+
*
|
7849
|
+
* \param signal_number The signal number.
|
7850
|
+
*
|
7851
|
+
* \param info A pointer to the siginfo_t structure provided to the signal
|
7852
|
+
* handler.
|
7853
|
+
*
|
7854
|
+
* \param context The third argument passed to the Linux signal handler, which
|
7855
|
+
* points to a ucontext_t structure.
|
7856
|
+
*/
|
7857
|
+
static bool TryHandleSignal(int signal_number, void* info, void* context);
|
7858
|
+
#endif // V8_OS_LINUX
|
7859
|
+
|
7860
|
+
/**
|
7861
|
+
* Enable the default signal handler rather than using one provided by the
|
7862
|
+
* embedder.
|
7863
|
+
*/
|
7864
|
+
static bool RegisterDefaultSignalHandler();
|
7865
|
+
|
7654
7866
|
private:
|
7655
7867
|
V8();
|
7656
7868
|
|
@@ -7669,10 +7881,7 @@ class V8_EXPORT V8 {
|
|
7669
7881
|
WeakCallbackInfo<void>::Callback weak_callback);
|
7670
7882
|
static void MakeWeak(internal::Object*** location_addr);
|
7671
7883
|
static void* ClearWeak(internal::Object** location);
|
7672
|
-
static
|
7673
|
-
Value* handle,
|
7674
|
-
int* index);
|
7675
|
-
static Local<Value> GetEternal(Isolate* isolate, int index);
|
7884
|
+
static Value* Eternalize(Isolate* isolate, Value* handle);
|
7676
7885
|
|
7677
7886
|
static void RegisterExternallyReferencedObject(internal::Object** object,
|
7678
7887
|
internal::Isolate* isolate);
|
@@ -7780,20 +7989,33 @@ class Maybe {
|
|
7780
7989
|
V8_INLINE bool IsNothing() const { return !has_value_; }
|
7781
7990
|
V8_INLINE bool IsJust() const { return has_value_; }
|
7782
7991
|
|
7783
|
-
|
7992
|
+
/**
|
7993
|
+
* An alias for |FromJust|. Will crash if the Maybe<> is nothing.
|
7994
|
+
*/
|
7784
7995
|
V8_INLINE T ToChecked() const { return FromJust(); }
|
7785
7996
|
|
7997
|
+
/**
|
7998
|
+
* Converts this Maybe<> to a value of type T. If this Maybe<> is
|
7999
|
+
* nothing (empty), |false| is returned and |out| is left untouched.
|
8000
|
+
*/
|
7786
8001
|
V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
|
7787
8002
|
if (V8_LIKELY(IsJust())) *out = value_;
|
7788
8003
|
return IsJust();
|
7789
8004
|
}
|
7790
8005
|
|
7791
|
-
|
8006
|
+
/**
|
8007
|
+
* Converts this Maybe<> to a value of type T. If this Maybe<> is
|
8008
|
+
* nothing (empty), V8 will crash the process.
|
8009
|
+
*/
|
7792
8010
|
V8_INLINE T FromJust() const {
|
7793
8011
|
if (V8_UNLIKELY(!IsJust())) V8::FromJustIsNothing();
|
7794
8012
|
return value_;
|
7795
8013
|
}
|
7796
8014
|
|
8015
|
+
/**
|
8016
|
+
* Converts this Maybe<> to a value of type T, using a default value if this
|
8017
|
+
* Maybe<> is nothing (empty).
|
8018
|
+
*/
|
7797
8019
|
V8_INLINE T FromMaybe(const T& default_value) const {
|
7798
8020
|
return has_value_ ? value_ : default_value;
|
7799
8021
|
}
|
@@ -8067,7 +8289,7 @@ class V8_EXPORT Context {
|
|
8067
8289
|
* \param context_snapshot_index The index of the context snapshot to
|
8068
8290
|
* deserialize from. Use v8::Context::New for the default snapshot.
|
8069
8291
|
*
|
8070
|
-
* \param
|
8292
|
+
* \param embedder_fields_deserializer Optional callback to deserialize
|
8071
8293
|
* internal fields. It should match the SerializeInternalFieldCallback used
|
8072
8294
|
* to serialize.
|
8073
8295
|
*
|
@@ -8078,7 +8300,7 @@ class V8_EXPORT Context {
|
|
8078
8300
|
|
8079
8301
|
static MaybeLocal<Context> FromSnapshot(
|
8080
8302
|
Isolate* isolate, size_t context_snapshot_index,
|
8081
|
-
DeserializeInternalFieldsCallback
|
8303
|
+
DeserializeInternalFieldsCallback embedder_fields_deserializer =
|
8082
8304
|
DeserializeInternalFieldsCallback(),
|
8083
8305
|
ExtensionConfiguration* extensions = nullptr,
|
8084
8306
|
MaybeLocal<Value> global_object = MaybeLocal<Value>());
|
@@ -8208,7 +8430,7 @@ class V8_EXPORT Context {
|
|
8208
8430
|
/**
|
8209
8431
|
* Estimate the memory in bytes retained by this context.
|
8210
8432
|
*/
|
8211
|
-
size_t EstimatedSize();
|
8433
|
+
V8_DEPRECATED("no longer supported", size_t EstimatedSize());
|
8212
8434
|
|
8213
8435
|
/**
|
8214
8436
|
* Stack-allocated class which sets the execution context for all
|
@@ -8463,10 +8685,10 @@ class Internals {
|
|
8463
8685
|
static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
|
8464
8686
|
static const int kContextHeaderSize = 2 * kApiPointerSize;
|
8465
8687
|
static const int kContextEmbedderDataIndex = 5;
|
8466
|
-
static const int kFullStringRepresentationMask =
|
8467
|
-
static const int kStringEncodingMask =
|
8688
|
+
static const int kFullStringRepresentationMask = 0x0f;
|
8689
|
+
static const int kStringEncodingMask = 0x8;
|
8468
8690
|
static const int kExternalTwoByteRepresentationTag = 0x02;
|
8469
|
-
static const int kExternalOneByteRepresentationTag =
|
8691
|
+
static const int kExternalOneByteRepresentationTag = 0x0a;
|
8470
8692
|
|
8471
8693
|
static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize;
|
8472
8694
|
static const int kExternalMemoryOffset = 4 * kApiPointerSize;
|
@@ -8494,8 +8716,8 @@ class Internals {
|
|
8494
8716
|
static const int kJSApiObjectType = 0xbb;
|
8495
8717
|
static const int kJSObjectType = 0xbc;
|
8496
8718
|
static const int kFirstNonstringType = 0x80;
|
8497
|
-
static const int kOddballType =
|
8498
|
-
static const int kForeignType =
|
8719
|
+
static const int kOddballType = 0x82;
|
8720
|
+
static const int kForeignType = 0x86;
|
8499
8721
|
|
8500
8722
|
static const int kUndefinedOddballKind = 5;
|
8501
8723
|
static const int kNullOddballKind = 3;
|
@@ -8637,13 +8859,15 @@ template<class T>
|
|
8637
8859
|
template<class S>
|
8638
8860
|
void Eternal<T>::Set(Isolate* isolate, Local<S> handle) {
|
8639
8861
|
TYPE_CHECK(T, S);
|
8640
|
-
|
8862
|
+
val_ = reinterpret_cast<T*>(
|
8863
|
+
V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle)));
|
8641
8864
|
}
|
8642
8865
|
|
8643
|
-
|
8644
|
-
|
8645
|
-
|
8646
|
-
|
8866
|
+
template <class T>
|
8867
|
+
Local<T> Eternal<T>::Get(Isolate* isolate) const {
|
8868
|
+
// The eternal handle will never go away, so as with the roots, we don't even
|
8869
|
+
// need to open a handle.
|
8870
|
+
return Local<T>(val_);
|
8647
8871
|
}
|
8648
8872
|
|
8649
8873
|
|
@@ -8657,11 +8881,11 @@ Local<T> MaybeLocal<T>::ToLocalChecked() {
|
|
8657
8881
|
template <class T>
|
8658
8882
|
void* WeakCallbackInfo<T>::GetInternalField(int index) const {
|
8659
8883
|
#ifdef V8_ENABLE_CHECKS
|
8660
|
-
if (index < 0 || index >=
|
8884
|
+
if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
|
8661
8885
|
V8::InternalFieldOutOfBounds(index);
|
8662
8886
|
}
|
8663
8887
|
#endif
|
8664
|
-
return
|
8888
|
+
return embedder_fields_[index];
|
8665
8889
|
}
|
8666
8890
|
|
8667
8891
|
|
@@ -9013,14 +9237,15 @@ ScriptOrigin::ScriptOrigin(Local<Value> resource_name,
|
|
9013
9237
|
Local<Integer> script_id,
|
9014
9238
|
Local<Value> source_map_url,
|
9015
9239
|
Local<Boolean> resource_is_opaque,
|
9016
|
-
Local<Boolean> is_wasm)
|
9240
|
+
Local<Boolean> is_wasm, Local<Boolean> is_module)
|
9017
9241
|
: resource_name_(resource_name),
|
9018
9242
|
resource_line_offset_(resource_line_offset),
|
9019
9243
|
resource_column_offset_(resource_column_offset),
|
9020
9244
|
options_(!resource_is_shared_cross_origin.IsEmpty() &&
|
9021
9245
|
resource_is_shared_cross_origin->IsTrue(),
|
9022
9246
|
!resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(),
|
9023
|
-
!is_wasm.IsEmpty() && is_wasm->IsTrue()
|
9247
|
+
!is_wasm.IsEmpty() && is_wasm->IsTrue(),
|
9248
|
+
!is_module.IsEmpty() && is_module->IsTrue()),
|
9024
9249
|
script_id_(script_id),
|
9025
9250
|
source_map_url_(source_map_url) {}
|
9026
9251
|
|
@@ -9069,13 +9294,16 @@ const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData()
|
|
9069
9294
|
return cached_data;
|
9070
9295
|
}
|
9071
9296
|
|
9297
|
+
const ScriptOriginOptions& ScriptCompiler::Source::GetResourceOptions() const {
|
9298
|
+
return resource_options;
|
9299
|
+
}
|
9072
9300
|
|
9073
9301
|
Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
|
9074
9302
|
return value ? True(isolate) : False(isolate);
|
9075
9303
|
}
|
9076
9304
|
|
9077
9305
|
void Template::Set(Isolate* isolate, const char* name, Local<Data> value) {
|
9078
|
-
Set(String::NewFromUtf8(isolate, name, NewStringType::
|
9306
|
+
Set(String::NewFromUtf8(isolate, name, NewStringType::kInternalized)
|
9079
9307
|
.ToLocalChecked(),
|
9080
9308
|
value);
|
9081
9309
|
}
|
@@ -9696,33 +9924,6 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
|
|
9696
9924
|
return *external_memory;
|
9697
9925
|
}
|
9698
9926
|
|
9699
|
-
|
9700
|
-
template<typename T>
|
9701
|
-
void Isolate::SetObjectGroupId(const Persistent<T>& object,
|
9702
|
-
UniqueId id) {
|
9703
|
-
TYPE_CHECK(Value, T);
|
9704
|
-
SetObjectGroupId(reinterpret_cast<internal::Object**>(object.val_), id);
|
9705
|
-
}
|
9706
|
-
|
9707
|
-
|
9708
|
-
template<typename T>
|
9709
|
-
void Isolate::SetReferenceFromGroup(UniqueId id,
|
9710
|
-
const Persistent<T>& object) {
|
9711
|
-
TYPE_CHECK(Value, T);
|
9712
|
-
SetReferenceFromGroup(id, reinterpret_cast<internal::Object**>(object.val_));
|
9713
|
-
}
|
9714
|
-
|
9715
|
-
|
9716
|
-
template<typename T, typename S>
|
9717
|
-
void Isolate::SetReference(const Persistent<T>& parent,
|
9718
|
-
const Persistent<S>& child) {
|
9719
|
-
TYPE_CHECK(Object, T);
|
9720
|
-
TYPE_CHECK(Value, S);
|
9721
|
-
SetReference(reinterpret_cast<internal::Object**>(parent.val_),
|
9722
|
-
reinterpret_cast<internal::Object**>(child.val_));
|
9723
|
-
}
|
9724
|
-
|
9725
|
-
|
9726
9927
|
Local<Value> Context::GetEmbedderData(int index) {
|
9727
9928
|
#ifndef V8_ENABLE_CHECKS
|
9728
9929
|
typedef internal::Object O;
|