libv8-node 18.13.0.1-aarch64-linux → 20.2.0.0-aarch64-linux
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/aarch64-linux/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/common.h +0 -1
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +11 -10
- data/vendor/v8/include/cppgc/heap-consistency.h +46 -3
- data/vendor/v8/include/cppgc/heap-handle.h +48 -0
- data/vendor/v8/include/cppgc/heap-statistics.h +2 -2
- data/vendor/v8/include/cppgc/heap.h +3 -7
- data/vendor/v8/include/cppgc/internal/api-constants.h +14 -1
- data/vendor/v8/include/cppgc/internal/base-page-handle.h +45 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +40 -8
- data/vendor/v8/include/cppgc/internal/caged-heap.h +61 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +35 -34
- data/vendor/v8/include/cppgc/internal/member-storage.h +248 -0
- data/vendor/v8/include/cppgc/internal/name-trait.h +21 -6
- data/vendor/v8/include/cppgc/internal/persistent-node.h +11 -13
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +65 -8
- data/vendor/v8/include/cppgc/internal/write-barrier.h +153 -101
- data/vendor/v8/include/cppgc/liveness-broker.h +8 -7
- data/vendor/v8/include/cppgc/macros.h +10 -1
- data/vendor/v8/include/cppgc/member.h +424 -111
- data/vendor/v8/include/cppgc/name-provider.h +4 -4
- data/vendor/v8/include/cppgc/persistent.h +27 -24
- data/vendor/v8/include/cppgc/platform.h +7 -5
- data/vendor/v8/include/cppgc/sentinel-pointer.h +1 -1
- data/vendor/v8/include/cppgc/trace-trait.h +4 -0
- data/vendor/v8/include/cppgc/type-traits.h +13 -3
- data/vendor/v8/include/cppgc/visitor.h +104 -57
- 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 +32 -5
- data/vendor/v8/include/v8-context.h +63 -11
- data/vendor/v8/include/v8-cppgc.h +22 -0
- data/vendor/v8/include/v8-data.h +1 -1
- data/vendor/v8/include/v8-date.h +5 -0
- data/vendor/v8/include/v8-embedder-heap.h +0 -164
- data/vendor/v8/include/v8-exception.h +1 -1
- data/vendor/v8/include/v8-fast-api-calls.h +49 -31
- data/vendor/v8/include/v8-function-callback.h +69 -42
- data/vendor/v8/include/v8-function.h +9 -0
- data/vendor/v8/include/v8-initialization.h +23 -49
- data/vendor/v8/include/v8-inspector.h +32 -11
- data/vendor/v8/include/v8-internal.h +480 -183
- data/vendor/v8/include/v8-isolate.h +52 -77
- data/vendor/v8/include/v8-local-handle.h +86 -53
- data/vendor/v8/include/v8-locker.h +0 -11
- data/vendor/v8/include/v8-maybe.h +24 -1
- data/vendor/v8/include/v8-message.h +2 -4
- data/vendor/v8/include/v8-metrics.h +48 -40
- data/vendor/v8/include/v8-microtask-queue.h +6 -1
- data/vendor/v8/include/v8-object.h +29 -18
- data/vendor/v8/include/v8-persistent-handle.h +25 -18
- data/vendor/v8/include/v8-platform.h +133 -35
- data/vendor/v8/include/v8-primitive.h +27 -20
- data/vendor/v8/include/v8-profiler.h +133 -53
- data/vendor/v8/include/v8-regexp.h +2 -1
- data/vendor/v8/include/v8-script.h +91 -7
- data/vendor/v8/include/v8-snapshot.h +4 -8
- data/vendor/v8/include/v8-template.h +16 -77
- data/vendor/v8/include/v8-traced-handle.h +22 -28
- data/vendor/v8/include/v8-unwinder-state.h +4 -4
- data/vendor/v8/include/v8-util.h +11 -7
- data/vendor/v8/include/v8-value-serializer.h +46 -23
- 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 +7 -63
- data/vendor/v8/include/v8-weak-callback-info.h +0 -7
- data/vendor/v8/include/v8config.h +353 -15
- metadata +5 -1
@@ -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
|
|
@@ -158,9 +160,10 @@ class TaskRunner {
|
|
158
160
|
class JobDelegate {
|
159
161
|
public:
|
160
162
|
/**
|
161
|
-
* Returns true if this thread
|
163
|
+
* Returns true if this thread *must* return from the worker task on the
|
162
164
|
* current thread ASAP. Workers should periodically invoke ShouldYield (or
|
163
165
|
* YieldIfNeeded()) as often as is reasonable.
|
166
|
+
* After this method returned true, ShouldYield must not be called again.
|
164
167
|
*/
|
165
168
|
virtual bool ShouldYield() = 0;
|
166
169
|
|
@@ -264,6 +267,38 @@ class JobTask {
|
|
264
267
|
virtual size_t GetMaxConcurrency(size_t worker_count) const = 0;
|
265
268
|
};
|
266
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
|
+
|
267
302
|
/**
|
268
303
|
* The interface represents complex arguments to trace events.
|
269
304
|
*/
|
@@ -284,6 +319,8 @@ class ConvertableToTraceFormat {
|
|
284
319
|
* V8 Tracing controller.
|
285
320
|
*
|
286
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).
|
287
324
|
*/
|
288
325
|
class TracingController {
|
289
326
|
public:
|
@@ -347,10 +384,16 @@ class TracingController {
|
|
347
384
|
virtual void OnTraceDisabled() = 0;
|
348
385
|
};
|
349
386
|
|
350
|
-
/**
|
387
|
+
/**
|
388
|
+
* Adds tracing state change observer.
|
389
|
+
* Does nothing in Perfetto SDK build (v8_use_perfetto = true).
|
390
|
+
*/
|
351
391
|
virtual void AddTraceStateObserver(TraceStateObserver*) {}
|
352
392
|
|
353
|
-
/**
|
393
|
+
/**
|
394
|
+
* Removes tracing state change observer.
|
395
|
+
* Does nothing in Perfetto SDK build (v8_use_perfetto = true).
|
396
|
+
*/
|
354
397
|
virtual void RemoveTraceStateObserver(TraceStateObserver*) {}
|
355
398
|
};
|
356
399
|
|
@@ -429,6 +472,17 @@ class PageAllocator {
|
|
429
472
|
virtual bool SetPermissions(void* address, size_t length,
|
430
473
|
Permission permissions) = 0;
|
431
474
|
|
475
|
+
/**
|
476
|
+
* Recommits discarded pages in the given range with given permissions.
|
477
|
+
* Discarded pages must be recommitted with their original permissions
|
478
|
+
* before they are used again.
|
479
|
+
*/
|
480
|
+
virtual bool RecommitPages(void* address, size_t length,
|
481
|
+
Permission permissions) {
|
482
|
+
// TODO(v8:12797): make it pure once it's implemented on Chromium side.
|
483
|
+
return false;
|
484
|
+
}
|
485
|
+
|
432
486
|
/**
|
433
487
|
* Frees memory in the given [address, address + size) range. address and size
|
434
488
|
* should be operating system page-aligned. The next write to this
|
@@ -522,7 +576,7 @@ static constexpr PlatformSharedMemoryHandle kInvalidSharedMemoryHandle = -1;
|
|
522
576
|
// to avoid pulling in large OS header files into this header file. Instead,
|
523
577
|
// the users of these routines are expected to include the respecitve OS
|
524
578
|
// headers in addition to this one.
|
525
|
-
#if
|
579
|
+
#if V8_OS_DARWIN
|
526
580
|
// Convert between a shared memory handle and a mach_port_t referencing a memory
|
527
581
|
// entry object.
|
528
582
|
inline PlatformSharedMemoryHandle SharedMemoryHandleFromMachMemoryEntry(
|
@@ -698,6 +752,10 @@ class VirtualAddressSpace {
|
|
698
752
|
/**
|
699
753
|
* Sets permissions of all allocated pages in the given range.
|
700
754
|
*
|
755
|
+
* This operation can fail due to OOM, in which case false is returned. If
|
756
|
+
* the operation fails for a reason other than OOM, this function will
|
757
|
+
* terminate the process as this implies a bug in the client.
|
758
|
+
*
|
701
759
|
* \param address The start address of the range. Must be aligned to
|
702
760
|
* page_size().
|
703
761
|
*
|
@@ -706,7 +764,7 @@ class VirtualAddressSpace {
|
|
706
764
|
*
|
707
765
|
* \param permissions The new permissions for the range.
|
708
766
|
*
|
709
|
-
* \returns true on success, false
|
767
|
+
* \returns true on success, false on OOM.
|
710
768
|
*/
|
711
769
|
virtual V8_WARN_UNUSED_RESULT bool SetPagePermissions(
|
712
770
|
Address address, size_t size, PagePermissions permissions) = 0;
|
@@ -820,6 +878,24 @@ class VirtualAddressSpace {
|
|
820
878
|
// takes a command enum as parameter.
|
821
879
|
//
|
822
880
|
|
881
|
+
/**
|
882
|
+
* Recommits discarded pages in the given range with given permissions.
|
883
|
+
* Discarded pages must be recommitted with their original permissions
|
884
|
+
* before they are used again.
|
885
|
+
*
|
886
|
+
* \param address The start address of the range. Must be aligned to
|
887
|
+
* page_size().
|
888
|
+
*
|
889
|
+
* \param size The size in bytes of the range. Must be a multiple
|
890
|
+
* of page_size().
|
891
|
+
*
|
892
|
+
* \param permissions The permissions for the range that the pages must have.
|
893
|
+
*
|
894
|
+
* \returns true on success, false otherwise.
|
895
|
+
*/
|
896
|
+
virtual V8_WARN_UNUSED_RESULT bool RecommitPages(
|
897
|
+
Address address, size_t size, PagePermissions permissions) = 0;
|
898
|
+
|
823
899
|
/**
|
824
900
|
* Frees memory in the given [address, address + size) range. address and
|
825
901
|
* size should be aligned to the page_size(). The next write to this memory
|
@@ -889,11 +965,9 @@ class Platform {
|
|
889
965
|
|
890
966
|
/**
|
891
967
|
* Allows the embedder to manage memory page allocations.
|
968
|
+
* Returning nullptr will cause V8 to use the default page allocator.
|
892
969
|
*/
|
893
|
-
virtual PageAllocator* GetPageAllocator()
|
894
|
-
// TODO(bbudge) Make this abstract after all embedders implement this.
|
895
|
-
return nullptr;
|
896
|
-
}
|
970
|
+
virtual PageAllocator* GetPageAllocator() = 0;
|
897
971
|
|
898
972
|
/**
|
899
973
|
* Allows the embedder to specify a custom allocator used for zones.
|
@@ -910,28 +984,15 @@ class Platform {
|
|
910
984
|
* error.
|
911
985
|
* Embedder overrides of this function must NOT call back into V8.
|
912
986
|
*/
|
913
|
-
virtual void OnCriticalMemoryPressure() {
|
914
|
-
// TODO(bbudge) Remove this when embedders override the following method.
|
915
|
-
// See crbug.com/634547.
|
916
|
-
}
|
987
|
+
virtual void OnCriticalMemoryPressure() {}
|
917
988
|
|
918
989
|
/**
|
919
|
-
*
|
920
|
-
*
|
921
|
-
*
|
922
|
-
*
|
923
|
-
*
|
924
|
-
*
|
925
|
-
* Embedder overrides of this function must NOT call back into V8.
|
926
|
-
*/
|
927
|
-
virtual bool OnCriticalMemoryPressure(size_t length) { return false; }
|
928
|
-
|
929
|
-
/**
|
930
|
-
* Gets the number of worker threads used by
|
931
|
-
* Call(BlockingTask)OnWorkerThread(). This can be used to estimate the number
|
932
|
-
* of tasks a work package should be split into. A return value of 0 means
|
933
|
-
* that there are no worker threads available. Note that a value of 0 won't
|
934
|
-
* prohibit V8 from posting tasks using |CallOnWorkerThread|.
|
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|.
|
935
996
|
*/
|
936
997
|
virtual int NumberOfWorkerThreads() = 0;
|
937
998
|
|
@@ -1022,18 +1083,38 @@ class Platform {
|
|
1022
1083
|
* thread (A=>B/B=>A deadlock) and [2] JobTask::Run or
|
1023
1084
|
* JobTask::GetMaxConcurrency may be invoked synchronously from JobHandle
|
1024
1085
|
* (B=>JobHandle::foo=>B deadlock).
|
1086
|
+
*/
|
1087
|
+
virtual std::unique_ptr<JobHandle> PostJob(
|
1088
|
+
TaskPriority priority, std::unique_ptr<JobTask> job_task) {
|
1089
|
+
auto handle = CreateJob(priority, std::move(job_task));
|
1090
|
+
handle->NotifyConcurrencyIncrease();
|
1091
|
+
return handle;
|
1092
|
+
}
|
1093
|
+
|
1094
|
+
/**
|
1095
|
+
* Creates and returns a JobHandle associated with a Job. Unlike PostJob(),
|
1096
|
+
* this doesn't immediately schedules |worker_task| to run; the Job is then
|
1097
|
+
* scheduled by calling either NotifyConcurrencyIncrease() or Join().
|
1025
1098
|
*
|
1026
|
-
* A sufficient
|
1027
|
-
* libplatform looks like:
|
1028
|
-
* std::unique_ptr<JobHandle>
|
1099
|
+
* A sufficient CreateJob() implementation that uses the default Job provided
|
1100
|
+
* in libplatform looks like:
|
1101
|
+
* std::unique_ptr<JobHandle> CreateJob(
|
1029
1102
|
* TaskPriority priority, std::unique_ptr<JobTask> job_task) override {
|
1030
1103
|
* return v8::platform::NewDefaultJobHandle(
|
1031
1104
|
* this, priority, std::move(job_task), NumberOfWorkerThreads());
|
1032
1105
|
* }
|
1033
1106
|
*/
|
1034
|
-
virtual std::unique_ptr<JobHandle>
|
1107
|
+
virtual std::unique_ptr<JobHandle> CreateJob(
|
1035
1108
|
TaskPriority priority, std::unique_ptr<JobTask> job_task) = 0;
|
1036
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
|
+
|
1037
1118
|
/**
|
1038
1119
|
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
1039
1120
|
* the past. This function is expected to return at least
|
@@ -1044,11 +1125,28 @@ class Platform {
|
|
1044
1125
|
virtual double MonotonicallyIncreasingTime() = 0;
|
1045
1126
|
|
1046
1127
|
/**
|
1047
|
-
* Current wall-clock time in milliseconds since epoch.
|
1048
|
-
*
|
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().
|
1049
1140
|
*/
|
1050
1141
|
virtual double CurrentClockTimeMillis() = 0;
|
1051
1142
|
|
1143
|
+
/**
|
1144
|
+
* Same as CurrentClockTimeMilliseconds(), but with more precision.
|
1145
|
+
*/
|
1146
|
+
virtual double CurrentClockTimeMillisecondsHighResolution() {
|
1147
|
+
return CurrentClockTimeMillis();
|
1148
|
+
}
|
1149
|
+
|
1052
1150
|
typedef void (*StackTracePrinter)();
|
1053
1151
|
|
1054
1152
|
/**
|
@@ -20,6 +20,7 @@ class String;
|
|
20
20
|
namespace internal {
|
21
21
|
class ExternalString;
|
22
22
|
class ScopedExternalStringLock;
|
23
|
+
class StringForwardingTable;
|
23
24
|
} // namespace internal
|
24
25
|
|
25
26
|
/**
|
@@ -269,6 +270,7 @@ class V8_EXPORT String : public Name {
|
|
269
270
|
private:
|
270
271
|
friend class internal::ExternalString;
|
271
272
|
friend class v8::String;
|
273
|
+
friend class internal::StringForwardingTable;
|
272
274
|
friend class internal::ScopedExternalStringLock;
|
273
275
|
};
|
274
276
|
|
@@ -491,8 +493,15 @@ class V8_EXPORT String : public Name {
|
|
491
493
|
/**
|
492
494
|
* Returns true if this string can be made external.
|
493
495
|
*/
|
496
|
+
V8_DEPRECATE_SOON("Use the version that takes an encoding as argument.")
|
494
497
|
bool CanMakeExternal() const;
|
495
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
|
+
|
496
505
|
/**
|
497
506
|
* Returns true if the strings values are equal. Same as JS ==/===.
|
498
507
|
*/
|
@@ -774,21 +783,20 @@ Local<String> String::Empty(Isolate* isolate) {
|
|
774
783
|
using S = internal::Address;
|
775
784
|
using I = internal::Internals;
|
776
785
|
I::CheckInitialized(isolate);
|
777
|
-
S* slot = I::
|
778
|
-
return Local<String
|
786
|
+
S* slot = I::GetRootSlot(isolate, I::kEmptyStringRootIndex);
|
787
|
+
return Local<String>::FromSlot(slot);
|
779
788
|
}
|
780
789
|
|
781
790
|
String::ExternalStringResource* String::GetExternalStringResource() const {
|
782
791
|
using A = internal::Address;
|
783
792
|
using I = internal::Internals;
|
784
|
-
A obj =
|
793
|
+
A obj = internal::ValueHelper::ValueAsAddress(this);
|
785
794
|
|
786
795
|
ExternalStringResource* result;
|
787
796
|
if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
|
788
|
-
|
789
|
-
A value =
|
790
|
-
|
791
|
-
internal::kExternalStringResourceTag);
|
797
|
+
Isolate* isolate = I::GetIsolateForSandbox(obj);
|
798
|
+
A value = I::ReadExternalPointerField<internal::kExternalStringResourceTag>(
|
799
|
+
isolate, obj, I::kStringResourceOffset);
|
792
800
|
result = reinterpret_cast<String::ExternalStringResource*>(value);
|
793
801
|
} else {
|
794
802
|
result = GetExternalStringResourceSlow();
|
@@ -803,16 +811,15 @@ String::ExternalStringResourceBase* String::GetExternalStringResourceBase(
|
|
803
811
|
String::Encoding* encoding_out) const {
|
804
812
|
using A = internal::Address;
|
805
813
|
using I = internal::Internals;
|
806
|
-
A obj =
|
814
|
+
A obj = internal::ValueHelper::ValueAsAddress(this);
|
807
815
|
int type = I::GetInstanceType(obj) & I::kStringRepresentationAndEncodingMask;
|
808
816
|
*encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
|
809
817
|
ExternalStringResourceBase* resource;
|
810
818
|
if (type == I::kExternalOneByteRepresentationTag ||
|
811
819
|
type == I::kExternalTwoByteRepresentationTag) {
|
812
|
-
|
813
|
-
A value =
|
814
|
-
|
815
|
-
internal::kExternalStringResourceTag);
|
820
|
+
Isolate* isolate = I::GetIsolateForSandbox(obj);
|
821
|
+
A value = I::ReadExternalPointerField<internal::kExternalStringResourceTag>(
|
822
|
+
isolate, obj, I::kStringResourceOffset);
|
816
823
|
resource = reinterpret_cast<ExternalStringResourceBase*>(value);
|
817
824
|
} else {
|
818
825
|
resource = GetExternalStringResourceBaseSlow(encoding_out);
|
@@ -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 {
|
@@ -331,6 +379,9 @@ class V8_EXPORT CpuProfilingOptions {
|
|
331
379
|
unsigned max_samples = kNoSampleLimit, int sampling_interval_us = 0,
|
332
380
|
MaybeLocal<Context> filter_context = MaybeLocal<Context>());
|
333
381
|
|
382
|
+
CpuProfilingOptions(CpuProfilingOptions&&) = default;
|
383
|
+
CpuProfilingOptions& operator=(CpuProfilingOptions&&) = default;
|
384
|
+
|
334
385
|
CpuProfilingMode mode() const { return mode_; }
|
335
386
|
unsigned max_samples() const { return max_samples_; }
|
336
387
|
int sampling_interval_us() const { return sampling_interval_us_; }
|
@@ -344,7 +395,7 @@ class V8_EXPORT CpuProfilingOptions {
|
|
344
395
|
CpuProfilingMode mode_;
|
345
396
|
unsigned max_samples_;
|
346
397
|
int sampling_interval_us_;
|
347
|
-
|
398
|
+
Global<Context> filter_context_;
|
348
399
|
};
|
349
400
|
|
350
401
|
/**
|
@@ -542,7 +593,10 @@ class V8_EXPORT HeapGraphNode {
|
|
542
593
|
kConsString = 10, // Concatenated string. A pair of pointers to strings.
|
543
594
|
kSlicedString = 11, // Sliced string. A fragment of another string.
|
544
595
|
kSymbol = 12, // A Symbol (ES6).
|
545
|
-
kBigInt = 13
|
596
|
+
kBigInt = 13, // BigInt.
|
597
|
+
kObjectShape = 14, // Internal data used for tracking the shapes (or
|
598
|
+
// "hidden classes") of JS objects.
|
599
|
+
kWasmObject = 15, // A WasmGC struct or array.
|
546
600
|
};
|
547
601
|
|
548
602
|
/** Returns node type (see HeapGraphNode::Type). */
|
@@ -571,37 +625,6 @@ class V8_EXPORT HeapGraphNode {
|
|
571
625
|
const HeapGraphEdge* GetChild(int index) const;
|
572
626
|
};
|
573
627
|
|
574
|
-
|
575
|
-
/**
|
576
|
-
* An interface for exporting data from V8, using "push" model.
|
577
|
-
*/
|
578
|
-
class V8_EXPORT OutputStream {
|
579
|
-
public:
|
580
|
-
enum WriteResult {
|
581
|
-
kContinue = 0,
|
582
|
-
kAbort = 1
|
583
|
-
};
|
584
|
-
virtual ~OutputStream() = default;
|
585
|
-
/** Notify about the end of stream. */
|
586
|
-
virtual void EndOfStream() = 0;
|
587
|
-
/** Get preferred output chunk size. Called only once. */
|
588
|
-
virtual int GetChunkSize() { return 1024; }
|
589
|
-
/**
|
590
|
-
* Writes the next chunk of snapshot data into the stream. Writing
|
591
|
-
* can be stopped by returning kAbort as function result. EndOfStream
|
592
|
-
* will not be called in case writing was aborted.
|
593
|
-
*/
|
594
|
-
virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
|
595
|
-
/**
|
596
|
-
* Writes the next chunk of heap stats data into the stream. Writing
|
597
|
-
* can be stopped by returning kAbort as function result. EndOfStream
|
598
|
-
* will not be called in case writing was aborted.
|
599
|
-
*/
|
600
|
-
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
|
601
|
-
return kAbort;
|
602
|
-
}
|
603
|
-
};
|
604
|
-
|
605
628
|
/**
|
606
629
|
* HeapSnapshots record the state of the JS heap at some moment.
|
607
630
|
*/
|
@@ -898,6 +921,8 @@ class V8_EXPORT HeapProfiler {
|
|
898
921
|
enum SamplingFlags {
|
899
922
|
kSamplingNoFlags = 0,
|
900
923
|
kSamplingForceGC = 1 << 0,
|
924
|
+
kSamplingIncludeObjectsCollectedByMajorGC = 1 << 1,
|
925
|
+
kSamplingIncludeObjectsCollectedByMinorGC = 1 << 2,
|
901
926
|
};
|
902
927
|
|
903
928
|
/**
|
@@ -975,14 +1000,71 @@ class V8_EXPORT HeapProfiler {
|
|
975
1000
|
virtual ~ObjectNameResolver() = default;
|
976
1001
|
};
|
977
1002
|
|
1003
|
+
enum class HeapSnapshotMode {
|
1004
|
+
/**
|
1005
|
+
* Heap snapshot for regular developers.
|
1006
|
+
*/
|
1007
|
+
kRegular,
|
1008
|
+
/**
|
1009
|
+
* Heap snapshot is exposing internals that may be useful for experts.
|
1010
|
+
*/
|
1011
|
+
kExposeInternals,
|
1012
|
+
};
|
1013
|
+
|
1014
|
+
enum class NumericsMode {
|
1015
|
+
/**
|
1016
|
+
* Numeric values are hidden as they are values of the corresponding
|
1017
|
+
* objects.
|
1018
|
+
*/
|
1019
|
+
kHideNumericValues,
|
1020
|
+
/**
|
1021
|
+
* Numeric values are exposed in artificial fields.
|
1022
|
+
*/
|
1023
|
+
kExposeNumericValues
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
struct HeapSnapshotOptions final {
|
1027
|
+
// Manually define default constructor here to be able to use it in
|
1028
|
+
// `TakeSnapshot()` below.
|
1029
|
+
// NOLINTNEXTLINE
|
1030
|
+
HeapSnapshotOptions() {}
|
1031
|
+
|
1032
|
+
/**
|
1033
|
+
* The control used to report intermediate progress to.
|
1034
|
+
*/
|
1035
|
+
ActivityControl* control = nullptr;
|
1036
|
+
/**
|
1037
|
+
* The resolver used by the snapshot generator to get names for V8 objects.
|
1038
|
+
*/
|
1039
|
+
ObjectNameResolver* global_object_name_resolver = nullptr;
|
1040
|
+
/**
|
1041
|
+
* Mode for taking the snapshot, see `HeapSnapshotMode`.
|
1042
|
+
*/
|
1043
|
+
HeapSnapshotMode snapshot_mode = HeapSnapshotMode::kRegular;
|
1044
|
+
/**
|
1045
|
+
* Mode for dealing with numeric values, see `NumericsMode`.
|
1046
|
+
*/
|
1047
|
+
NumericsMode numerics_mode = NumericsMode::kHideNumericValues;
|
1048
|
+
};
|
1049
|
+
|
1050
|
+
/**
|
1051
|
+
* Takes a heap snapshot.
|
1052
|
+
*
|
1053
|
+
* \returns the snapshot.
|
1054
|
+
*/
|
1055
|
+
const HeapSnapshot* TakeHeapSnapshot(
|
1056
|
+
const HeapSnapshotOptions& options = HeapSnapshotOptions());
|
1057
|
+
|
978
1058
|
/**
|
979
|
-
* Takes a heap snapshot
|
1059
|
+
* Takes a heap snapshot. See `HeapSnapshotOptions` for details on the
|
1060
|
+
* parameters.
|
1061
|
+
*
|
1062
|
+
* \returns the snapshot.
|
980
1063
|
*/
|
981
1064
|
const HeapSnapshot* TakeHeapSnapshot(
|
982
|
-
ActivityControl* control
|
1065
|
+
ActivityControl* control,
|
983
1066
|
ObjectNameResolver* global_object_name_resolver = nullptr,
|
984
|
-
bool
|
985
|
-
bool capture_numeric_value = false);
|
1067
|
+
bool hide_internals = true, bool capture_numeric_value = false);
|
986
1068
|
|
987
1069
|
/**
|
988
1070
|
* Starts tracking of heap objects population statistics. After calling
|
@@ -1035,10 +1117,8 @@ class V8_EXPORT HeapProfiler {
|
|
1035
1117
|
* |stack_depth| parameter controls the maximum number of stack frames to be
|
1036
1118
|
* captured on each allocation.
|
1037
1119
|
*
|
1038
|
-
* NOTE:
|
1039
|
-
*
|
1040
|
-
* objects, large objects, code objects, etc.) and native allocations
|
1041
|
-
* doesn't exist yet, but is anticipated in the future.
|
1120
|
+
* NOTE: Support for native allocations doesn't exist yet, but is anticipated
|
1121
|
+
* in the future.
|
1042
1122
|
*
|
1043
1123
|
* Objects allocated before the sampling is started will not be included in
|
1044
1124
|
* the profile.
|
@@ -1101,18 +1181,18 @@ struct HeapStatsUpdate {
|
|
1101
1181
|
uint32_t size; // New value of size field for the interval with this index.
|
1102
1182
|
};
|
1103
1183
|
|
1104
|
-
#define CODE_EVENTS_LIST(V)
|
1105
|
-
V(Builtin)
|
1106
|
-
V(Callback)
|
1107
|
-
V(Eval)
|
1108
|
-
V(Function)
|
1109
|
-
V(InterpretedFunction)
|
1110
|
-
V(Handler)
|
1111
|
-
V(BytecodeHandler)
|
1112
|
-
V(LazyCompile)
|
1113
|
-
V(RegExp)
|
1114
|
-
V(Script)
|
1115
|
-
V(Stub)
|
1184
|
+
#define CODE_EVENTS_LIST(V) \
|
1185
|
+
V(Builtin) \
|
1186
|
+
V(Callback) \
|
1187
|
+
V(Eval) \
|
1188
|
+
V(Function) \
|
1189
|
+
V(InterpretedFunction) \
|
1190
|
+
V(Handler) \
|
1191
|
+
V(BytecodeHandler) \
|
1192
|
+
V(LazyCompile) /* Unused, use kFunction instead */ \
|
1193
|
+
V(RegExp) \
|
1194
|
+
V(Script) \
|
1195
|
+
V(Stub) \
|
1116
1196
|
V(Relocation)
|
1117
1197
|
|
1118
1198
|
/**
|
@@ -37,9 +37,10 @@ class V8_EXPORT RegExp : public Object {
|
|
37
37
|
kDotAll = 1 << 5,
|
38
38
|
kLinear = 1 << 6,
|
39
39
|
kHasIndices = 1 << 7,
|
40
|
+
kUnicodeSets = 1 << 8,
|
40
41
|
};
|
41
42
|
|
42
|
-
static constexpr int kFlagCount =
|
43
|
+
static constexpr int kFlagCount = 9;
|
43
44
|
|
44
45
|
/**
|
45
46
|
* Creates a regular expression from the given pattern string and
|