libv8-node 19.9.0.0-arm64-darwin → 20.12.1.0-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +4 -2
- data/vendor/v8/include/cppgc/heap-consistency.h +2 -2
- data/vendor/v8/include/cppgc/heap-handle.h +5 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +4 -1
- data/vendor/v8/include/cppgc/internal/gc-info.h +35 -33
- data/vendor/v8/include/cppgc/internal/member-storage.h +19 -7
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +38 -2
- data/vendor/v8/include/cppgc/internal/write-barrier.h +15 -5
- data/vendor/v8/include/cppgc/macros.h +10 -1
- data/vendor/v8/include/cppgc/member.h +167 -129
- data/vendor/v8/include/cppgc/persistent.h +22 -15
- data/vendor/v8/include/cppgc/platform.h +6 -4
- data/vendor/v8/include/cppgc/type-traits.h +4 -3
- data/vendor/v8/include/cppgc/visitor.h +16 -1
- data/vendor/v8/include/libplatform/v8-tracing.h +2 -2
- data/vendor/v8/include/v8-array-buffer.h +59 -0
- data/vendor/v8/include/v8-callbacks.h +14 -1
- data/vendor/v8/include/v8-context.h +50 -3
- data/vendor/v8/include/v8-cppgc.h +15 -0
- data/vendor/v8/include/v8-data.h +1 -1
- data/vendor/v8/include/v8-embedder-heap.h +0 -169
- data/vendor/v8/include/v8-fast-api-calls.h +7 -3
- data/vendor/v8/include/v8-function-callback.h +69 -42
- data/vendor/v8/include/v8-function.h +1 -0
- data/vendor/v8/include/v8-inspector.h +20 -5
- data/vendor/v8/include/v8-internal.h +242 -150
- data/vendor/v8/include/v8-isolate.h +30 -40
- data/vendor/v8/include/v8-local-handle.h +81 -48
- data/vendor/v8/include/v8-metrics.h +28 -2
- data/vendor/v8/include/v8-microtask-queue.h +5 -0
- data/vendor/v8/include/v8-object.h +38 -3
- data/vendor/v8/include/v8-persistent-handle.h +25 -16
- data/vendor/v8/include/v8-platform.h +79 -10
- data/vendor/v8/include/v8-primitive.h +19 -12
- data/vendor/v8/include/v8-profiler.h +59 -31
- data/vendor/v8/include/v8-script.h +32 -5
- data/vendor/v8/include/v8-snapshot.h +4 -8
- data/vendor/v8/include/v8-template.h +3 -1
- data/vendor/v8/include/v8-traced-handle.h +22 -28
- data/vendor/v8/include/v8-util.h +9 -3
- data/vendor/v8/include/v8-value.h +31 -4
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +2 -1
- data/vendor/v8/include/v8config.h +73 -2
- metadata +3 -3
@@ -55,7 +55,7 @@ class Eternal {
|
|
55
55
|
V8_INLINE Local<T> Get(Isolate* isolate) const {
|
56
56
|
// The eternal handle will never go away, so as with the roots, we don't
|
57
57
|
// even need to open a handle.
|
58
|
-
return Local<T>(val_);
|
58
|
+
return Local<T>(internal::ValueHelper::SlotAsValue<T>(val_));
|
59
59
|
}
|
60
60
|
|
61
61
|
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
|
@@ -68,6 +68,10 @@ class Eternal {
|
|
68
68
|
}
|
69
69
|
|
70
70
|
private:
|
71
|
+
V8_INLINE internal::Address address() const {
|
72
|
+
return *reinterpret_cast<internal::Address*>(val_);
|
73
|
+
}
|
74
|
+
|
71
75
|
T* val_;
|
72
76
|
};
|
73
77
|
|
@@ -122,20 +126,12 @@ class PersistentBase {
|
|
122
126
|
|
123
127
|
template <class S>
|
124
128
|
V8_INLINE bool operator==(const PersistentBase<S>& that) const {
|
125
|
-
|
126
|
-
internal::Address* b = reinterpret_cast<internal::Address*>(that.val_);
|
127
|
-
if (a == nullptr) return b == nullptr;
|
128
|
-
if (b == nullptr) return false;
|
129
|
-
return *a == *b;
|
129
|
+
return internal::HandleHelper::EqualHandles(*this, that);
|
130
130
|
}
|
131
131
|
|
132
132
|
template <class S>
|
133
133
|
V8_INLINE bool operator==(const Local<S>& that) const {
|
134
|
-
|
135
|
-
internal::Address* b = reinterpret_cast<internal::Address*>(that.val_);
|
136
|
-
if (a == nullptr) return b == nullptr;
|
137
|
-
if (b == nullptr) return false;
|
138
|
-
return *a == *b;
|
134
|
+
return internal::HandleHelper::EqualHandles(*this, that);
|
139
135
|
}
|
140
136
|
|
141
137
|
template <class S>
|
@@ -221,8 +217,15 @@ class PersistentBase {
|
|
221
217
|
template <class F1, class F2>
|
222
218
|
friend class PersistentValueVector;
|
223
219
|
friend class Object;
|
220
|
+
friend class internal::HandleHelper;
|
224
221
|
|
225
222
|
explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
|
223
|
+
V8_INLINE T* operator*() const { return this->val_; }
|
224
|
+
V8_INLINE internal::Address address() const {
|
225
|
+
return *reinterpret_cast<internal::Address*>(val_);
|
226
|
+
}
|
227
|
+
|
228
|
+
V8_INLINE static T* New(Isolate* isolate, Local<T> that);
|
226
229
|
V8_INLINE static T* New(Isolate* isolate, T* that);
|
227
230
|
|
228
231
|
T* val_;
|
@@ -282,11 +285,13 @@ class Persistent : public PersistentBase<T> {
|
|
282
285
|
* When the Local is non-empty, a new storage cell is created
|
283
286
|
* pointing to the same object, and no flags are set.
|
284
287
|
*/
|
288
|
+
|
285
289
|
template <class S>
|
286
290
|
V8_INLINE Persistent(Isolate* isolate, Local<S> that)
|
287
|
-
: PersistentBase<T>(PersistentBase<T>::New(isolate,
|
291
|
+
: PersistentBase<T>(PersistentBase<T>::New(isolate, that)) {
|
288
292
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
289
293
|
}
|
294
|
+
|
290
295
|
/**
|
291
296
|
* Construct a Persistent from a Persistent.
|
292
297
|
* When the Persistent is non-empty, a new storage cell is created
|
@@ -356,7 +361,6 @@ class Persistent : public PersistentBase<T> {
|
|
356
361
|
friend class ReturnValue;
|
357
362
|
|
358
363
|
explicit V8_INLINE Persistent(T* that) : PersistentBase<T>(that) {}
|
359
|
-
V8_INLINE T* operator*() const { return this->val_; }
|
360
364
|
template <class S, class M2>
|
361
365
|
V8_INLINE void Copy(const Persistent<S, M2>& that);
|
362
366
|
};
|
@@ -381,7 +385,7 @@ class Global : public PersistentBase<T> {
|
|
381
385
|
*/
|
382
386
|
template <class S>
|
383
387
|
V8_INLINE Global(Isolate* isolate, Local<S> that)
|
384
|
-
: PersistentBase<T>(PersistentBase<T>::New(isolate,
|
388
|
+
: PersistentBase<T>(PersistentBase<T>::New(isolate, that)) {
|
385
389
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
386
390
|
}
|
387
391
|
|
@@ -425,7 +429,6 @@ class Global : public PersistentBase<T> {
|
|
425
429
|
private:
|
426
430
|
template <class F>
|
427
431
|
friend class ReturnValue;
|
428
|
-
V8_INLINE T* operator*() const { return this->val_; }
|
429
432
|
};
|
430
433
|
|
431
434
|
// UniquePersistent is an alias for Global for historical reason.
|
@@ -442,6 +445,12 @@ class V8_EXPORT PersistentHandleVisitor {
|
|
442
445
|
uint16_t class_id) {}
|
443
446
|
};
|
444
447
|
|
448
|
+
template <class T>
|
449
|
+
T* PersistentBase<T>::New(Isolate* isolate, Local<T> that) {
|
450
|
+
return PersistentBase<T>::New(isolate,
|
451
|
+
internal::ValueHelper::ValueAsSlot(*that));
|
452
|
+
}
|
453
|
+
|
445
454
|
template <class T>
|
446
455
|
T* PersistentBase<T>::New(Isolate* isolate, T* that) {
|
447
456
|
if (that == nullptr) return nullptr;
|
@@ -486,7 +495,7 @@ void PersistentBase<T>::Reset(Isolate* isolate, const Local<S>& other) {
|
|
486
495
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
487
496
|
Reset();
|
488
497
|
if (other.IsEmpty()) return;
|
489
|
-
this->val_ = New(isolate, other
|
498
|
+
this->val_ = New(isolate, internal::ValueHelper::ValueAsSlot(*other));
|
490
499
|
}
|
491
500
|
|
492
501
|
/**
|
@@ -5,9 +5,11 @@
|
|
5
5
|
#ifndef V8_V8_PLATFORM_H_
|
6
6
|
#define V8_V8_PLATFORM_H_
|
7
7
|
|
8
|
+
#include <math.h>
|
8
9
|
#include <stddef.h>
|
9
10
|
#include <stdint.h>
|
10
11
|
#include <stdlib.h> // For abort.
|
12
|
+
|
11
13
|
#include <memory>
|
12
14
|
#include <string>
|
13
15
|
|
@@ -265,6 +267,38 @@ class JobTask {
|
|
265
267
|
virtual size_t GetMaxConcurrency(size_t worker_count) const = 0;
|
266
268
|
};
|
267
269
|
|
270
|
+
/**
|
271
|
+
* A "blocking call" refers to any call that causes the calling thread to wait
|
272
|
+
* off-CPU. It includes but is not limited to calls that wait on synchronous
|
273
|
+
* file I/O operations: read or write a file from disk, interact with a pipe or
|
274
|
+
* a socket, rename or delete a file, enumerate files in a directory, etc.
|
275
|
+
* Acquiring a low contention lock is not considered a blocking call.
|
276
|
+
*/
|
277
|
+
|
278
|
+
/**
|
279
|
+
* BlockingType indicates the likelihood that a blocking call will actually
|
280
|
+
* block.
|
281
|
+
*/
|
282
|
+
enum class BlockingType {
|
283
|
+
// The call might block (e.g. file I/O that might hit in memory cache).
|
284
|
+
kMayBlock,
|
285
|
+
// The call will definitely block (e.g. cache already checked and now pinging
|
286
|
+
// server synchronously).
|
287
|
+
kWillBlock
|
288
|
+
};
|
289
|
+
|
290
|
+
/**
|
291
|
+
* This class is instantiated with CreateBlockingScope() in every scope where a
|
292
|
+
* blocking call is made and serves as a precise annotation of the scope that
|
293
|
+
* may/will block. May be implemented by an embedder to adjust the thread count.
|
294
|
+
* CPU usage should be minimal within that scope. ScopedBlockingCalls can be
|
295
|
+
* nested.
|
296
|
+
*/
|
297
|
+
class ScopedBlockingCall {
|
298
|
+
public:
|
299
|
+
virtual ~ScopedBlockingCall() = default;
|
300
|
+
};
|
301
|
+
|
268
302
|
/**
|
269
303
|
* The interface represents complex arguments to trace events.
|
270
304
|
*/
|
@@ -285,6 +319,8 @@ class ConvertableToTraceFormat {
|
|
285
319
|
* V8 Tracing controller.
|
286
320
|
*
|
287
321
|
* Can be implemented by an embedder to record trace events from V8.
|
322
|
+
*
|
323
|
+
* Will become obsolete in Perfetto SDK build (v8_use_perfetto = true).
|
288
324
|
*/
|
289
325
|
class TracingController {
|
290
326
|
public:
|
@@ -348,10 +384,16 @@ class TracingController {
|
|
348
384
|
virtual void OnTraceDisabled() = 0;
|
349
385
|
};
|
350
386
|
|
351
|
-
/**
|
387
|
+
/**
|
388
|
+
* Adds tracing state change observer.
|
389
|
+
* Does nothing in Perfetto SDK build (v8_use_perfetto = true).
|
390
|
+
*/
|
352
391
|
virtual void AddTraceStateObserver(TraceStateObserver*) {}
|
353
392
|
|
354
|
-
/**
|
393
|
+
/**
|
394
|
+
* Removes tracing state change observer.
|
395
|
+
* Does nothing in Perfetto SDK build (v8_use_perfetto = true).
|
396
|
+
*/
|
355
397
|
virtual void RemoveTraceStateObserver(TraceStateObserver*) {}
|
356
398
|
};
|
357
399
|
|
@@ -534,7 +576,7 @@ static constexpr PlatformSharedMemoryHandle kInvalidSharedMemoryHandle = -1;
|
|
534
576
|
// to avoid pulling in large OS header files into this header file. Instead,
|
535
577
|
// the users of these routines are expected to include the respecitve OS
|
536
578
|
// headers in addition to this one.
|
537
|
-
#if
|
579
|
+
#if V8_OS_DARWIN
|
538
580
|
// Convert between a shared memory handle and a mach_port_t referencing a memory
|
539
581
|
// entry object.
|
540
582
|
inline PlatformSharedMemoryHandle SharedMemoryHandleFromMachMemoryEntry(
|
@@ -923,6 +965,7 @@ class Platform {
|
|
923
965
|
|
924
966
|
/**
|
925
967
|
* Allows the embedder to manage memory page allocations.
|
968
|
+
* Returning nullptr will cause V8 to use the default page allocator.
|
926
969
|
*/
|
927
970
|
virtual PageAllocator* GetPageAllocator() = 0;
|
928
971
|
|
@@ -944,11 +987,12 @@ class Platform {
|
|
944
987
|
virtual void OnCriticalMemoryPressure() {}
|
945
988
|
|
946
989
|
/**
|
947
|
-
* Gets the number of worker threads used
|
948
|
-
*
|
949
|
-
*
|
950
|
-
*
|
951
|
-
*
|
990
|
+
* Gets the max number of worker threads that may be used to execute
|
991
|
+
* concurrent work scheduled for any single TaskPriority by
|
992
|
+
* Call(BlockingTask)OnWorkerThread() or PostJob(). This can be used to
|
993
|
+
* estimate the number of tasks a work package should be split into. A return
|
994
|
+
* value of 0 means that there are no worker threads available. Note that a
|
995
|
+
* value of 0 won't prohibit V8 from posting tasks using |CallOnWorkerThread|.
|
952
996
|
*/
|
953
997
|
virtual int NumberOfWorkerThreads() = 0;
|
954
998
|
|
@@ -1063,6 +1107,14 @@ class Platform {
|
|
1063
1107
|
virtual std::unique_ptr<JobHandle> CreateJob(
|
1064
1108
|
TaskPriority priority, std::unique_ptr<JobTask> job_task) = 0;
|
1065
1109
|
|
1110
|
+
/**
|
1111
|
+
* Instantiates a ScopedBlockingCall to annotate a scope that may/will block.
|
1112
|
+
*/
|
1113
|
+
virtual std::unique_ptr<ScopedBlockingCall> CreateBlockingScope(
|
1114
|
+
BlockingType blocking_type) {
|
1115
|
+
return nullptr;
|
1116
|
+
}
|
1117
|
+
|
1066
1118
|
/**
|
1067
1119
|
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
1068
1120
|
* the past. This function is expected to return at least
|
@@ -1073,11 +1125,28 @@ class Platform {
|
|
1073
1125
|
virtual double MonotonicallyIncreasingTime() = 0;
|
1074
1126
|
|
1075
1127
|
/**
|
1076
|
-
* Current wall-clock time in milliseconds since epoch.
|
1077
|
-
*
|
1128
|
+
* Current wall-clock time in milliseconds since epoch. Use
|
1129
|
+
* CurrentClockTimeMillisHighResolution() when higher precision is
|
1130
|
+
* required.
|
1131
|
+
*/
|
1132
|
+
virtual int64_t CurrentClockTimeMilliseconds() {
|
1133
|
+
return floor(CurrentClockTimeMillis());
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
/**
|
1137
|
+
* This function is deprecated and will be deleted. Use either
|
1138
|
+
* CurrentClockTimeMilliseconds() or
|
1139
|
+
* CurrentClockTimeMillisecondsHighResolution().
|
1078
1140
|
*/
|
1079
1141
|
virtual double CurrentClockTimeMillis() = 0;
|
1080
1142
|
|
1143
|
+
/**
|
1144
|
+
* Same as CurrentClockTimeMilliseconds(), but with more precision.
|
1145
|
+
*/
|
1146
|
+
virtual double CurrentClockTimeMillisecondsHighResolution() {
|
1147
|
+
return CurrentClockTimeMillis();
|
1148
|
+
}
|
1149
|
+
|
1081
1150
|
typedef void (*StackTracePrinter)();
|
1082
1151
|
|
1083
1152
|
/**
|
@@ -493,8 +493,15 @@ class V8_EXPORT String : public Name {
|
|
493
493
|
/**
|
494
494
|
* Returns true if this string can be made external.
|
495
495
|
*/
|
496
|
+
V8_DEPRECATE_SOON("Use the version that takes an encoding as argument.")
|
496
497
|
bool CanMakeExternal() const;
|
497
498
|
|
499
|
+
/**
|
500
|
+
* Returns true if this string can be made external, given the encoding for
|
501
|
+
* the external string resource.
|
502
|
+
*/
|
503
|
+
bool CanMakeExternal(Encoding encoding) const;
|
504
|
+
|
498
505
|
/**
|
499
506
|
* Returns true if the strings values are equal. Same as JS ==/===.
|
500
507
|
*/
|
@@ -776,14 +783,14 @@ Local<String> String::Empty(Isolate* isolate) {
|
|
776
783
|
using S = internal::Address;
|
777
784
|
using I = internal::Internals;
|
778
785
|
I::CheckInitialized(isolate);
|
779
|
-
S* slot = I::
|
780
|
-
return Local<String
|
786
|
+
S* slot = I::GetRootSlot(isolate, I::kEmptyStringRootIndex);
|
787
|
+
return Local<String>::FromSlot(slot);
|
781
788
|
}
|
782
789
|
|
783
790
|
String::ExternalStringResource* String::GetExternalStringResource() const {
|
784
791
|
using A = internal::Address;
|
785
792
|
using I = internal::Internals;
|
786
|
-
A obj =
|
793
|
+
A obj = internal::ValueHelper::ValueAsAddress(this);
|
787
794
|
|
788
795
|
ExternalStringResource* result;
|
789
796
|
if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
|
@@ -804,7 +811,7 @@ String::ExternalStringResourceBase* String::GetExternalStringResourceBase(
|
|
804
811
|
String::Encoding* encoding_out) const {
|
805
812
|
using A = internal::Address;
|
806
813
|
using I = internal::Internals;
|
807
|
-
A obj =
|
814
|
+
A obj = internal::ValueHelper::ValueAsAddress(this);
|
808
815
|
int type = I::GetInstanceType(obj) & I::kStringRepresentationAndEncodingMask;
|
809
816
|
*encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
|
810
817
|
ExternalStringResourceBase* resource;
|
@@ -829,32 +836,32 @@ V8_INLINE Local<Primitive> Undefined(Isolate* isolate) {
|
|
829
836
|
using S = internal::Address;
|
830
837
|
using I = internal::Internals;
|
831
838
|
I::CheckInitialized(isolate);
|
832
|
-
S* slot = I::
|
833
|
-
return Local<Primitive
|
839
|
+
S* slot = I::GetRootSlot(isolate, I::kUndefinedValueRootIndex);
|
840
|
+
return Local<Primitive>::FromSlot(slot);
|
834
841
|
}
|
835
842
|
|
836
843
|
V8_INLINE Local<Primitive> Null(Isolate* isolate) {
|
837
844
|
using S = internal::Address;
|
838
845
|
using I = internal::Internals;
|
839
846
|
I::CheckInitialized(isolate);
|
840
|
-
S* slot = I::
|
841
|
-
return Local<Primitive
|
847
|
+
S* slot = I::GetRootSlot(isolate, I::kNullValueRootIndex);
|
848
|
+
return Local<Primitive>::FromSlot(slot);
|
842
849
|
}
|
843
850
|
|
844
851
|
V8_INLINE Local<Boolean> True(Isolate* isolate) {
|
845
852
|
using S = internal::Address;
|
846
853
|
using I = internal::Internals;
|
847
854
|
I::CheckInitialized(isolate);
|
848
|
-
S* slot = I::
|
849
|
-
return Local<Boolean
|
855
|
+
S* slot = I::GetRootSlot(isolate, I::kTrueValueRootIndex);
|
856
|
+
return Local<Boolean>::FromSlot(slot);
|
850
857
|
}
|
851
858
|
|
852
859
|
V8_INLINE Local<Boolean> False(Isolate* isolate) {
|
853
860
|
using S = internal::Address;
|
854
861
|
using I = internal::Internals;
|
855
862
|
I::CheckInitialized(isolate);
|
856
|
-
S* slot = I::
|
857
|
-
return Local<Boolean
|
863
|
+
S* slot = I::GetRootSlot(isolate, I::kFalseValueRootIndex);
|
864
|
+
return Local<Boolean>::FromSlot(slot);
|
858
865
|
}
|
859
866
|
|
860
867
|
Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
|
@@ -175,6 +175,32 @@ class V8_EXPORT CpuProfileNode {
|
|
175
175
|
static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
|
176
176
|
};
|
177
177
|
|
178
|
+
/**
|
179
|
+
* An interface for exporting data from V8, using "push" model.
|
180
|
+
*/
|
181
|
+
class V8_EXPORT OutputStream {
|
182
|
+
public:
|
183
|
+
enum WriteResult { kContinue = 0, kAbort = 1 };
|
184
|
+
virtual ~OutputStream() = default;
|
185
|
+
/** Notify about the end of stream. */
|
186
|
+
virtual void EndOfStream() = 0;
|
187
|
+
/** Get preferred output chunk size. Called only once. */
|
188
|
+
virtual int GetChunkSize() { return 1024; }
|
189
|
+
/**
|
190
|
+
* Writes the next chunk of snapshot data into the stream. Writing
|
191
|
+
* can be stopped by returning kAbort as function result. EndOfStream
|
192
|
+
* will not be called in case writing was aborted.
|
193
|
+
*/
|
194
|
+
virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
|
195
|
+
/**
|
196
|
+
* Writes the next chunk of heap stats data into the stream. Writing
|
197
|
+
* can be stopped by returning kAbort as function result. EndOfStream
|
198
|
+
* will not be called in case writing was aborted.
|
199
|
+
*/
|
200
|
+
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
|
201
|
+
return kAbort;
|
202
|
+
}
|
203
|
+
};
|
178
204
|
|
179
205
|
/**
|
180
206
|
* CpuProfile contains a CPU profile in a form of top-down call tree
|
@@ -182,6 +208,9 @@ class V8_EXPORT CpuProfileNode {
|
|
182
208
|
*/
|
183
209
|
class V8_EXPORT CpuProfile {
|
184
210
|
public:
|
211
|
+
enum SerializationFormat {
|
212
|
+
kJSON = 0 // See format description near 'Serialize' method.
|
213
|
+
};
|
185
214
|
/** Returns CPU profile title. */
|
186
215
|
Local<String> GetTitle() const;
|
187
216
|
|
@@ -235,6 +264,25 @@ class V8_EXPORT CpuProfile {
|
|
235
264
|
* All pointers to nodes previously returned become invalid.
|
236
265
|
*/
|
237
266
|
void Delete();
|
267
|
+
|
268
|
+
/**
|
269
|
+
* Prepare a serialized representation of the profile. The result
|
270
|
+
* is written into the stream provided in chunks of specified size.
|
271
|
+
*
|
272
|
+
* For the JSON format, heap contents are represented as an object
|
273
|
+
* with the following structure:
|
274
|
+
*
|
275
|
+
* {
|
276
|
+
* nodes: [nodes array],
|
277
|
+
* startTime: number,
|
278
|
+
* endTime: number
|
279
|
+
* samples: [strings array]
|
280
|
+
* timeDeltas: [numbers array]
|
281
|
+
* }
|
282
|
+
*
|
283
|
+
*/
|
284
|
+
void Serialize(OutputStream* stream,
|
285
|
+
SerializationFormat format = kJSON) const;
|
238
286
|
};
|
239
287
|
|
240
288
|
enum CpuProfilingMode {
|
@@ -548,6 +596,7 @@ class V8_EXPORT HeapGraphNode {
|
|
548
596
|
kBigInt = 13, // BigInt.
|
549
597
|
kObjectShape = 14, // Internal data used for tracking the shapes (or
|
550
598
|
// "hidden classes") of JS objects.
|
599
|
+
kWasmObject = 15, // A WasmGC struct or array.
|
551
600
|
};
|
552
601
|
|
553
602
|
/** Returns node type (see HeapGraphNode::Type). */
|
@@ -576,37 +625,6 @@ class V8_EXPORT HeapGraphNode {
|
|
576
625
|
const HeapGraphEdge* GetChild(int index) const;
|
577
626
|
};
|
578
627
|
|
579
|
-
|
580
|
-
/**
|
581
|
-
* An interface for exporting data from V8, using "push" model.
|
582
|
-
*/
|
583
|
-
class V8_EXPORT OutputStream {
|
584
|
-
public:
|
585
|
-
enum WriteResult {
|
586
|
-
kContinue = 0,
|
587
|
-
kAbort = 1
|
588
|
-
};
|
589
|
-
virtual ~OutputStream() = default;
|
590
|
-
/** Notify about the end of stream. */
|
591
|
-
virtual void EndOfStream() = 0;
|
592
|
-
/** Get preferred output chunk size. Called only once. */
|
593
|
-
virtual int GetChunkSize() { return 1024; }
|
594
|
-
/**
|
595
|
-
* Writes the next chunk of snapshot data into the stream. Writing
|
596
|
-
* can be stopped by returning kAbort as function result. EndOfStream
|
597
|
-
* will not be called in case writing was aborted.
|
598
|
-
*/
|
599
|
-
virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
|
600
|
-
/**
|
601
|
-
* Writes the next chunk of heap stats data into the stream. Writing
|
602
|
-
* can be stopped by returning kAbort as function result. EndOfStream
|
603
|
-
* will not be called in case writing was aborted.
|
604
|
-
*/
|
605
|
-
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
|
606
|
-
return kAbort;
|
607
|
-
}
|
608
|
-
};
|
609
|
-
|
610
628
|
/**
|
611
629
|
* HeapSnapshots record the state of the JS heap at some moment.
|
612
630
|
*/
|
@@ -894,12 +912,22 @@ class V8_EXPORT EmbedderGraph {
|
|
894
912
|
virtual ~EmbedderGraph() = default;
|
895
913
|
};
|
896
914
|
|
915
|
+
class QueryObjectPredicate {
|
916
|
+
public:
|
917
|
+
virtual ~QueryObjectPredicate() = default;
|
918
|
+
virtual bool Filter(v8::Local<v8::Object> object) = 0;
|
919
|
+
};
|
920
|
+
|
897
921
|
/**
|
898
922
|
* Interface for controlling heap profiling. Instance of the
|
899
923
|
* profiler can be retrieved using v8::Isolate::GetHeapProfiler.
|
900
924
|
*/
|
901
925
|
class V8_EXPORT HeapProfiler {
|
902
926
|
public:
|
927
|
+
void QueryObjects(v8::Local<v8::Context> context,
|
928
|
+
QueryObjectPredicate* predicate,
|
929
|
+
std::vector<v8::Global<v8::Object>>* objects);
|
930
|
+
|
903
931
|
enum SamplingFlags {
|
904
932
|
kSamplingNoFlags = 0,
|
905
933
|
kSamplingForceGC = 1 << 0,
|
@@ -11,6 +11,7 @@
|
|
11
11
|
#include <memory>
|
12
12
|
#include <vector>
|
13
13
|
|
14
|
+
#include "v8-callbacks.h" // NOLINT(build/include_directory)
|
14
15
|
#include "v8-data.h" // NOLINT(build/include_directory)
|
15
16
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
16
17
|
#include "v8-maybe.h" // NOLINT(build/include_directory)
|
@@ -141,10 +142,9 @@ class V8_EXPORT ModuleRequest : public Data {
|
|
141
142
|
*
|
142
143
|
* All assertions present in the module request will be supplied in this
|
143
144
|
* list, regardless of whether they are supported by the host. Per
|
144
|
-
* https://tc39.es/proposal-import-
|
145
|
-
* hosts are expected to
|
146
|
-
* opposed to, for example,
|
147
|
-
* present).
|
145
|
+
* https://tc39.es/proposal-import-attributes/#sec-hostgetsupportedimportattributes,
|
146
|
+
* hosts are expected to throw for assertions that they do not support (as
|
147
|
+
* opposed to, for example, ignoring them).
|
148
148
|
*/
|
149
149
|
Local<FixedArray> GetImportAssertions() const;
|
150
150
|
|
@@ -347,6 +347,12 @@ class V8_EXPORT Script {
|
|
347
347
|
* ScriptOrigin. This can be either a v8::String or v8::Undefined.
|
348
348
|
*/
|
349
349
|
Local<Value> GetResourceName();
|
350
|
+
|
351
|
+
/**
|
352
|
+
* If the script was compiled, returns the positions of lazy functions which
|
353
|
+
* were eventually compiled and executed.
|
354
|
+
*/
|
355
|
+
std::vector<int> GetProducedCompileHints() const;
|
350
356
|
};
|
351
357
|
|
352
358
|
enum class ScriptType { kClassic, kModule };
|
@@ -407,6 +413,8 @@ class V8_EXPORT ScriptCompiler {
|
|
407
413
|
V8_INLINE explicit Source(
|
408
414
|
Local<String> source_string, CachedData* cached_data = nullptr,
|
409
415
|
ConsumeCodeCacheTask* consume_cache_task = nullptr);
|
416
|
+
V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
|
417
|
+
CompileHintCallback callback, void* callback_data);
|
410
418
|
V8_INLINE ~Source() = default;
|
411
419
|
|
412
420
|
// Ownership of the CachedData or its buffers is *not* transferred to the
|
@@ -434,6 +442,10 @@ class V8_EXPORT ScriptCompiler {
|
|
434
442
|
// set when calling a compile method.
|
435
443
|
std::unique_ptr<CachedData> cached_data;
|
436
444
|
std::unique_ptr<ConsumeCodeCacheTask> consume_cache_task;
|
445
|
+
|
446
|
+
// For requesting compile hints from the embedder.
|
447
|
+
CompileHintCallback compile_hint_callback = nullptr;
|
448
|
+
void* compile_hint_callback_data = nullptr;
|
437
449
|
};
|
438
450
|
|
439
451
|
/**
|
@@ -562,7 +574,9 @@ class V8_EXPORT ScriptCompiler {
|
|
562
574
|
enum CompileOptions {
|
563
575
|
kNoCompileOptions = 0,
|
564
576
|
kConsumeCodeCache,
|
565
|
-
kEagerCompile
|
577
|
+
kEagerCompile,
|
578
|
+
kProduceCompileHints,
|
579
|
+
kConsumeCompileHints
|
566
580
|
};
|
567
581
|
|
568
582
|
/**
|
@@ -775,6 +789,19 @@ ScriptCompiler::Source::Source(Local<String> string, CachedData* data,
|
|
775
789
|
cached_data(data),
|
776
790
|
consume_cache_task(consume_cache_task) {}
|
777
791
|
|
792
|
+
ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
|
793
|
+
CompileHintCallback callback,
|
794
|
+
void* callback_data)
|
795
|
+
: source_string(string),
|
796
|
+
resource_name(origin.ResourceName()),
|
797
|
+
resource_line_offset(origin.LineOffset()),
|
798
|
+
resource_column_offset(origin.ColumnOffset()),
|
799
|
+
resource_options(origin.Options()),
|
800
|
+
source_map_url(origin.SourceMapUrl()),
|
801
|
+
host_defined_options(origin.GetHostDefinedOptions()),
|
802
|
+
compile_hint_callback(callback),
|
803
|
+
compile_hint_callback_data(callback_data) {}
|
804
|
+
|
778
805
|
const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData()
|
779
806
|
const {
|
780
807
|
return cached_data.get();
|
@@ -91,7 +91,7 @@ class V8_EXPORT SnapshotCreator {
|
|
91
91
|
*/
|
92
92
|
SnapshotCreator(Isolate* isolate,
|
93
93
|
const intptr_t* external_references = nullptr,
|
94
|
-
StartupData* existing_blob = nullptr);
|
94
|
+
const StartupData* existing_blob = nullptr);
|
95
95
|
|
96
96
|
/**
|
97
97
|
* Create and enter an isolate, and set it up for serialization.
|
@@ -102,7 +102,7 @@ class V8_EXPORT SnapshotCreator {
|
|
102
102
|
* that must be equivalent to CreateParams::external_references.
|
103
103
|
*/
|
104
104
|
SnapshotCreator(const intptr_t* external_references = nullptr,
|
105
|
-
StartupData* existing_blob = nullptr);
|
105
|
+
const StartupData* existing_blob = nullptr);
|
106
106
|
|
107
107
|
/**
|
108
108
|
* Destroy the snapshot creator, and exit and dispose of the Isolate
|
@@ -179,16 +179,12 @@ class V8_EXPORT SnapshotCreator {
|
|
179
179
|
|
180
180
|
template <class T>
|
181
181
|
size_t SnapshotCreator::AddData(Local<Context> context, Local<T> object) {
|
182
|
-
|
183
|
-
internal::Address* p = reinterpret_cast<internal::Address*>(object_ptr);
|
184
|
-
return AddData(context, *p);
|
182
|
+
return AddData(context, internal::ValueHelper::ValueAsAddress(*object));
|
185
183
|
}
|
186
184
|
|
187
185
|
template <class T>
|
188
186
|
size_t SnapshotCreator::AddData(Local<T> object) {
|
189
|
-
|
190
|
-
internal::Address* p = reinterpret_cast<internal::Address*>(object_ptr);
|
191
|
-
return AddData(*p);
|
187
|
+
return AddData(internal::ValueHelper::ValueAsAddress(*object));
|
192
188
|
}
|
193
189
|
|
194
190
|
} // namespace v8
|
@@ -30,7 +30,9 @@ class Signature;
|
|
30
30
|
F(AsyncIteratorPrototype, initial_async_iterator_prototype) \
|
31
31
|
F(ErrorPrototype, initial_error_prototype) \
|
32
32
|
F(IteratorPrototype, initial_iterator_prototype) \
|
33
|
-
F(
|
33
|
+
F(MapIteratorPrototype, initial_map_iterator_prototype) \
|
34
|
+
F(ObjProto_valueOf, object_value_of_function) \
|
35
|
+
F(SetIteratorPrototype, initial_set_iterator_prototype)
|
34
36
|
|
35
37
|
enum Intrinsic {
|
36
38
|
#define V8_DECL_INTRINSIC(name, iname) k##name,
|