libv8 6.3.292.48.1-universal-darwin-14 → 6.7.288.46.1beta0-universal-darwin-14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ext/libv8/paths.rb +5 -18
- data/lib/libv8/version.rb +1 -1
- data/vendor/v8/include/libplatform/libplatform.h +25 -12
- data/vendor/v8/include/libplatform/v8-tracing.h +13 -2
- data/vendor/v8/include/v8-inspector.h +22 -2
- data/vendor/v8/include/v8-platform.h +247 -12
- data/vendor/v8/include/v8-profiler.h +93 -7
- data/vendor/v8/include/v8-util.h +6 -11
- data/vendor/v8/include/v8-version-string.h +4 -3
- data/vendor/v8/include/v8-version.h +3 -3
- data/vendor/v8/include/v8.h +663 -692
- data/vendor/v8/include/v8config.h +7 -1
- data/vendor/v8/out.gn/libv8/obj/libv8_libbase.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_libplatform.a +0 -0
- data/vendor/v8/{out/x64.release/libv8_base.a → out.gn/libv8/obj/libv8_monolith.a} +0 -0
- metadata +18 -25
- data/ext/libv8/arch.rb +0 -20
- data/vendor/v8/include/v8-debug.h +0 -255
- data/vendor/v8/out/x64.release/libv8_init.a +0 -0
- data/vendor/v8/out/x64.release/libv8_initializers.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_libsampler.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
@@ -286,6 +286,13 @@ class V8_EXPORT CpuProfiler {
|
|
286
286
|
*/
|
287
287
|
static CpuProfiler* New(Isolate* isolate);
|
288
288
|
|
289
|
+
/**
|
290
|
+
* Synchronously collect current stack sample in all profilers attached to
|
291
|
+
* the |isolate|. The call does not affect number of ticks recorded for
|
292
|
+
* the current top node.
|
293
|
+
*/
|
294
|
+
static void CollectSample(Isolate* isolate);
|
295
|
+
|
289
296
|
/**
|
290
297
|
* Disposes the CPU profiler object.
|
291
298
|
*/
|
@@ -322,12 +329,14 @@ class V8_EXPORT CpuProfiler {
|
|
322
329
|
* Recording the forced sample does not contribute to the aggregated
|
323
330
|
* profile statistics.
|
324
331
|
*/
|
325
|
-
|
332
|
+
V8_DEPRECATED("Use static CollectSample(Isolate*) instead.",
|
333
|
+
void CollectSample());
|
326
334
|
|
327
335
|
/**
|
328
336
|
* Tells the profiler whether the embedder is idle.
|
329
337
|
*/
|
330
|
-
|
338
|
+
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
|
339
|
+
void SetIdle(bool is_idle));
|
331
340
|
|
332
341
|
private:
|
333
342
|
CpuProfiler();
|
@@ -393,7 +402,8 @@ class V8_EXPORT HeapGraphNode {
|
|
393
402
|
// snapshot items together.
|
394
403
|
kConsString = 10, // Concatenated string. A pair of pointers to strings.
|
395
404
|
kSlicedString = 11, // Sliced string. A fragment of another string.
|
396
|
-
kSymbol = 12
|
405
|
+
kSymbol = 12, // A Symbol (ES6).
|
406
|
+
kBigInt = 13 // BigInt.
|
397
407
|
};
|
398
408
|
|
399
409
|
/** Returns node type (see HeapGraphNode::Type). */
|
@@ -618,6 +628,68 @@ class V8_EXPORT AllocationProfile {
|
|
618
628
|
static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
|
619
629
|
};
|
620
630
|
|
631
|
+
/**
|
632
|
+
* An object graph consisting of embedder objects and V8 objects.
|
633
|
+
* Edges of the graph are strong references between the objects.
|
634
|
+
* The embedder can build this graph during heap snapshot generation
|
635
|
+
* to include the embedder objects in the heap snapshot.
|
636
|
+
* Usage:
|
637
|
+
* 1) Define derived class of EmbedderGraph::Node for embedder objects.
|
638
|
+
* 2) Set the build embedder graph callback on the heap profiler using
|
639
|
+
* HeapProfiler::SetBuildEmbedderGraphCallback.
|
640
|
+
* 3) In the callback use graph->AddEdge(node1, node2) to add an edge from
|
641
|
+
* node1 to node2.
|
642
|
+
* 4) To represent references from/to V8 object, construct V8 nodes using
|
643
|
+
* graph->V8Node(value).
|
644
|
+
*/
|
645
|
+
class V8_EXPORT EmbedderGraph {
|
646
|
+
public:
|
647
|
+
class Node {
|
648
|
+
public:
|
649
|
+
Node() = default;
|
650
|
+
virtual ~Node() = default;
|
651
|
+
virtual const char* Name() = 0;
|
652
|
+
virtual size_t SizeInBytes() = 0;
|
653
|
+
/**
|
654
|
+
* The corresponding V8 wrapper node if not null.
|
655
|
+
* During heap snapshot generation the embedder node and the V8 wrapper
|
656
|
+
* node will be merged into one node to simplify retaining paths.
|
657
|
+
*/
|
658
|
+
virtual Node* WrapperNode() { return nullptr; }
|
659
|
+
virtual bool IsRootNode() { return false; }
|
660
|
+
/** Must return true for non-V8 nodes. */
|
661
|
+
virtual bool IsEmbedderNode() { return true; }
|
662
|
+
/**
|
663
|
+
* Optional name prefix. It is used in Chrome for tagging detached nodes.
|
664
|
+
*/
|
665
|
+
virtual const char* NamePrefix() { return nullptr; }
|
666
|
+
|
667
|
+
private:
|
668
|
+
Node(const Node&) = delete;
|
669
|
+
Node& operator=(const Node&) = delete;
|
670
|
+
};
|
671
|
+
|
672
|
+
/**
|
673
|
+
* Returns a node corresponding to the given V8 value. Ownership is not
|
674
|
+
* transferred. The result pointer is valid while the graph is alive.
|
675
|
+
*/
|
676
|
+
virtual Node* V8Node(const v8::Local<v8::Value>& value) = 0;
|
677
|
+
|
678
|
+
/**
|
679
|
+
* Adds the given node to the graph and takes ownership of the node.
|
680
|
+
* Returns a raw pointer to the node that is valid while the graph is alive.
|
681
|
+
*/
|
682
|
+
virtual Node* AddNode(std::unique_ptr<Node> node) = 0;
|
683
|
+
|
684
|
+
/**
|
685
|
+
* Adds an edge that represents a strong reference from the given node
|
686
|
+
* |from| to the given node |to|. The nodes must be added to the graph
|
687
|
+
* before calling this function.
|
688
|
+
*/
|
689
|
+
virtual void AddEdge(Node* from, Node* to) = 0;
|
690
|
+
|
691
|
+
virtual ~EmbedderGraph() = default;
|
692
|
+
};
|
621
693
|
|
622
694
|
/**
|
623
695
|
* Interface for controlling heap profiling. Instance of the
|
@@ -657,6 +729,15 @@ class V8_EXPORT HeapProfiler {
|
|
657
729
|
typedef RetainedObjectInfo* (*WrapperInfoCallback)(uint16_t class_id,
|
658
730
|
Local<Value> wrapper);
|
659
731
|
|
732
|
+
/**
|
733
|
+
* Callback function invoked during heap snapshot generation to retrieve
|
734
|
+
* the embedder object graph. The callback should use graph->AddEdge(..) to
|
735
|
+
* add references between the objects.
|
736
|
+
* The callback must not trigger garbage collection in V8.
|
737
|
+
*/
|
738
|
+
typedef void (*BuildEmbedderGraphCallback)(v8::Isolate* isolate,
|
739
|
+
v8::EmbedderGraph* graph);
|
740
|
+
|
660
741
|
/** Returns the number of snapshots taken. */
|
661
742
|
int GetSnapshotCount();
|
662
743
|
|
@@ -796,11 +877,16 @@ class V8_EXPORT HeapProfiler {
|
|
796
877
|
void DeleteAllHeapSnapshots();
|
797
878
|
|
798
879
|
/** Binds a callback to embedder's class ID. */
|
799
|
-
|
800
|
-
|
801
|
-
|
880
|
+
V8_DEPRECATED(
|
881
|
+
"Use SetBuildEmbedderGraphCallback to provide info about embedder nodes",
|
882
|
+
void SetWrapperClassInfoProvider(uint16_t class_id,
|
883
|
+
WrapperInfoCallback callback));
|
884
|
+
|
885
|
+
V8_DEPRECATED(
|
886
|
+
"Use SetBuildEmbedderGraphCallback to provide info about embedder nodes",
|
887
|
+
void SetGetRetainerInfosCallback(GetRetainerInfosCallback callback));
|
802
888
|
|
803
|
-
void
|
889
|
+
void SetBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback);
|
804
890
|
|
805
891
|
/**
|
806
892
|
* Default value of persistent handle class ID. Must not be used to
|
data/vendor/v8/include/v8-util.h
CHANGED
@@ -196,16 +196,6 @@ class PersistentValueMapBase {
|
|
196
196
|
return SetReturnValueFromVal(&returnValue, Traits::Get(&impl_, key));
|
197
197
|
}
|
198
198
|
|
199
|
-
/**
|
200
|
-
* Call Isolate::SetReference with the given parent and the map value.
|
201
|
-
*/
|
202
|
-
void SetReference(const K& key,
|
203
|
-
const Persistent<Object>& parent) {
|
204
|
-
GetIsolate()->SetReference(
|
205
|
-
reinterpret_cast<internal::Object**>(parent.val_),
|
206
|
-
reinterpret_cast<internal::Object**>(FromVal(Traits::Get(&impl_, key))));
|
207
|
-
}
|
208
|
-
|
209
199
|
/**
|
210
200
|
* Call V8::RegisterExternallyReferencedObject with the map value for given
|
211
201
|
* key.
|
@@ -393,9 +383,14 @@ class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
|
393
383
|
*/
|
394
384
|
Global<V> SetUnique(const K& key, Global<V>* persistent) {
|
395
385
|
if (Traits::kCallbackType != kNotWeak) {
|
386
|
+
WeakCallbackType callback_type =
|
387
|
+
Traits::kCallbackType == kWeakWithInternalFields
|
388
|
+
? WeakCallbackType::kInternalFields
|
389
|
+
: WeakCallbackType::kParameter;
|
396
390
|
Local<V> value(Local<V>::New(this->isolate(), *persistent));
|
397
391
|
persistent->template SetWeak<typename Traits::WeakCallbackDataType>(
|
398
|
-
|
392
|
+
Traits::WeakCallbackParameter(this, key, value), WeakCallback,
|
393
|
+
callback_type);
|
399
394
|
}
|
400
395
|
PersistentContainerValue old_value =
|
401
396
|
Traits::Set(this->impl(), key, this->ClearAndLeak(persistent));
|
@@ -29,9 +29,10 @@
|
|
29
29
|
"." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) "." V8_S( \
|
30
30
|
V8_PATCH_LEVEL) V8_EMBEDDER_STRING V8_CANDIDATE_STRING
|
31
31
|
#else
|
32
|
-
#define V8_VERSION_STRING
|
33
|
-
V8_S(V8_MAJOR_VERSION)
|
34
|
-
"." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER)
|
32
|
+
#define V8_VERSION_STRING \
|
33
|
+
V8_S(V8_MAJOR_VERSION) \
|
34
|
+
"." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) \
|
35
|
+
V8_EMBEDDER_STRING V8_CANDIDATE_STRING
|
35
36
|
#endif
|
36
37
|
|
37
38
|
#endif // V8_VERSION_STRING_H_
|
@@ -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 6
|
12
|
-
#define V8_MINOR_VERSION
|
13
|
-
#define V8_BUILD_NUMBER
|
14
|
-
#define V8_PATCH_LEVEL
|
12
|
+
#define V8_MINOR_VERSION 7
|
13
|
+
#define V8_BUILD_NUMBER 288
|
14
|
+
#define V8_PATCH_LEVEL 46
|
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
@@ -66,6 +66,8 @@ namespace v8 {
|
|
66
66
|
class AccessorSignature;
|
67
67
|
class Array;
|
68
68
|
class ArrayBuffer;
|
69
|
+
class BigInt;
|
70
|
+
class BigIntObject;
|
69
71
|
class Boolean;
|
70
72
|
class BooleanObject;
|
71
73
|
class Context;
|
@@ -145,7 +147,7 @@ class Heap;
|
|
145
147
|
class HeapObject;
|
146
148
|
class Isolate;
|
147
149
|
class Object;
|
148
|
-
struct
|
150
|
+
struct ScriptStreamingData;
|
149
151
|
template<typename T> class CustomArguments;
|
150
152
|
class PropertyCallbackArguments;
|
151
153
|
class FunctionCallbackArguments;
|
@@ -313,6 +315,7 @@ class Local {
|
|
313
315
|
friend class String;
|
314
316
|
friend class Object;
|
315
317
|
friend class Context;
|
318
|
+
friend class Isolate;
|
316
319
|
friend class Private;
|
317
320
|
template<class F> friend class internal::CustomArguments;
|
318
321
|
friend Local<Primitive> Undefined(Isolate* isolate);
|
@@ -433,20 +436,6 @@ class WeakCallbackInfo {
|
|
433
436
|
V8_INLINE T* GetParameter() const { return parameter_; }
|
434
437
|
V8_INLINE void* GetInternalField(int index) const;
|
435
438
|
|
436
|
-
V8_INLINE V8_DEPRECATED("use indexed version",
|
437
|
-
void* GetInternalField1() const) {
|
438
|
-
return embedder_fields_[0];
|
439
|
-
}
|
440
|
-
V8_INLINE V8_DEPRECATED("use indexed version",
|
441
|
-
void* GetInternalField2() const) {
|
442
|
-
return embedder_fields_[1];
|
443
|
-
}
|
444
|
-
|
445
|
-
V8_DEPRECATED("Not realiable once SetSecondPassCallback() was used.",
|
446
|
-
bool IsFirstPass() const) {
|
447
|
-
return callback_ != nullptr;
|
448
|
-
}
|
449
|
-
|
450
439
|
// When first called, the embedder MUST Reset() the Global which triggered the
|
451
440
|
// callback. The Global itself is unusable for anything else. No v8 other api
|
452
441
|
// calls may be called in the first callback. Should additional work be
|
@@ -566,6 +555,14 @@ template <class T> class PersistentBase {
|
|
566
555
|
// TODO(dcarney): remove this.
|
567
556
|
V8_INLINE void ClearWeak() { ClearWeak<void>(); }
|
568
557
|
|
558
|
+
/**
|
559
|
+
* Annotates the strong handle with the given label, which is then used by the
|
560
|
+
* heap snapshot generator as a name of the edge from the root to the handle.
|
561
|
+
* The function does not take ownership of the label and assumes that the
|
562
|
+
* label is valid as long as the handle is valid.
|
563
|
+
*/
|
564
|
+
V8_INLINE void AnnotateStrongRetainer(const char* label);
|
565
|
+
|
569
566
|
/**
|
570
567
|
* Allows the embedder to tell the v8 garbage collector that a certain object
|
571
568
|
* is alive. Only allowed when the embedder is asked to trace its heap by
|
@@ -579,16 +576,22 @@ template <class T> class PersistentBase {
|
|
579
576
|
* independent handle should not assume that it will be preceded by a global
|
580
577
|
* GC prologue callback or followed by a global GC epilogue callback.
|
581
578
|
*/
|
582
|
-
|
579
|
+
V8_DEPRECATE_SOON(
|
580
|
+
"Objects are always considered independent. "
|
581
|
+
"Use MarkActive to avoid collecting otherwise dead weak handles.",
|
582
|
+
V8_INLINE void MarkIndependent());
|
583
583
|
|
584
584
|
/**
|
585
585
|
* Marks the reference to this object as active. The scavenge garbage
|
586
|
-
* collection should not reclaim the objects marked as active
|
586
|
+
* collection should not reclaim the objects marked as active, even if the
|
587
|
+
* object held by the handle is otherwise unreachable.
|
588
|
+
*
|
587
589
|
* This bit is cleared after the each garbage collection pass.
|
588
590
|
*/
|
589
591
|
V8_INLINE void MarkActive();
|
590
592
|
|
591
|
-
|
593
|
+
V8_DEPRECATE_SOON("See MarkIndependent.",
|
594
|
+
V8_INLINE bool IsIndependent() const);
|
592
595
|
|
593
596
|
/** Checks if the handle holds the only reference to an object. */
|
594
597
|
V8_INLINE bool IsNearDeath() const;
|
@@ -952,7 +955,7 @@ class V8_EXPORT EscapableHandleScope : public HandleScope {
|
|
952
955
|
*/
|
953
956
|
class V8_EXPORT SealHandleScope {
|
954
957
|
public:
|
955
|
-
SealHandleScope(Isolate* isolate);
|
958
|
+
explicit SealHandleScope(Isolate* isolate);
|
956
959
|
~SealHandleScope();
|
957
960
|
|
958
961
|
SealHandleScope(const SealHandleScope&) = delete;
|
@@ -984,9 +987,6 @@ class V8_EXPORT Data {
|
|
984
987
|
};
|
985
988
|
|
986
989
|
/**
|
987
|
-
* This is an unfinished experimental feature, and is only exposed
|
988
|
-
* here for internal testing purposes. DO NOT USE.
|
989
|
-
*
|
990
990
|
* A container type that holds relevant metadata for module loading.
|
991
991
|
*
|
992
992
|
* This is passed back to the embedder as part of
|
@@ -1008,9 +1008,6 @@ class V8_EXPORT ScriptOrModule {
|
|
1008
1008
|
};
|
1009
1009
|
|
1010
1010
|
/**
|
1011
|
-
* This is an unfinished experimental feature, and is only exposed
|
1012
|
-
* here for internal testing purposes. DO NOT USE.
|
1013
|
-
*
|
1014
1011
|
* An array to hold Primitive values. This is used by the embedder to
|
1015
1012
|
* pass host defined options to the ScriptOptions during compilation.
|
1016
1013
|
*
|
@@ -1143,15 +1140,16 @@ class V8_EXPORT Location {
|
|
1143
1140
|
};
|
1144
1141
|
|
1145
1142
|
/**
|
1146
|
-
* This is an unfinished experimental feature, and is only exposed
|
1147
|
-
* here for internal testing purposes. DO NOT USE.
|
1148
|
-
*
|
1149
1143
|
* A compiled JavaScript module.
|
1150
1144
|
*/
|
1151
1145
|
class V8_EXPORT Module {
|
1152
1146
|
public:
|
1153
1147
|
/**
|
1154
1148
|
* The different states a module can be in.
|
1149
|
+
*
|
1150
|
+
* This corresponds to the states used in ECMAScript except that "evaluated"
|
1151
|
+
* is split into kEvaluated and kErrored, indicating success and failure,
|
1152
|
+
* respectively.
|
1155
1153
|
*/
|
1156
1154
|
enum Status {
|
1157
1155
|
kUninstantiated,
|
@@ -1199,29 +1197,29 @@ class V8_EXPORT Module {
|
|
1199
1197
|
Local<Module> referrer);
|
1200
1198
|
|
1201
1199
|
/**
|
1202
|
-
*
|
1200
|
+
* Instantiates the module and its dependencies.
|
1203
1201
|
*
|
1204
1202
|
* Returns an empty Maybe<bool> if an exception occurred during
|
1205
1203
|
* instantiation. (In the case where the callback throws an exception, that
|
1206
1204
|
* exception is propagated.)
|
1207
1205
|
*/
|
1208
|
-
V8_DEPRECATED("Use Maybe<bool> version",
|
1209
|
-
bool Instantiate(Local<Context> context,
|
1210
|
-
ResolveCallback callback));
|
1211
1206
|
V8_WARN_UNUSED_RESULT Maybe<bool> InstantiateModule(Local<Context> context,
|
1212
1207
|
ResolveCallback callback);
|
1213
1208
|
|
1214
1209
|
/**
|
1215
|
-
*
|
1210
|
+
* Evaluates the module and its dependencies.
|
1216
1211
|
*
|
1217
|
-
*
|
1218
|
-
*
|
1212
|
+
* If status is kInstantiated, run the module's code. On success, set status
|
1213
|
+
* to kEvaluated and return the completion value; on failure, set status to
|
1214
|
+
* kErrored and propagate the thrown exception (which is then also available
|
1215
|
+
* via |GetException|).
|
1219
1216
|
*/
|
1220
1217
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context);
|
1221
1218
|
|
1222
1219
|
/**
|
1223
1220
|
* Returns the namespace object of this module.
|
1224
|
-
*
|
1221
|
+
*
|
1222
|
+
* The module's status must be at least kInstantiated.
|
1225
1223
|
*/
|
1226
1224
|
Local<Value> GetModuleNamespace();
|
1227
1225
|
};
|
@@ -1235,24 +1233,23 @@ class V8_EXPORT Script {
|
|
1235
1233
|
/**
|
1236
1234
|
* A shorthand for ScriptCompiler::Compile().
|
1237
1235
|
*/
|
1238
|
-
static
|
1239
|
-
|
1240
|
-
|
1241
|
-
ScriptOrigin* origin = nullptr));
|
1236
|
+
static V8_DEPRECATED("Use maybe version",
|
1237
|
+
Local<Script> Compile(Local<String> source,
|
1238
|
+
ScriptOrigin* origin = nullptr));
|
1242
1239
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
|
1243
1240
|
Local<Context> context, Local<String> source,
|
1244
1241
|
ScriptOrigin* origin = nullptr);
|
1245
1242
|
|
1246
|
-
static Local<Script>
|
1247
|
-
|
1248
|
-
|
1243
|
+
static Local<Script> V8_DEPRECATED("Use maybe version",
|
1244
|
+
Compile(Local<String> source,
|
1245
|
+
Local<String> file_name));
|
1249
1246
|
|
1250
1247
|
/**
|
1251
1248
|
* Runs the script returning the resulting value. It will be run in the
|
1252
1249
|
* context in which it was created (ScriptCompiler::CompileBound or
|
1253
1250
|
* UnboundScript::BindToCurrentContext()).
|
1254
1251
|
*/
|
1255
|
-
|
1252
|
+
V8_DEPRECATED("Use maybe version", Local<Value> Run());
|
1256
1253
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context);
|
1257
1254
|
|
1258
1255
|
/**
|
@@ -1411,14 +1408,14 @@ class V8_EXPORT ScriptCompiler {
|
|
1411
1408
|
// object is alive.
|
1412
1409
|
const CachedData* GetCachedData() const;
|
1413
1410
|
|
1414
|
-
internal::
|
1411
|
+
internal::ScriptStreamingData* impl() const { return impl_; }
|
1415
1412
|
|
1416
1413
|
// Prevent copying.
|
1417
1414
|
StreamedSource(const StreamedSource&) = delete;
|
1418
1415
|
StreamedSource& operator=(const StreamedSource&) = delete;
|
1419
1416
|
|
1420
1417
|
private:
|
1421
|
-
internal::
|
1418
|
+
internal::ScriptStreamingData* impl_;
|
1422
1419
|
};
|
1423
1420
|
|
1424
1421
|
/**
|
@@ -1437,7 +1434,29 @@ class V8_EXPORT ScriptCompiler {
|
|
1437
1434
|
kConsumeParserCache,
|
1438
1435
|
kProduceCodeCache,
|
1439
1436
|
kProduceFullCodeCache,
|
1440
|
-
kConsumeCodeCache
|
1437
|
+
kConsumeCodeCache,
|
1438
|
+
kEagerCompile
|
1439
|
+
};
|
1440
|
+
|
1441
|
+
/**
|
1442
|
+
* The reason for which we are not requesting or providing a code cache.
|
1443
|
+
*/
|
1444
|
+
enum NoCacheReason {
|
1445
|
+
kNoCacheNoReason = 0,
|
1446
|
+
kNoCacheBecauseCachingDisabled,
|
1447
|
+
kNoCacheBecauseNoResource,
|
1448
|
+
kNoCacheBecauseInlineScript,
|
1449
|
+
kNoCacheBecauseModule,
|
1450
|
+
kNoCacheBecauseStreamingSource,
|
1451
|
+
kNoCacheBecauseInspector,
|
1452
|
+
kNoCacheBecauseScriptTooSmall,
|
1453
|
+
kNoCacheBecauseCacheTooCold,
|
1454
|
+
kNoCacheBecauseV8Extension,
|
1455
|
+
kNoCacheBecauseExtensionModule,
|
1456
|
+
kNoCacheBecausePacScript,
|
1457
|
+
kNoCacheBecauseInDocumentWrite,
|
1458
|
+
kNoCacheBecauseResourceWithNoCacheHandler,
|
1459
|
+
kNoCacheBecauseDeferredProduceCodeCache
|
1441
1460
|
};
|
1442
1461
|
|
1443
1462
|
/**
|
@@ -1453,13 +1472,10 @@ class V8_EXPORT ScriptCompiler {
|
|
1453
1472
|
* \return Compiled script object (context independent; for running it must be
|
1454
1473
|
* bound to a context).
|
1455
1474
|
*/
|
1456
|
-
static V8_DEPRECATED("Use maybe version",
|
1457
|
-
Local<UnboundScript> CompileUnbound(
|
1458
|
-
Isolate* isolate, Source* source,
|
1459
|
-
CompileOptions options = kNoCompileOptions));
|
1460
1475
|
static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundScript(
|
1461
1476
|
Isolate* isolate, Source* source,
|
1462
|
-
CompileOptions options = kNoCompileOptions
|
1477
|
+
CompileOptions options = kNoCompileOptions,
|
1478
|
+
NoCacheReason no_cache_reason = kNoCacheNoReason);
|
1463
1479
|
|
1464
1480
|
/**
|
1465
1481
|
* Compiles the specified script (bound to current context).
|
@@ -1472,13 +1488,10 @@ class V8_EXPORT ScriptCompiler {
|
|
1472
1488
|
* when this function was called. When run it will always use this
|
1473
1489
|
* context.
|
1474
1490
|
*/
|
1475
|
-
static V8_DEPRECATED(
|
1476
|
-
"Use maybe version",
|
1477
|
-
Local<Script> Compile(Isolate* isolate, Source* source,
|
1478
|
-
CompileOptions options = kNoCompileOptions));
|
1479
1491
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
|
1480
1492
|
Local<Context> context, Source* source,
|
1481
|
-
CompileOptions options = kNoCompileOptions
|
1493
|
+
CompileOptions options = kNoCompileOptions,
|
1494
|
+
NoCacheReason no_cache_reason = kNoCacheNoReason);
|
1482
1495
|
|
1483
1496
|
/**
|
1484
1497
|
* Returns a task which streams script data into V8, or NULL if the script
|
@@ -1502,11 +1515,6 @@ class V8_EXPORT ScriptCompiler {
|
|
1502
1515
|
* (ScriptStreamingTask has been run). V8 doesn't construct the source string
|
1503
1516
|
* during streaming, so the embedder needs to pass the full source here.
|
1504
1517
|
*/
|
1505
|
-
static V8_DEPRECATED("Use maybe version",
|
1506
|
-
Local<Script> Compile(Isolate* isolate,
|
1507
|
-
StreamedSource* source,
|
1508
|
-
Local<String> full_source_string,
|
1509
|
-
const ScriptOrigin& origin));
|
1510
1518
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
|
1511
1519
|
Local<Context> context, StreamedSource* source,
|
1512
1520
|
Local<String> full_source_string, const ScriptOrigin& origin);
|
@@ -1532,9 +1540,6 @@ class V8_EXPORT ScriptCompiler {
|
|
1532
1540
|
static uint32_t CachedDataVersionTag();
|
1533
1541
|
|
1534
1542
|
/**
|
1535
|
-
* This is an unfinished experimental feature, and is only exposed
|
1536
|
-
* here for internal testing purposes. DO NOT USE.
|
1537
|
-
*
|
1538
1543
|
* Compile an ES module, returning a Module that encapsulates
|
1539
1544
|
* the compiled code.
|
1540
1545
|
*
|
@@ -1554,21 +1559,41 @@ class V8_EXPORT ScriptCompiler {
|
|
1554
1559
|
* It is possible to specify multiple context extensions (obj in the above
|
1555
1560
|
* example).
|
1556
1561
|
*/
|
1557
|
-
static
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1562
|
+
static V8_DEPRECATED("Use maybe version",
|
1563
|
+
Local<Function> CompileFunctionInContext(
|
1564
|
+
Isolate* isolate, Source* source,
|
1565
|
+
Local<Context> context, size_t arguments_count,
|
1566
|
+
Local<String> arguments[],
|
1567
|
+
size_t context_extension_count,
|
1568
|
+
Local<Object> context_extensions[]));
|
1564
1569
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext(
|
1565
1570
|
Local<Context> context, Source* source, size_t arguments_count,
|
1566
1571
|
Local<String> arguments[], size_t context_extension_count,
|
1567
|
-
Local<Object> context_extensions[]
|
1572
|
+
Local<Object> context_extensions[],
|
1573
|
+
CompileOptions options = kNoCompileOptions,
|
1574
|
+
NoCacheReason no_cache_reason = kNoCacheNoReason);
|
1575
|
+
|
1576
|
+
/**
|
1577
|
+
* Creates and returns code cache for the specified unbound_script.
|
1578
|
+
* This will return nullptr if the script cannot be serialized. The
|
1579
|
+
* CachedData returned by this function should be owned by the caller.
|
1580
|
+
*/
|
1581
|
+
static CachedData* CreateCodeCache(Local<UnboundScript> unbound_script,
|
1582
|
+
Local<String> source);
|
1583
|
+
|
1584
|
+
/**
|
1585
|
+
* Creates and returns code cache for the specified function that was
|
1586
|
+
* previously produced by CompileFunctionInContext.
|
1587
|
+
* This will return nullptr if the script cannot be serialized. The
|
1588
|
+
* CachedData returned by this function should be owned by the caller.
|
1589
|
+
*/
|
1590
|
+
static CachedData* CreateCodeCacheForFunction(Local<Function> function,
|
1591
|
+
Local<String> source);
|
1568
1592
|
|
1569
1593
|
private:
|
1570
1594
|
static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
|
1571
|
-
Isolate* isolate, Source* source, CompileOptions options
|
1595
|
+
Isolate* isolate, Source* source, CompileOptions options,
|
1596
|
+
NoCacheReason no_cache_reason);
|
1572
1597
|
};
|
1573
1598
|
|
1574
1599
|
|
@@ -1579,7 +1604,7 @@ class V8_EXPORT Message {
|
|
1579
1604
|
public:
|
1580
1605
|
Local<String> Get() const;
|
1581
1606
|
|
1582
|
-
|
1607
|
+
V8_DEPRECATED("Use maybe version", Local<String> GetSourceLine() const);
|
1583
1608
|
V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine(
|
1584
1609
|
Local<Context> context) const;
|
1585
1610
|
|
@@ -1605,7 +1630,7 @@ class V8_EXPORT Message {
|
|
1605
1630
|
/**
|
1606
1631
|
* Returns the number, 1-based, of the line where the error occurred.
|
1607
1632
|
*/
|
1608
|
-
|
1633
|
+
V8_DEPRECATED("Use maybe version", int GetLineNumber() const);
|
1609
1634
|
V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const;
|
1610
1635
|
|
1611
1636
|
/**
|
@@ -1629,14 +1654,14 @@ class V8_EXPORT Message {
|
|
1629
1654
|
* Returns the index within the line of the first character where
|
1630
1655
|
* the error occurred.
|
1631
1656
|
*/
|
1632
|
-
|
1657
|
+
int GetStartColumn() const;
|
1633
1658
|
V8_WARN_UNUSED_RESULT Maybe<int> GetStartColumn(Local<Context> context) const;
|
1634
1659
|
|
1635
1660
|
/**
|
1636
1661
|
* Returns the index within the line of the last character where
|
1637
1662
|
* the error occurred.
|
1638
1663
|
*/
|
1639
|
-
|
1664
|
+
int GetEndColumn() const;
|
1640
1665
|
V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const;
|
1641
1666
|
|
1642
1667
|
/**
|
@@ -1692,11 +1717,6 @@ class V8_EXPORT StackTrace {
|
|
1692
1717
|
*/
|
1693
1718
|
int GetFrameCount() const;
|
1694
1719
|
|
1695
|
-
/**
|
1696
|
-
* Returns StackTrace as a v8::Array that contains StackFrame objects.
|
1697
|
-
*/
|
1698
|
-
V8_DEPRECATED("Use native API instead", Local<Array> AsArray());
|
1699
|
-
|
1700
1720
|
/**
|
1701
1721
|
* Grab a snapshot of the current JavaScript execution stack.
|
1702
1722
|
*
|
@@ -1818,8 +1838,6 @@ class V8_EXPORT JSON {
|
|
1818
1838
|
* \param json_string The string to parse.
|
1819
1839
|
* \return The corresponding value if successfully parsed.
|
1820
1840
|
*/
|
1821
|
-
static V8_DEPRECATED("Use the maybe version taking context",
|
1822
|
-
Local<Value> Parse(Local<String> json_string));
|
1823
1841
|
static V8_DEPRECATE_SOON("Use the maybe version taking context",
|
1824
1842
|
MaybeLocal<Value> Parse(Isolate* isolate,
|
1825
1843
|
Local<String> json_string));
|
@@ -1871,7 +1889,7 @@ class V8_EXPORT ValueSerializer {
|
|
1871
1889
|
* SharedArrayBuffer object. The embedder must return an ID for the
|
1872
1890
|
* object, using the same ID if this SharedArrayBuffer has already been
|
1873
1891
|
* serialized in this buffer. When deserializing, this ID will be passed to
|
1874
|
-
* ValueDeserializer::
|
1892
|
+
* ValueDeserializer::GetSharedArrayBufferFromId as |clone_id|.
|
1875
1893
|
*
|
1876
1894
|
* If the object cannot be serialized, an
|
1877
1895
|
* exception should be thrown and Nothing<uint32_t>() returned.
|
@@ -1998,6 +2016,13 @@ class V8_EXPORT ValueDeserializer {
|
|
1998
2016
|
*/
|
1999
2017
|
virtual MaybeLocal<WasmCompiledModule> GetWasmModuleFromId(
|
2000
2018
|
Isolate* isolate, uint32_t transfer_id);
|
2019
|
+
|
2020
|
+
/**
|
2021
|
+
* Get a SharedArrayBuffer given a clone_id previously provided
|
2022
|
+
* by ValueSerializer::GetSharedArrayBufferId
|
2023
|
+
*/
|
2024
|
+
virtual MaybeLocal<SharedArrayBuffer> GetSharedArrayBufferFromId(
|
2025
|
+
Isolate* isolate, uint32_t clone_id);
|
2001
2026
|
};
|
2002
2027
|
|
2003
2028
|
ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size);
|
@@ -2070,20 +2095,6 @@ class V8_EXPORT ValueDeserializer {
|
|
2070
2095
|
PrivateData* private_;
|
2071
2096
|
};
|
2072
2097
|
|
2073
|
-
/**
|
2074
|
-
* A map whose keys are referenced weakly. It is similar to JavaScript WeakMap
|
2075
|
-
* but can be created without entering a v8::Context and hence shouldn't
|
2076
|
-
* escape to JavaScript.
|
2077
|
-
*/
|
2078
|
-
class V8_EXPORT NativeWeakMap : public Data {
|
2079
|
-
public:
|
2080
|
-
static Local<NativeWeakMap> New(Isolate* isolate);
|
2081
|
-
void Set(Local<Value> key, Local<Value> value);
|
2082
|
-
Local<Value> Get(Local<Value> key) const;
|
2083
|
-
bool Has(Local<Value> key);
|
2084
|
-
bool Delete(Local<Value> key);
|
2085
|
-
};
|
2086
|
-
|
2087
2098
|
|
2088
2099
|
// --- Value ---
|
2089
2100
|
|
@@ -2154,6 +2165,11 @@ class V8_EXPORT Value : public Data {
|
|
2154
2165
|
*/
|
2155
2166
|
bool IsObject() const;
|
2156
2167
|
|
2168
|
+
/**
|
2169
|
+
* Returns true if this value is a bigint.
|
2170
|
+
*/
|
2171
|
+
bool IsBigInt() const;
|
2172
|
+
|
2157
2173
|
/**
|
2158
2174
|
* Returns true if this value is boolean.
|
2159
2175
|
*/
|
@@ -2189,6 +2205,11 @@ class V8_EXPORT Value : public Data {
|
|
2189
2205
|
*/
|
2190
2206
|
bool IsArgumentsObject() const;
|
2191
2207
|
|
2208
|
+
/**
|
2209
|
+
* Returns true if this value is a BigInt object.
|
2210
|
+
*/
|
2211
|
+
bool IsBigIntObject() const;
|
2212
|
+
|
2192
2213
|
/**
|
2193
2214
|
* Returns true if this value is a Boolean object.
|
2194
2215
|
*/
|
@@ -2329,6 +2350,16 @@ class V8_EXPORT Value : public Data {
|
|
2329
2350
|
*/
|
2330
2351
|
bool IsFloat64Array() const;
|
2331
2352
|
|
2353
|
+
/**
|
2354
|
+
* Returns true if this value is a BigInt64Array.
|
2355
|
+
*/
|
2356
|
+
bool IsBigInt64Array() const;
|
2357
|
+
|
2358
|
+
/**
|
2359
|
+
* Returns true if this value is a BigUint64Array.
|
2360
|
+
*/
|
2361
|
+
bool IsBigUint64Array() const;
|
2362
|
+
|
2332
2363
|
/**
|
2333
2364
|
* Returns true if this value is a DataView.
|
2334
2365
|
*/
|
@@ -2347,6 +2378,8 @@ class V8_EXPORT Value : public Data {
|
|
2347
2378
|
|
2348
2379
|
bool IsWebAssemblyCompiledModule() const;
|
2349
2380
|
|
2381
|
+
V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt(
|
2382
|
+
Local<Context> context) const;
|
2350
2383
|
V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
|
2351
2384
|
Local<Context> context) const;
|
2352
2385
|
V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
|
@@ -2369,34 +2402,24 @@ class V8_EXPORT Value : public Data {
|
|
2369
2402
|
Local<Number> ToNumber(Isolate* isolate) const);
|
2370
2403
|
V8_DEPRECATE_SOON("Use maybe version",
|
2371
2404
|
Local<String> ToString(Isolate* isolate) const);
|
2372
|
-
V8_DEPRECATED("Use maybe version",
|
2373
|
-
Local<String> ToDetailString(Isolate* isolate) const);
|
2374
2405
|
V8_DEPRECATE_SOON("Use maybe version",
|
2375
2406
|
Local<Object> ToObject(Isolate* isolate) const);
|
2376
2407
|
V8_DEPRECATE_SOON("Use maybe version",
|
2377
2408
|
Local<Integer> ToInteger(Isolate* isolate) const);
|
2378
|
-
V8_DEPRECATED("Use maybe version",
|
2379
|
-
Local<Uint32> ToUint32(Isolate* isolate) const);
|
2380
2409
|
V8_DEPRECATE_SOON("Use maybe version",
|
2381
2410
|
Local<Int32> ToInt32(Isolate* isolate) const);
|
2382
2411
|
|
2383
2412
|
inline V8_DEPRECATE_SOON("Use maybe version",
|
2384
2413
|
Local<Boolean> ToBoolean() const);
|
2385
|
-
inline V8_DEPRECATED("Use maybe version", Local<Number> ToNumber() const);
|
2386
2414
|
inline V8_DEPRECATE_SOON("Use maybe version", Local<String> ToString() const);
|
2387
|
-
inline V8_DEPRECATED("Use maybe version",
|
2388
|
-
Local<String> ToDetailString() const);
|
2389
2415
|
inline V8_DEPRECATE_SOON("Use maybe version", Local<Object> ToObject() const);
|
2390
2416
|
inline V8_DEPRECATE_SOON("Use maybe version",
|
2391
2417
|
Local<Integer> ToInteger() const);
|
2392
|
-
inline V8_DEPRECATED("Use maybe version", Local<Uint32> ToUint32() const);
|
2393
|
-
inline V8_DEPRECATED("Use maybe version", Local<Int32> ToInt32() const);
|
2394
2418
|
|
2395
2419
|
/**
|
2396
2420
|
* Attempts to convert a string to an array index.
|
2397
2421
|
* Returns an empty handle if the conversion fails.
|
2398
2422
|
*/
|
2399
|
-
V8_DEPRECATED("Use maybe version", Local<Uint32> ToArrayIndex() const);
|
2400
2423
|
V8_WARN_UNUSED_RESULT MaybeLocal<Uint32> ToArrayIndex(
|
2401
2424
|
Local<Context> context) const;
|
2402
2425
|
|
@@ -2727,13 +2750,6 @@ class V8_EXPORT String : public Name {
|
|
2727
2750
|
Isolate* isolate, const char* data, v8::NewStringType type,
|
2728
2751
|
int length = -1);
|
2729
2752
|
|
2730
|
-
/** Allocates a new string from Latin-1 data.*/
|
2731
|
-
static V8_DEPRECATED(
|
2732
|
-
"Use maybe version",
|
2733
|
-
Local<String> NewFromOneByte(Isolate* isolate, const uint8_t* data,
|
2734
|
-
NewStringType type = kNormalString,
|
2735
|
-
int length = -1));
|
2736
|
-
|
2737
2753
|
/** Allocates a new string from Latin-1 data. Only returns an empty value
|
2738
2754
|
* when length > kMaxLength. **/
|
2739
2755
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
|
@@ -2767,9 +2783,6 @@ class V8_EXPORT String : public Name {
|
|
2767
2783
|
* should the underlying buffer be deallocated or modified except through the
|
2768
2784
|
* destructor of the external string resource.
|
2769
2785
|
*/
|
2770
|
-
static V8_DEPRECATED("Use maybe version",
|
2771
|
-
Local<String> NewExternal(
|
2772
|
-
Isolate* isolate, ExternalStringResource* resource));
|
2773
2786
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalTwoByte(
|
2774
2787
|
Isolate* isolate, ExternalStringResource* resource);
|
2775
2788
|
|
@@ -2824,8 +2837,8 @@ class V8_EXPORT String : public Name {
|
|
2824
2837
|
*/
|
2825
2838
|
class V8_EXPORT Utf8Value {
|
2826
2839
|
public:
|
2827
|
-
|
2828
|
-
|
2840
|
+
V8_DEPRECATED("Use Isolate version",
|
2841
|
+
explicit Utf8Value(Local<v8::Value> obj));
|
2829
2842
|
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
|
2830
2843
|
~Utf8Value();
|
2831
2844
|
char* operator*() { return str_; }
|
@@ -2849,8 +2862,7 @@ class V8_EXPORT String : public Name {
|
|
2849
2862
|
*/
|
2850
2863
|
class V8_EXPORT Value {
|
2851
2864
|
public:
|
2852
|
-
|
2853
|
-
explicit Value(Local<v8::Value> obj));
|
2865
|
+
V8_DEPRECATED("Use Isolate version", explicit Value(Local<v8::Value> obj));
|
2854
2866
|
Value(Isolate* isolate, Local<v8::Value> obj);
|
2855
2867
|
~Value();
|
2856
2868
|
uint16_t* operator*() { return str_; }
|
@@ -2954,8 +2966,12 @@ class V8_EXPORT Private : public Data {
|
|
2954
2966
|
*/
|
2955
2967
|
static Local<Private> ForApi(Isolate* isolate, Local<String> name);
|
2956
2968
|
|
2969
|
+
V8_INLINE static Private* Cast(Data* data);
|
2970
|
+
|
2957
2971
|
private:
|
2958
2972
|
Private();
|
2973
|
+
|
2974
|
+
static void CheckCast(Data* that);
|
2959
2975
|
};
|
2960
2976
|
|
2961
2977
|
|
@@ -3015,6 +3031,19 @@ class V8_EXPORT Uint32 : public Integer {
|
|
3015
3031
|
static void CheckCast(v8::Value* obj);
|
3016
3032
|
};
|
3017
3033
|
|
3034
|
+
/**
|
3035
|
+
* A JavaScript BigInt value (https://tc39.github.io/proposal-bigint)
|
3036
|
+
*/
|
3037
|
+
class V8_EXPORT BigInt : public Primitive {
|
3038
|
+
public:
|
3039
|
+
static Local<BigInt> New(Isolate* isolate, int64_t value);
|
3040
|
+
V8_INLINE static BigInt* Cast(v8::Value* obj);
|
3041
|
+
|
3042
|
+
private:
|
3043
|
+
BigInt();
|
3044
|
+
static void CheckCast(v8::Value* obj);
|
3045
|
+
};
|
3046
|
+
|
3018
3047
|
/**
|
3019
3048
|
* PropertyAttribute.
|
3020
3049
|
*/
|
@@ -3080,6 +3109,15 @@ enum PropertyFilter {
|
|
3080
3109
|
SKIP_SYMBOLS = 16
|
3081
3110
|
};
|
3082
3111
|
|
3112
|
+
/**
|
3113
|
+
* Options for marking whether callbacks may trigger JS-observable side effects.
|
3114
|
+
* Side-effect-free callbacks are whitelisted during debug evaluation with
|
3115
|
+
* throwOnSideEffect. It applies when calling a Function, FunctionTemplate,
|
3116
|
+
* or an Accessor's getter callback. For Interceptors, please see
|
3117
|
+
* PropertyHandlerFlags's kHasNoSideEffect.
|
3118
|
+
*/
|
3119
|
+
enum class SideEffectType { kHasSideEffect, kHasNoSideEffect };
|
3120
|
+
|
3083
3121
|
/**
|
3084
3122
|
* Keys/Properties filter enums:
|
3085
3123
|
*
|
@@ -3091,10 +3129,16 @@ enum class KeyCollectionMode { kOwnOnly, kIncludePrototypes };
|
|
3091
3129
|
|
3092
3130
|
/**
|
3093
3131
|
* kIncludesIndices allows for integer indices to be collected, while
|
3094
|
-
* kSkipIndices will exclude integer
|
3132
|
+
* kSkipIndices will exclude integer indices from being collected.
|
3095
3133
|
*/
|
3096
3134
|
enum class IndexFilter { kIncludeIndices, kSkipIndices };
|
3097
3135
|
|
3136
|
+
/**
|
3137
|
+
* kConvertToString will convert integer indices to strings.
|
3138
|
+
* kKeepNumbers will return numbers for integer indices.
|
3139
|
+
*/
|
3140
|
+
enum class KeyConversionMode { kConvertToString, kKeepNumbers };
|
3141
|
+
|
3098
3142
|
/**
|
3099
3143
|
* Integrity level for objects.
|
3100
3144
|
*/
|
@@ -3155,19 +3199,6 @@ class V8_EXPORT Object : public Value {
|
|
3155
3199
|
V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
|
3156
3200
|
Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
|
3157
3201
|
|
3158
|
-
// Sets an own property on this object bypassing interceptors and
|
3159
|
-
// overriding accessors or read-only properties.
|
3160
|
-
//
|
3161
|
-
// Note that if the object has an interceptor the property will be set
|
3162
|
-
// locally, but since the interceptor takes precedence the local property
|
3163
|
-
// will only be returned if the interceptor doesn't return a value.
|
3164
|
-
//
|
3165
|
-
// Note also that this only works for named properties.
|
3166
|
-
V8_DEPRECATED("Use CreateDataProperty / DefineOwnProperty",
|
3167
|
-
Maybe<bool> ForceSet(Local<Context> context, Local<Value> key,
|
3168
|
-
Local<Value> value,
|
3169
|
-
PropertyAttribute attribs = None));
|
3170
|
-
|
3171
3202
|
V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
|
3172
3203
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
3173
3204
|
Local<Value> key);
|
@@ -3181,16 +3212,12 @@ class V8_EXPORT Object : public Value {
|
|
3181
3212
|
* any combination of ReadOnly, DontEnum and DontDelete. Returns
|
3182
3213
|
* None when the property doesn't exist.
|
3183
3214
|
*/
|
3184
|
-
V8_DEPRECATED("Use maybe version",
|
3185
|
-
PropertyAttribute GetPropertyAttributes(Local<Value> key));
|
3186
3215
|
V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetPropertyAttributes(
|
3187
3216
|
Local<Context> context, Local<Value> key);
|
3188
3217
|
|
3189
3218
|
/**
|
3190
3219
|
* Returns Object.getOwnPropertyDescriptor as per ES2016 section 19.1.2.6.
|
3191
3220
|
*/
|
3192
|
-
V8_DEPRECATED("Use maybe version",
|
3193
|
-
Local<Value> GetOwnPropertyDescriptor(Local<Name> key));
|
3194
3221
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetOwnPropertyDescriptor(
|
3195
3222
|
Local<Context> context, Local<Name> key);
|
3196
3223
|
|
@@ -3217,35 +3244,20 @@ class V8_EXPORT Object : public Value {
|
|
3217
3244
|
V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
|
3218
3245
|
Local<Value> key);
|
3219
3246
|
|
3220
|
-
|
3221
|
-
V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
|
3222
|
-
uint32_t index);
|
3247
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, uint32_t index);
|
3223
3248
|
|
3224
|
-
V8_DEPRECATED("Use maybe version", bool Delete(uint32_t index));
|
3225
3249
|
V8_WARN_UNUSED_RESULT Maybe<bool> Delete(Local<Context> context,
|
3226
3250
|
uint32_t index);
|
3227
3251
|
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
AccessorNameGetterCallback getter,
|
3238
|
-
AccessorNameSetterCallback setter = 0,
|
3239
|
-
Local<Value> data = Local<Value>(),
|
3240
|
-
AccessControl settings = DEFAULT,
|
3241
|
-
PropertyAttribute attribute = None));
|
3242
|
-
V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(Local<Context> context,
|
3243
|
-
Local<Name> name,
|
3244
|
-
AccessorNameGetterCallback getter,
|
3245
|
-
AccessorNameSetterCallback setter = 0,
|
3246
|
-
MaybeLocal<Value> data = MaybeLocal<Value>(),
|
3247
|
-
AccessControl settings = DEFAULT,
|
3248
|
-
PropertyAttribute attribute = None);
|
3252
|
+
/**
|
3253
|
+
* Note: SideEffectType affects the getter only, not the setter.
|
3254
|
+
*/
|
3255
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(
|
3256
|
+
Local<Context> context, Local<Name> name,
|
3257
|
+
AccessorNameGetterCallback getter, AccessorNameSetterCallback setter = 0,
|
3258
|
+
MaybeLocal<Value> data = MaybeLocal<Value>(),
|
3259
|
+
AccessControl settings = DEFAULT, PropertyAttribute attribute = None,
|
3260
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
|
3249
3261
|
|
3250
3262
|
void SetAccessorProperty(Local<Name> name, Local<Function> getter,
|
3251
3263
|
Local<Function> setter = Local<Function>(),
|
@@ -3260,7 +3272,22 @@ class V8_EXPORT Object : public Value {
|
|
3260
3272
|
Local<Context> context, Local<Name> name,
|
3261
3273
|
AccessorNameGetterCallback getter,
|
3262
3274
|
AccessorNameSetterCallback setter = nullptr,
|
3263
|
-
Local<Value> data = Local<Value>(), PropertyAttribute attributes = None
|
3275
|
+
Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
|
3276
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
|
3277
|
+
|
3278
|
+
/**
|
3279
|
+
* Attempts to create a property with the given name which behaves like a data
|
3280
|
+
* property, except that the provided getter is invoked (and provided with the
|
3281
|
+
* data value) to supply its value the first time it is read. After the
|
3282
|
+
* property is accessed once, it is replaced with an ordinary data property.
|
3283
|
+
*
|
3284
|
+
* Analogous to Template::SetLazyDataProperty.
|
3285
|
+
*/
|
3286
|
+
V8_WARN_UNUSED_RESULT Maybe<bool> SetLazyDataProperty(
|
3287
|
+
Local<Context> context, Local<Name> name,
|
3288
|
+
AccessorNameGetterCallback getter, Local<Value> data = Local<Value>(),
|
3289
|
+
PropertyAttribute attributes = None,
|
3290
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
|
3264
3291
|
|
3265
3292
|
/**
|
3266
3293
|
* Functionality for private properties.
|
@@ -3285,7 +3312,8 @@ class V8_EXPORT Object : public Value {
|
|
3285
3312
|
Local<Context> context);
|
3286
3313
|
V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames(
|
3287
3314
|
Local<Context> context, KeyCollectionMode mode,
|
3288
|
-
PropertyFilter property_filter, IndexFilter index_filter
|
3315
|
+
PropertyFilter property_filter, IndexFilter index_filter,
|
3316
|
+
KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
|
3289
3317
|
|
3290
3318
|
/**
|
3291
3319
|
* This function has the same functionality as GetPropertyNames but
|
@@ -3303,7 +3331,8 @@ class V8_EXPORT Object : public Value {
|
|
3303
3331
|
* be enumerated by a for-in statement over this object.
|
3304
3332
|
*/
|
3305
3333
|
V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetOwnPropertyNames(
|
3306
|
-
Local<Context> context, PropertyFilter filter
|
3334
|
+
Local<Context> context, PropertyFilter filter,
|
3335
|
+
KeyConversionMode key_conversion = KeyConversionMode::kKeepNumbers);
|
3307
3336
|
|
3308
3337
|
/**
|
3309
3338
|
* Get the prototype object. This does not skip objects marked to
|
@@ -3317,7 +3346,6 @@ class V8_EXPORT Object : public Value {
|
|
3317
3346
|
* be skipped by __proto__ and it does not consult the security
|
3318
3347
|
* handler.
|
3319
3348
|
*/
|
3320
|
-
V8_DEPRECATED("Use maybe version", bool SetPrototype(Local<Value> prototype));
|
3321
3349
|
V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context,
|
3322
3350
|
Local<Value> prototype);
|
3323
3351
|
|
@@ -3332,7 +3360,6 @@ class V8_EXPORT Object : public Value {
|
|
3332
3360
|
* This is different from Value::ToString() that may call
|
3333
3361
|
* user-defined toString function. This one does not.
|
3334
3362
|
*/
|
3335
|
-
V8_DEPRECATED("Use maybe version", Local<String> ObjectProtoToString());
|
3336
3363
|
V8_WARN_UNUSED_RESULT MaybeLocal<String> ObjectProtoToString(
|
3337
3364
|
Local<Context> context);
|
3338
3365
|
|
@@ -3383,9 +3410,6 @@ class V8_EXPORT Object : public Value {
|
|
3383
3410
|
void SetAlignedPointerInInternalFields(int argc, int indices[],
|
3384
3411
|
void* values[]);
|
3385
3412
|
|
3386
|
-
// Testers for local properties.
|
3387
|
-
V8_DEPRECATED("Use maybe version", bool HasOwnProperty(Local<String> key));
|
3388
|
-
|
3389
3413
|
/**
|
3390
3414
|
* HasOwnProperty() is like JavaScript's Object.prototype.hasOwnProperty().
|
3391
3415
|
*
|
@@ -3425,9 +3449,6 @@ class V8_EXPORT Object : public Value {
|
|
3425
3449
|
* If result.IsEmpty() no real property was located in the prototype chain.
|
3426
3450
|
* This means interceptors in the prototype chain are not called.
|
3427
3451
|
*/
|
3428
|
-
V8_DEPRECATED(
|
3429
|
-
"Use maybe version",
|
3430
|
-
Local<Value> GetRealNamedPropertyInPrototypeChain(Local<String> key));
|
3431
3452
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain(
|
3432
3453
|
Local<Context> context, Local<Name> key);
|
3433
3454
|
|
@@ -3436,10 +3457,6 @@ class V8_EXPORT Object : public Value {
|
|
3436
3457
|
* which can be None or any combination of ReadOnly, DontEnum and DontDelete.
|
3437
3458
|
* Interceptors in the prototype chain are not called.
|
3438
3459
|
*/
|
3439
|
-
V8_DEPRECATED(
|
3440
|
-
"Use maybe version",
|
3441
|
-
Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain(
|
3442
|
-
Local<String> key));
|
3443
3460
|
V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute>
|
3444
3461
|
GetRealNamedPropertyAttributesInPrototypeChain(Local<Context> context,
|
3445
3462
|
Local<Name> key);
|
@@ -3449,8 +3466,6 @@ class V8_EXPORT Object : public Value {
|
|
3449
3466
|
* in the prototype chain.
|
3450
3467
|
* This means interceptors in the prototype chain are not called.
|
3451
3468
|
*/
|
3452
|
-
V8_DEPRECATED("Use maybe version",
|
3453
|
-
Local<Value> GetRealNamedProperty(Local<String> key));
|
3454
3469
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedProperty(
|
3455
3470
|
Local<Context> context, Local<Name> key);
|
3456
3471
|
|
@@ -3459,9 +3474,6 @@ class V8_EXPORT Object : public Value {
|
|
3459
3474
|
* None or any combination of ReadOnly, DontEnum and DontDelete.
|
3460
3475
|
* Interceptors in the prototype chain are not called.
|
3461
3476
|
*/
|
3462
|
-
V8_DEPRECATED("Use maybe version",
|
3463
|
-
Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(
|
3464
|
-
Local<String> key));
|
3465
3477
|
V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(
|
3466
3478
|
Local<Context> context, Local<Name> key);
|
3467
3479
|
|
@@ -3514,9 +3526,6 @@ class V8_EXPORT Object : public Value {
|
|
3514
3526
|
* Call an Object as a function if a callback is set by the
|
3515
3527
|
* ObjectTemplate::SetCallAsFunctionHandler method.
|
3516
3528
|
*/
|
3517
|
-
V8_DEPRECATED("Use maybe version",
|
3518
|
-
Local<Value> CallAsFunction(Local<Value> recv, int argc,
|
3519
|
-
Local<Value> argv[]));
|
3520
3529
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsFunction(Local<Context> context,
|
3521
3530
|
Local<Value> recv,
|
3522
3531
|
int argc,
|
@@ -3527,15 +3536,13 @@ class V8_EXPORT Object : public Value {
|
|
3527
3536
|
* ObjectTemplate::SetCallAsFunctionHandler method.
|
3528
3537
|
* Note: This method behaves like the Function::NewInstance method.
|
3529
3538
|
*/
|
3530
|
-
V8_DEPRECATED("Use maybe version",
|
3531
|
-
Local<Value> CallAsConstructor(int argc, Local<Value> argv[]));
|
3532
3539
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsConstructor(
|
3533
3540
|
Local<Context> context, int argc, Local<Value> argv[]);
|
3534
3541
|
|
3535
3542
|
/**
|
3536
3543
|
* Return the isolate to which the Object belongs to.
|
3537
3544
|
*/
|
3538
|
-
|
3545
|
+
Isolate* GetIsolate();
|
3539
3546
|
|
3540
3547
|
static Local<Object> New(Isolate* isolate);
|
3541
3548
|
|
@@ -3556,16 +3563,6 @@ class V8_EXPORT Array : public Object {
|
|
3556
3563
|
public:
|
3557
3564
|
uint32_t Length() const;
|
3558
3565
|
|
3559
|
-
/**
|
3560
|
-
* Clones an element at index |index|. Returns an empty
|
3561
|
-
* handle if cloning fails (for any reason).
|
3562
|
-
*/
|
3563
|
-
V8_DEPRECATED("Cloning is not supported.",
|
3564
|
-
Local<Object> CloneElementAt(uint32_t index));
|
3565
|
-
V8_DEPRECATED("Cloning is not supported.",
|
3566
|
-
MaybeLocal<Object> CloneElementAt(Local<Context> context,
|
3567
|
-
uint32_t index));
|
3568
|
-
|
3569
3566
|
/**
|
3570
3567
|
* Creates a JavaScript array with the given length. If the length
|
3571
3568
|
* is negative the returned array will have length 0.
|
@@ -3709,8 +3706,6 @@ class FunctionCallbackInfo {
|
|
3709
3706
|
V8_INLINE int Length() const;
|
3710
3707
|
/** Accessor for the available arguments. */
|
3711
3708
|
V8_INLINE Local<Value> operator[](int i) const;
|
3712
|
-
V8_INLINE V8_DEPRECATED("Use Data() to explicitly pass Callee instead",
|
3713
|
-
Local<Function> Callee() const);
|
3714
3709
|
/** Returns the receiver. This corresponds to the "this" value. */
|
3715
3710
|
V8_INLINE Local<Object> This() const;
|
3716
3711
|
/**
|
@@ -3735,7 +3730,7 @@ class FunctionCallbackInfo {
|
|
3735
3730
|
/** The ReturnValue for the call. */
|
3736
3731
|
V8_INLINE ReturnValue<T> GetReturnValue() const;
|
3737
3732
|
// This shouldn't be public, but the arm compiler needs it.
|
3738
|
-
static const int kArgsLength =
|
3733
|
+
static const int kArgsLength = 6;
|
3739
3734
|
|
3740
3735
|
protected:
|
3741
3736
|
friend class internal::FunctionCallbackArguments;
|
@@ -3746,9 +3741,7 @@ class FunctionCallbackInfo {
|
|
3746
3741
|
static const int kReturnValueDefaultValueIndex = 2;
|
3747
3742
|
static const int kReturnValueIndex = 3;
|
3748
3743
|
static const int kDataIndex = 4;
|
3749
|
-
static const int
|
3750
|
-
static const int kContextSaveIndex = 6;
|
3751
|
-
static const int kNewTargetIndex = 7;
|
3744
|
+
static const int kNewTargetIndex = 5;
|
3752
3745
|
|
3753
3746
|
V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args,
|
3754
3747
|
internal::Object** values, int length);
|
@@ -3886,18 +3879,16 @@ class V8_EXPORT Function : public Object {
|
|
3886
3879
|
static MaybeLocal<Function> New(
|
3887
3880
|
Local<Context> context, FunctionCallback callback,
|
3888
3881
|
Local<Value> data = Local<Value>(), int length = 0,
|
3889
|
-
ConstructorBehavior behavior = ConstructorBehavior::kAllow
|
3882
|
+
ConstructorBehavior behavior = ConstructorBehavior::kAllow,
|
3883
|
+
SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
|
3890
3884
|
static V8_DEPRECATE_SOON(
|
3891
3885
|
"Use maybe version",
|
3892
3886
|
Local<Function> New(Isolate* isolate, FunctionCallback callback,
|
3893
3887
|
Local<Value> data = Local<Value>(), int length = 0));
|
3894
3888
|
|
3895
|
-
V8_DEPRECATED("Use maybe version",
|
3896
|
-
Local<Object> NewInstance(int argc, Local<Value> argv[]) const);
|
3897
3889
|
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
|
3898
3890
|
Local<Context> context, int argc, Local<Value> argv[]) const;
|
3899
3891
|
|
3900
|
-
V8_DEPRECATED("Use maybe version", Local<Object> NewInstance() const);
|
3901
3892
|
V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
|
3902
3893
|
Local<Context> context) const {
|
3903
3894
|
return NewInstance(context, 0, nullptr);
|
@@ -3944,11 +3935,6 @@ class V8_EXPORT Function : public Object {
|
|
3944
3935
|
*/
|
3945
3936
|
int GetScriptColumnNumber() const;
|
3946
3937
|
|
3947
|
-
/**
|
3948
|
-
* Tells whether this function is builtin.
|
3949
|
-
*/
|
3950
|
-
V8_DEPRECATED("this should no longer be used.", bool IsBuiltin() const);
|
3951
|
-
|
3952
3938
|
/**
|
3953
3939
|
* Returns scriptId.
|
3954
3940
|
*/
|
@@ -3990,8 +3976,8 @@ class V8_EXPORT Promise : public Object {
|
|
3990
3976
|
/**
|
3991
3977
|
* Create a new resolver, along with an associated promise in pending state.
|
3992
3978
|
*/
|
3993
|
-
static
|
3994
|
-
|
3979
|
+
static V8_DEPRECATED("Use maybe version",
|
3980
|
+
Local<Resolver> New(Isolate* isolate));
|
3995
3981
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Resolver> New(
|
3996
3982
|
Local<Context> context);
|
3997
3983
|
|
@@ -4004,11 +3990,11 @@ class V8_EXPORT Promise : public Object {
|
|
4004
3990
|
* Resolve/reject the associated promise with a given value.
|
4005
3991
|
* Ignored if the promise is no longer pending.
|
4006
3992
|
*/
|
4007
|
-
|
3993
|
+
V8_DEPRECATED("Use maybe version", void Resolve(Local<Value> value));
|
4008
3994
|
V8_WARN_UNUSED_RESULT Maybe<bool> Resolve(Local<Context> context,
|
4009
3995
|
Local<Value> value);
|
4010
3996
|
|
4011
|
-
|
3997
|
+
V8_DEPRECATED("Use maybe version", void Reject(Local<Value> value));
|
4012
3998
|
V8_WARN_UNUSED_RESULT Maybe<bool> Reject(Local<Context> context,
|
4013
3999
|
Local<Value> value);
|
4014
4000
|
|
@@ -4025,13 +4011,9 @@ class V8_EXPORT Promise : public Object {
|
|
4025
4011
|
* an argument. If the promise is already resolved/rejected, the handler is
|
4026
4012
|
* invoked at the end of turn.
|
4027
4013
|
*/
|
4028
|
-
V8_DEPRECATED("Use maybe version",
|
4029
|
-
Local<Promise> Catch(Local<Function> handler));
|
4030
4014
|
V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context,
|
4031
4015
|
Local<Function> handler);
|
4032
4016
|
|
4033
|
-
V8_DEPRECATED("Use maybe version",
|
4034
|
-
Local<Promise> Then(Local<Function> handler));
|
4035
4017
|
V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context,
|
4036
4018
|
Local<Function> handler);
|
4037
4019
|
|
@@ -4140,7 +4122,7 @@ class V8_EXPORT PropertyDescriptor {
|
|
4140
4122
|
*/
|
4141
4123
|
class V8_EXPORT Proxy : public Object {
|
4142
4124
|
public:
|
4143
|
-
Local<
|
4125
|
+
Local<Value> GetTarget();
|
4144
4126
|
Local<Value> GetHandler();
|
4145
4127
|
bool IsRevoked();
|
4146
4128
|
void Revoke();
|
@@ -4164,11 +4146,15 @@ class V8_EXPORT Proxy : public Object {
|
|
4164
4146
|
class V8_EXPORT WasmCompiledModule : public Object {
|
4165
4147
|
public:
|
4166
4148
|
typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule;
|
4167
|
-
|
4149
|
+
/**
|
4150
|
+
* A buffer that is owned by the caller.
|
4151
|
+
*/
|
4168
4152
|
typedef std::pair<const uint8_t*, size_t> CallerOwnedBuffer;
|
4169
4153
|
|
4170
|
-
|
4171
|
-
|
4154
|
+
/**
|
4155
|
+
* An opaque, native heap object for transferring wasm modules. It
|
4156
|
+
* supports move semantics, and does not support copy semantics.
|
4157
|
+
*/
|
4172
4158
|
class TransferrableModule final {
|
4173
4159
|
public:
|
4174
4160
|
TransferrableModule(TransferrableModule&& src) = default;
|
@@ -4187,35 +4173,41 @@ class V8_EXPORT WasmCompiledModule : public Object {
|
|
4187
4173
|
OwnedBuffer wire_bytes = {nullptr, 0};
|
4188
4174
|
};
|
4189
4175
|
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4176
|
+
/**
|
4177
|
+
* Get an in-memory, non-persistable, and context-independent (meaning,
|
4178
|
+
* suitable for transfer to another Isolate and Context) representation
|
4179
|
+
* of this wasm compiled module.
|
4180
|
+
*/
|
4193
4181
|
TransferrableModule GetTransferrableModule();
|
4194
4182
|
|
4195
|
-
|
4196
|
-
|
4183
|
+
/**
|
4184
|
+
* Efficiently re-create a WasmCompiledModule, without recompiling, from
|
4185
|
+
* a TransferrableModule.
|
4186
|
+
*/
|
4197
4187
|
static MaybeLocal<WasmCompiledModule> FromTransferrableModule(
|
4198
4188
|
Isolate* isolate, const TransferrableModule&);
|
4199
4189
|
|
4200
|
-
|
4190
|
+
/**
|
4191
|
+
* Get the wasm-encoded bytes that were used to compile this module.
|
4192
|
+
*/
|
4201
4193
|
Local<String> GetWasmWireBytes();
|
4202
4194
|
|
4203
|
-
|
4204
|
-
|
4195
|
+
/**
|
4196
|
+
* Serialize the compiled module. The serialized data does not include the
|
4197
|
+
* uncompiled bytes.
|
4198
|
+
*/
|
4205
4199
|
SerializedModule Serialize();
|
4206
4200
|
|
4207
|
-
|
4208
|
-
|
4201
|
+
/**
|
4202
|
+
* If possible, deserialize the module, otherwise compile it from the provided
|
4203
|
+
* uncompiled bytes.
|
4204
|
+
*/
|
4209
4205
|
static MaybeLocal<WasmCompiledModule> DeserializeOrCompile(
|
4210
4206
|
Isolate* isolate, const CallerOwnedBuffer& serialized_module,
|
4211
4207
|
const CallerOwnedBuffer& wire_bytes);
|
4212
4208
|
V8_INLINE static WasmCompiledModule* Cast(Value* obj);
|
4213
4209
|
|
4214
4210
|
private:
|
4215
|
-
// TODO(ahaas): please remove the friend once streamed compilation is
|
4216
|
-
// implemented
|
4217
|
-
friend class WasmModuleObjectBuilder;
|
4218
|
-
|
4219
4211
|
static MaybeLocal<WasmCompiledModule> Deserialize(
|
4220
4212
|
Isolate* isolate, const CallerOwnedBuffer& serialized_module,
|
4221
4213
|
const CallerOwnedBuffer& wire_bytes);
|
@@ -4235,11 +4227,18 @@ class V8_EXPORT WasmCompiledModule : public Object {
|
|
4235
4227
|
// to simply WasmModuleObjectBuilder
|
4236
4228
|
class V8_EXPORT WasmModuleObjectBuilderStreaming final {
|
4237
4229
|
public:
|
4238
|
-
WasmModuleObjectBuilderStreaming(Isolate* isolate);
|
4239
|
-
|
4230
|
+
explicit WasmModuleObjectBuilderStreaming(Isolate* isolate);
|
4231
|
+
/**
|
4232
|
+
* The buffer passed into OnBytesReceived is owned by the caller.
|
4233
|
+
*/
|
4240
4234
|
void OnBytesReceived(const uint8_t*, size_t size);
|
4241
4235
|
void Finish();
|
4242
|
-
|
4236
|
+
/**
|
4237
|
+
* Abort streaming compilation. If {exception} has a value, then the promise
|
4238
|
+
* associated with streaming compilation is rejected with that value. If
|
4239
|
+
* {exception} does not have value, the promise does not get rejected.
|
4240
|
+
*/
|
4241
|
+
void Abort(MaybeLocal<Value> exception);
|
4243
4242
|
Local<Promise> GetPromise();
|
4244
4243
|
|
4245
4244
|
~WasmModuleObjectBuilderStreaming();
|
@@ -4258,11 +4257,13 @@ class V8_EXPORT WasmModuleObjectBuilderStreaming final {
|
|
4258
4257
|
Isolate* isolate_ = nullptr;
|
4259
4258
|
|
4260
4259
|
#if V8_CC_MSVC
|
4261
|
-
|
4262
|
-
|
4263
|
-
|
4264
|
-
|
4265
|
-
|
4260
|
+
/**
|
4261
|
+
* We don't need the static Copy API, so the default
|
4262
|
+
* NonCopyablePersistentTraits would be sufficient, however,
|
4263
|
+
* MSVC eagerly instantiates the Copy.
|
4264
|
+
* We ensure we don't use Copy, however, by compiling with the
|
4265
|
+
* defaults everywhere else.
|
4266
|
+
*/
|
4266
4267
|
Persistent<Promise, CopyablePersistentTraits<Promise>> promise_;
|
4267
4268
|
#else
|
4268
4269
|
Persistent<Promise> promise_;
|
@@ -4272,30 +4273,6 @@ class V8_EXPORT WasmModuleObjectBuilderStreaming final {
|
|
4272
4273
|
std::shared_ptr<internal::wasm::StreamingDecoder> streaming_decoder_;
|
4273
4274
|
};
|
4274
4275
|
|
4275
|
-
class V8_EXPORT WasmModuleObjectBuilder final {
|
4276
|
-
public:
|
4277
|
-
WasmModuleObjectBuilder(Isolate* isolate) : isolate_(isolate) {}
|
4278
|
-
// The buffer passed into OnBytesReceived is owned by the caller.
|
4279
|
-
void OnBytesReceived(const uint8_t*, size_t size);
|
4280
|
-
MaybeLocal<WasmCompiledModule> Finish();
|
4281
|
-
|
4282
|
-
private:
|
4283
|
-
Isolate* isolate_ = nullptr;
|
4284
|
-
// TODO(ahaas): We probably need none of this below here once streamed
|
4285
|
-
// compilation is implemented.
|
4286
|
-
typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> Buffer;
|
4287
|
-
|
4288
|
-
// Disable copy semantics *in this implementation*. We can choose to
|
4289
|
-
// relax this, albeit it's not clear why.
|
4290
|
-
WasmModuleObjectBuilder(const WasmModuleObjectBuilder&) = delete;
|
4291
|
-
WasmModuleObjectBuilder(WasmModuleObjectBuilder&&) = default;
|
4292
|
-
WasmModuleObjectBuilder& operator=(const WasmModuleObjectBuilder&) = delete;
|
4293
|
-
WasmModuleObjectBuilder& operator=(WasmModuleObjectBuilder&&) = default;
|
4294
|
-
|
4295
|
-
std::vector<Buffer> received_buffers_;
|
4296
|
-
size_t total_size_ = 0;
|
4297
|
-
};
|
4298
|
-
|
4299
4276
|
#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
|
4300
4277
|
// The number of required internal fields can be defined by embedder.
|
4301
4278
|
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
|
@@ -4341,41 +4318,18 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
4341
4318
|
*/
|
4342
4319
|
virtual void* AllocateUninitialized(size_t length) = 0;
|
4343
4320
|
|
4344
|
-
/**
|
4345
|
-
* Reserved |length| bytes, but do not commit the memory. Must call
|
4346
|
-
* |SetProtection| to make memory accessible.
|
4347
|
-
*/
|
4348
|
-
// TODO(eholk): make this pure virtual once blink implements this.
|
4349
|
-
virtual void* Reserve(size_t length);
|
4350
|
-
|
4351
4321
|
/**
|
4352
4322
|
* Free the memory block of size |length|, pointed to by |data|.
|
4353
4323
|
* That memory is guaranteed to be previously allocated by |Allocate|.
|
4354
4324
|
*/
|
4355
4325
|
virtual void Free(void* data, size_t length) = 0;
|
4356
4326
|
|
4357
|
-
enum class AllocationMode { kNormal, kReservation };
|
4358
|
-
|
4359
4327
|
/**
|
4360
|
-
*
|
4361
|
-
*
|
4362
|
-
*
|
4328
|
+
* ArrayBuffer allocation mode. kNormal is a malloc/free style allocation,
|
4329
|
+
* while kReservation is for larger allocations with the ability to set
|
4330
|
+
* access permissions.
|
4363
4331
|
*/
|
4364
|
-
|
4365
|
-
virtual void Free(void* data, size_t length, AllocationMode mode);
|
4366
|
-
|
4367
|
-
enum class Protection { kNoAccess, kReadWrite };
|
4368
|
-
|
4369
|
-
/**
|
4370
|
-
* Change the protection on a region of memory.
|
4371
|
-
*
|
4372
|
-
* On platforms that make a distinction between reserving and committing
|
4373
|
-
* memory, changing the protection to kReadWrite must also ensure the memory
|
4374
|
-
* is committed.
|
4375
|
-
*/
|
4376
|
-
// TODO(eholk): make this pure virtual once blink implements this.
|
4377
|
-
virtual void SetProtection(void* data, size_t length,
|
4378
|
-
Protection protection);
|
4332
|
+
enum class AllocationMode { kNormal, kReservation };
|
4379
4333
|
|
4380
4334
|
/**
|
4381
4335
|
* malloc/free based convenience allocator.
|
@@ -4735,6 +4689,37 @@ class V8_EXPORT Float64Array : public TypedArray {
|
|
4735
4689
|
static void CheckCast(Value* obj);
|
4736
4690
|
};
|
4737
4691
|
|
4692
|
+
/**
|
4693
|
+
* An instance of BigInt64Array constructor.
|
4694
|
+
*/
|
4695
|
+
class V8_EXPORT BigInt64Array : public TypedArray {
|
4696
|
+
public:
|
4697
|
+
static Local<BigInt64Array> New(Local<ArrayBuffer> array_buffer,
|
4698
|
+
size_t byte_offset, size_t length);
|
4699
|
+
static Local<BigInt64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
4700
|
+
size_t byte_offset, size_t length);
|
4701
|
+
V8_INLINE static BigInt64Array* Cast(Value* obj);
|
4702
|
+
|
4703
|
+
private:
|
4704
|
+
BigInt64Array();
|
4705
|
+
static void CheckCast(Value* obj);
|
4706
|
+
};
|
4707
|
+
|
4708
|
+
/**
|
4709
|
+
* An instance of BigUint64Array constructor.
|
4710
|
+
*/
|
4711
|
+
class V8_EXPORT BigUint64Array : public TypedArray {
|
4712
|
+
public:
|
4713
|
+
static Local<BigUint64Array> New(Local<ArrayBuffer> array_buffer,
|
4714
|
+
size_t byte_offset, size_t length);
|
4715
|
+
static Local<BigUint64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
|
4716
|
+
size_t byte_offset, size_t length);
|
4717
|
+
V8_INLINE static BigUint64Array* Cast(Value* obj);
|
4718
|
+
|
4719
|
+
private:
|
4720
|
+
BigUint64Array();
|
4721
|
+
static void CheckCast(Value* obj);
|
4722
|
+
};
|
4738
4723
|
|
4739
4724
|
/**
|
4740
4725
|
* An instance of DataView constructor (ES6 draft 15.13.7).
|
@@ -4918,6 +4903,20 @@ class V8_EXPORT NumberObject : public Object {
|
|
4918
4903
|
static void CheckCast(Value* obj);
|
4919
4904
|
};
|
4920
4905
|
|
4906
|
+
/**
|
4907
|
+
* A BigInt object (https://tc39.github.io/proposal-bigint)
|
4908
|
+
*/
|
4909
|
+
class V8_EXPORT BigIntObject : public Object {
|
4910
|
+
public:
|
4911
|
+
static Local<Value> New(Isolate* isolate, int64_t value);
|
4912
|
+
|
4913
|
+
Local<BigInt> ValueOf() const;
|
4914
|
+
|
4915
|
+
V8_INLINE static BigIntObject* Cast(Value* obj);
|
4916
|
+
|
4917
|
+
private:
|
4918
|
+
static void CheckCast(Value* obj);
|
4919
|
+
};
|
4921
4920
|
|
4922
4921
|
/**
|
4923
4922
|
* A Boolean object (ECMA-262, 4.3.15).
|
@@ -4925,7 +4924,6 @@ class V8_EXPORT NumberObject : public Object {
|
|
4925
4924
|
class V8_EXPORT BooleanObject : public Object {
|
4926
4925
|
public:
|
4927
4926
|
static Local<Value> New(Isolate* isolate, bool value);
|
4928
|
-
V8_DEPRECATED("Pass an isolate", static Local<Value> New(bool value));
|
4929
4927
|
|
4930
4928
|
bool ValueOf() const;
|
4931
4929
|
|
@@ -4997,9 +4995,8 @@ class V8_EXPORT RegExp : public Object {
|
|
4997
4995
|
* static_cast<RegExp::Flags>(kGlobal | kMultiline))
|
4998
4996
|
* is equivalent to evaluating "/foo/gm".
|
4999
4997
|
*/
|
5000
|
-
static
|
5001
|
-
|
5002
|
-
Flags flags));
|
4998
|
+
static V8_DEPRECATED("Use maybe version",
|
4999
|
+
Local<RegExp> New(Local<String> pattern, Flags flags));
|
5003
5000
|
static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> New(Local<Context> context,
|
5004
5001
|
Local<String> pattern,
|
5005
5002
|
Flags flags);
|
@@ -5262,7 +5259,7 @@ typedef void (*GenericNamedPropertySetterCallback)(
|
|
5262
5259
|
* defineProperty().
|
5263
5260
|
*
|
5264
5261
|
* Use `info.GetReturnValue().Set(value)` to set the property attributes. The
|
5265
|
-
* value is an
|
5262
|
+
* value is an integer encoding a `v8::PropertyAttribute`.
|
5266
5263
|
*
|
5267
5264
|
* \param property The name of the property for which the request was
|
5268
5265
|
* intercepted.
|
@@ -5467,7 +5464,8 @@ typedef bool (*AccessCheckCallback)(Local<Context> accessing_context,
|
|
5467
5464
|
* v8::Local<v8::ObjectTemplate> instance_t = t->InstanceTemplate();
|
5468
5465
|
* instance_t->SetAccessor(String::NewFromUtf8(isolate, "instance_accessor"),
|
5469
5466
|
* InstanceAccessorCallback);
|
5470
|
-
* instance_t->
|
5467
|
+
* instance_t->SetHandler(
|
5468
|
+
* NamedPropertyHandlerConfiguration(PropertyHandlerCallback));
|
5471
5469
|
* instance_t->Set(String::NewFromUtf8(isolate, "instance_property"),
|
5472
5470
|
* Number::New(isolate, 3));
|
5473
5471
|
*
|
@@ -5536,7 +5534,8 @@ class V8_EXPORT FunctionTemplate : public Template {
|
|
5536
5534
|
Isolate* isolate, FunctionCallback callback = 0,
|
5537
5535
|
Local<Value> data = Local<Value>(),
|
5538
5536
|
Local<Signature> signature = Local<Signature>(), int length = 0,
|
5539
|
-
ConstructorBehavior behavior = ConstructorBehavior::kAllow
|
5537
|
+
ConstructorBehavior behavior = ConstructorBehavior::kAllow,
|
5538
|
+
SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
|
5540
5539
|
|
5541
5540
|
/** Get a template included in the snapshot by index. */
|
5542
5541
|
static MaybeLocal<FunctionTemplate> FromSnapshot(Isolate* isolate,
|
@@ -5548,7 +5547,8 @@ class V8_EXPORT FunctionTemplate : public Template {
|
|
5548
5547
|
static Local<FunctionTemplate> NewWithCache(
|
5549
5548
|
Isolate* isolate, FunctionCallback callback,
|
5550
5549
|
Local<Private> cache_property, Local<Value> data = Local<Value>(),
|
5551
|
-
Local<Signature> signature = Local<Signature>(), int length = 0
|
5550
|
+
Local<Signature> signature = Local<Signature>(), int length = 0,
|
5551
|
+
SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
|
5552
5552
|
|
5553
5553
|
/** Returns the unique function instance in the current execution context.*/
|
5554
5554
|
V8_DEPRECATE_SOON("Use maybe version", Local<Function> GetFunction());
|
@@ -5569,8 +5569,9 @@ class V8_EXPORT FunctionTemplate : public Template {
|
|
5569
5569
|
* callback is called whenever the function created from this
|
5570
5570
|
* FunctionTemplate is called.
|
5571
5571
|
*/
|
5572
|
-
void SetCallHandler(
|
5573
|
-
|
5572
|
+
void SetCallHandler(
|
5573
|
+
FunctionCallback callback, Local<Value> data = Local<Value>(),
|
5574
|
+
SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
|
5574
5575
|
|
5575
5576
|
/** Set the predefined length property for the FunctionTemplate. */
|
5576
5577
|
void SetLength(int length);
|
@@ -5580,7 +5581,7 @@ class V8_EXPORT FunctionTemplate : public Template {
|
|
5580
5581
|
|
5581
5582
|
/**
|
5582
5583
|
* Causes the function template to inherit from a parent function template.
|
5583
|
-
* This means the
|
5584
|
+
* This means the function's prototype.__proto__ is set to the parent
|
5584
5585
|
* function's prototype.
|
5585
5586
|
**/
|
5586
5587
|
void Inherit(Local<FunctionTemplate> parent);
|
@@ -5645,8 +5646,12 @@ class V8_EXPORT FunctionTemplate : public Template {
|
|
5645
5646
|
*/
|
5646
5647
|
bool HasInstance(Local<Value> object);
|
5647
5648
|
|
5649
|
+
V8_INLINE static FunctionTemplate* Cast(Data* data);
|
5650
|
+
|
5648
5651
|
private:
|
5649
5652
|
FunctionTemplate();
|
5653
|
+
|
5654
|
+
static void CheckCast(Data* that);
|
5650
5655
|
friend class Context;
|
5651
5656
|
friend class ObjectTemplate;
|
5652
5657
|
};
|
@@ -5677,6 +5682,11 @@ enum class PropertyHandlerFlags {
|
|
5677
5682
|
* named interceptors.
|
5678
5683
|
*/
|
5679
5684
|
kOnlyInterceptStrings = 1 << 2,
|
5685
|
+
|
5686
|
+
/**
|
5687
|
+
* The getter, query, enumerator callbacks do not produce side effects.
|
5688
|
+
*/
|
5689
|
+
kHasNoSideEffect = 1 << 3,
|
5680
5690
|
};
|
5681
5691
|
|
5682
5692
|
struct NamedPropertyHandlerConfiguration {
|
@@ -5793,7 +5803,6 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
5793
5803
|
static Local<ObjectTemplate> New(
|
5794
5804
|
Isolate* isolate,
|
5795
5805
|
Local<FunctionTemplate> constructor = Local<FunctionTemplate>());
|
5796
|
-
static V8_DEPRECATED("Use isolate version", Local<ObjectTemplate> New());
|
5797
5806
|
|
5798
5807
|
/** Get a template included in the snapshot by index. */
|
5799
5808
|
static MaybeLocal<ObjectTemplate> FromSnapshot(Isolate* isolate,
|
@@ -5865,13 +5874,16 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
5865
5874
|
* \param data A piece of data that will be passed to the callbacks
|
5866
5875
|
* whenever they are invoked.
|
5867
5876
|
*/
|
5868
|
-
|
5869
|
-
|
5870
|
-
|
5871
|
-
|
5872
|
-
|
5873
|
-
|
5874
|
-
|
5877
|
+
V8_DEPRECATED(
|
5878
|
+
"Use SetHandler(const NamedPropertyHandlerConfiguration) "
|
5879
|
+
"with the kOnlyInterceptStrings flag set.",
|
5880
|
+
void SetNamedPropertyHandler(
|
5881
|
+
NamedPropertyGetterCallback getter,
|
5882
|
+
NamedPropertySetterCallback setter = 0,
|
5883
|
+
NamedPropertyQueryCallback query = 0,
|
5884
|
+
NamedPropertyDeleterCallback deleter = 0,
|
5885
|
+
NamedPropertyEnumeratorCallback enumerator = 0,
|
5886
|
+
Local<Value> data = Local<Value>()));
|
5875
5887
|
|
5876
5888
|
/**
|
5877
5889
|
* Sets a named property handler on the object template.
|
@@ -5986,15 +5998,18 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
5986
5998
|
bool IsImmutableProto();
|
5987
5999
|
|
5988
6000
|
/**
|
5989
|
-
* Makes the
|
6001
|
+
* Makes the ObjectTemplate for an immutable prototype exotic object, with an
|
5990
6002
|
* immutable __proto__.
|
5991
6003
|
*/
|
5992
6004
|
void SetImmutableProto();
|
5993
6005
|
|
6006
|
+
V8_INLINE static ObjectTemplate* Cast(Data* data);
|
6007
|
+
|
5994
6008
|
private:
|
5995
6009
|
ObjectTemplate();
|
5996
6010
|
static Local<ObjectTemplate> New(internal::Isolate* isolate,
|
5997
6011
|
Local<FunctionTemplate> constructor);
|
6012
|
+
static void CheckCast(Data* that);
|
5998
6013
|
friend class FunctionTemplate;
|
5999
6014
|
};
|
6000
6015
|
|
@@ -6012,8 +6027,12 @@ class V8_EXPORT Signature : public Data {
|
|
6012
6027
|
Isolate* isolate,
|
6013
6028
|
Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
|
6014
6029
|
|
6030
|
+
V8_INLINE static Signature* Cast(Data* data);
|
6031
|
+
|
6015
6032
|
private:
|
6016
6033
|
Signature();
|
6034
|
+
|
6035
|
+
static void CheckCast(Data* that);
|
6017
6036
|
};
|
6018
6037
|
|
6019
6038
|
|
@@ -6027,8 +6046,12 @@ class V8_EXPORT AccessorSignature : public Data {
|
|
6027
6046
|
Isolate* isolate,
|
6028
6047
|
Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
|
6029
6048
|
|
6049
|
+
V8_INLINE static AccessorSignature* Cast(Data* data);
|
6050
|
+
|
6030
6051
|
private:
|
6031
6052
|
AccessorSignature();
|
6053
|
+
|
6054
|
+
static void CheckCast(Data* that);
|
6032
6055
|
};
|
6033
6056
|
|
6034
6057
|
|
@@ -6131,13 +6154,13 @@ class V8_EXPORT ResourceConstraints {
|
|
6131
6154
|
|
6132
6155
|
// Returns the max semi-space size in MB.
|
6133
6156
|
V8_DEPRECATE_SOON("Use max_semi_space_size_in_kb()",
|
6134
|
-
|
6135
|
-
return
|
6157
|
+
size_t max_semi_space_size()) {
|
6158
|
+
return max_semi_space_size_in_kb_ / 1024;
|
6136
6159
|
}
|
6137
6160
|
|
6138
6161
|
// Sets the max semi-space size in MB.
|
6139
6162
|
V8_DEPRECATE_SOON("Use set_max_semi_space_size_in_kb(size_t limit_in_kb)",
|
6140
|
-
void set_max_semi_space_size(
|
6163
|
+
void set_max_semi_space_size(size_t limit_in_mb)) {
|
6141
6164
|
max_semi_space_size_in_kb_ = limit_in_mb * 1024;
|
6142
6165
|
}
|
6143
6166
|
|
@@ -6151,16 +6174,16 @@ class V8_EXPORT ResourceConstraints {
|
|
6151
6174
|
max_semi_space_size_in_kb_ = limit_in_kb;
|
6152
6175
|
}
|
6153
6176
|
|
6154
|
-
|
6155
|
-
void set_max_old_space_size(
|
6177
|
+
size_t max_old_space_size() const { return max_old_space_size_; }
|
6178
|
+
void set_max_old_space_size(size_t limit_in_mb) {
|
6156
6179
|
max_old_space_size_ = limit_in_mb;
|
6157
6180
|
}
|
6158
6181
|
V8_DEPRECATE_SOON("max_executable_size_ is subsumed by max_old_space_size_",
|
6159
|
-
|
6182
|
+
size_t max_executable_size() const) {
|
6160
6183
|
return max_executable_size_;
|
6161
6184
|
}
|
6162
6185
|
V8_DEPRECATE_SOON("max_executable_size_ is subsumed by max_old_space_size_",
|
6163
|
-
void set_max_executable_size(
|
6186
|
+
void set_max_executable_size(size_t limit_in_mb)) {
|
6164
6187
|
max_executable_size_ = limit_in_mb;
|
6165
6188
|
}
|
6166
6189
|
uint32_t* stack_limit() const { return stack_limit_; }
|
@@ -6171,17 +6194,15 @@ class V8_EXPORT ResourceConstraints {
|
|
6171
6194
|
code_range_size_ = limit_in_mb;
|
6172
6195
|
}
|
6173
6196
|
size_t max_zone_pool_size() const { return max_zone_pool_size_; }
|
6174
|
-
void set_max_zone_pool_size(
|
6175
|
-
max_zone_pool_size_ = bytes;
|
6176
|
-
}
|
6197
|
+
void set_max_zone_pool_size(size_t bytes) { max_zone_pool_size_ = bytes; }
|
6177
6198
|
|
6178
6199
|
private:
|
6179
6200
|
// max_semi_space_size_ is in KB
|
6180
6201
|
size_t max_semi_space_size_in_kb_;
|
6181
6202
|
|
6182
6203
|
// The remaining limits are in MB
|
6183
|
-
|
6184
|
-
|
6204
|
+
size_t max_old_space_size_;
|
6205
|
+
size_t max_executable_size_;
|
6185
6206
|
uint32_t* stack_limit_;
|
6186
6207
|
size_t code_range_size_;
|
6187
6208
|
size_t max_zone_pool_size_;
|
@@ -6222,8 +6243,6 @@ class V8_EXPORT Exception {
|
|
6222
6243
|
* or capture the current stack trace if not available.
|
6223
6244
|
*/
|
6224
6245
|
static Local<Message> CreateMessage(Isolate* isolate, Local<Value> exception);
|
6225
|
-
V8_DEPRECATED("Use version with an Isolate*",
|
6226
|
-
static Local<Message> CreateMessage(Local<Value> exception));
|
6227
6246
|
|
6228
6247
|
/**
|
6229
6248
|
* Returns the original stack trace that was captured at the creation time
|
@@ -6244,24 +6263,6 @@ typedef void* (*CreateHistogramCallback)(const char* name,
|
|
6244
6263
|
|
6245
6264
|
typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
|
6246
6265
|
|
6247
|
-
// --- Memory Allocation Callback ---
|
6248
|
-
enum ObjectSpace {
|
6249
|
-
kObjectSpaceNewSpace = 1 << 0,
|
6250
|
-
kObjectSpaceOldSpace = 1 << 1,
|
6251
|
-
kObjectSpaceCodeSpace = 1 << 2,
|
6252
|
-
kObjectSpaceMapSpace = 1 << 3,
|
6253
|
-
kObjectSpaceLoSpace = 1 << 4,
|
6254
|
-
kObjectSpaceAll = kObjectSpaceNewSpace | kObjectSpaceOldSpace |
|
6255
|
-
kObjectSpaceCodeSpace | kObjectSpaceMapSpace |
|
6256
|
-
kObjectSpaceLoSpace
|
6257
|
-
};
|
6258
|
-
|
6259
|
-
enum AllocationAction {
|
6260
|
-
kAllocationActionAllocate = 1 << 0,
|
6261
|
-
kAllocationActionFree = 1 << 1,
|
6262
|
-
kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFree
|
6263
|
-
};
|
6264
|
-
|
6265
6266
|
// --- Enter/Leave Script Callback ---
|
6266
6267
|
typedef void (*BeforeCallEnteredCallback)(Isolate*);
|
6267
6268
|
typedef void (*CallCompletedCallback)(Isolate*);
|
@@ -6291,6 +6292,20 @@ typedef MaybeLocal<Promise> (*HostImportModuleDynamicallyCallback)(
|
|
6291
6292
|
Local<Context> context, Local<ScriptOrModule> referrer,
|
6292
6293
|
Local<String> specifier);
|
6293
6294
|
|
6295
|
+
/**
|
6296
|
+
* HostInitializeImportMetaObjectCallback is called the first time import.meta
|
6297
|
+
* is accessed for a module. Subsequent access will reuse the same value.
|
6298
|
+
*
|
6299
|
+
* The method combines two implementation-defined abstract operations into one:
|
6300
|
+
* HostGetImportMetaProperties and HostFinalizeImportMeta.
|
6301
|
+
*
|
6302
|
+
* The embedder should use v8::Object::CreateDataProperty to add properties on
|
6303
|
+
* the meta object.
|
6304
|
+
*/
|
6305
|
+
typedef void (*HostInitializeImportMetaObjectCallback)(Local<Context> context,
|
6306
|
+
Local<Module> module,
|
6307
|
+
Local<Object> meta);
|
6308
|
+
|
6294
6309
|
/**
|
6295
6310
|
* PromiseHook with type kInit is called when a new promise is
|
6296
6311
|
* created. When a new promise is created as part of the chain in the
|
@@ -6331,11 +6346,6 @@ class PromiseRejectMessage {
|
|
6331
6346
|
V8_INLINE PromiseRejectEvent GetEvent() const { return event_; }
|
6332
6347
|
V8_INLINE Local<Value> GetValue() const { return value_; }
|
6333
6348
|
|
6334
|
-
V8_DEPRECATED("Use v8::Exception::CreateMessage(GetValue())->GetStackTrace()",
|
6335
|
-
V8_INLINE Local<StackTrace> GetStackTrace() const) {
|
6336
|
-
return stack_trace_;
|
6337
|
-
}
|
6338
|
-
|
6339
6349
|
private:
|
6340
6350
|
Local<Promise> promise_;
|
6341
6351
|
PromiseRejectEvent event_;
|
@@ -6418,6 +6428,9 @@ typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context,
|
|
6418
6428
|
// --- WebAssembly compilation callbacks ---
|
6419
6429
|
typedef bool (*ExtensionCallback)(const FunctionCallbackInfo<Value>&);
|
6420
6430
|
|
6431
|
+
typedef bool (*AllowWasmCodeGenerationCallback)(Local<Context> context,
|
6432
|
+
Local<String> source);
|
6433
|
+
|
6421
6434
|
// --- Callback for APIs defined on v8-supported objects, but implemented
|
6422
6435
|
// by the embedder. Example: WebAssembly.{compile|instantiate}Streaming ---
|
6423
6436
|
typedef void (*ApiImplementationCallback)(const FunctionCallbackInfo<Value>&);
|
@@ -6468,6 +6481,15 @@ typedef void (*GCCallback)(GCType type, GCCallbackFlags flags);
|
|
6468
6481
|
|
6469
6482
|
typedef void (*InterruptCallback)(Isolate* isolate, void* data);
|
6470
6483
|
|
6484
|
+
/**
|
6485
|
+
* This callback is invoked when the heap size is close to the heap limit and
|
6486
|
+
* V8 is likely to abort with out-of-memory error.
|
6487
|
+
* The callback can extend the heap limit by returning a value that is greater
|
6488
|
+
* than the current_heap_limit. The initial heap limit is the limit that was
|
6489
|
+
* set after heap setup.
|
6490
|
+
*/
|
6491
|
+
typedef size_t (*NearHeapLimitCallback)(void* data, size_t current_heap_limit,
|
6492
|
+
size_t initial_heap_limit);
|
6471
6493
|
|
6472
6494
|
/**
|
6473
6495
|
* Collection of V8 heap information.
|
@@ -6486,6 +6508,8 @@ class V8_EXPORT HeapStatistics {
|
|
6486
6508
|
size_t heap_size_limit() { return heap_size_limit_; }
|
6487
6509
|
size_t malloced_memory() { return malloced_memory_; }
|
6488
6510
|
size_t peak_malloced_memory() { return peak_malloced_memory_; }
|
6511
|
+
size_t number_of_native_contexts() { return number_of_native_contexts_; }
|
6512
|
+
size_t number_of_detached_contexts() { return number_of_detached_contexts_; }
|
6489
6513
|
|
6490
6514
|
/**
|
6491
6515
|
* Returns a 0/1 boolean, which signifies whether the V8 overwrite heap
|
@@ -6503,6 +6527,8 @@ class V8_EXPORT HeapStatistics {
|
|
6503
6527
|
size_t malloced_memory_;
|
6504
6528
|
size_t peak_malloced_memory_;
|
6505
6529
|
bool does_zap_garbage_;
|
6530
|
+
size_t number_of_native_contexts_;
|
6531
|
+
size_t number_of_detached_contexts_;
|
6506
6532
|
|
6507
6533
|
friend class V8;
|
6508
6534
|
friend class Isolate;
|
@@ -6597,8 +6623,17 @@ struct JitCodeEvent {
|
|
6597
6623
|
// statement, and is used to indicate possible break locations.
|
6598
6624
|
enum PositionType { POSITION, STATEMENT_POSITION };
|
6599
6625
|
|
6626
|
+
// There are two different kinds of JitCodeEvents, one for JIT code generated
|
6627
|
+
// by the optimizing compiler, and one for byte code generated for the
|
6628
|
+
// interpreter. For JIT_CODE events, the |code_start| member of the event
|
6629
|
+
// points to the beginning of jitted assembly code, while for BYTE_CODE
|
6630
|
+
// events, |code_start| points to the first bytecode of the interpreted
|
6631
|
+
// function.
|
6632
|
+
enum CodeType { BYTE_CODE, JIT_CODE };
|
6633
|
+
|
6600
6634
|
// Type of event.
|
6601
6635
|
EventType type;
|
6636
|
+
CodeType code_type;
|
6602
6637
|
// Start of the instructions.
|
6603
6638
|
void* code_start;
|
6604
6639
|
// Size of the instructions.
|
@@ -7049,9 +7084,16 @@ class V8_EXPORT Isolate {
|
|
7049
7084
|
kConstructorNonUndefinedPrimitiveReturn = 39,
|
7050
7085
|
kLabeledExpressionStatement = 40,
|
7051
7086
|
kLineOrParagraphSeparatorAsLineTerminator = 41,
|
7087
|
+
kIndexAccessor = 42,
|
7088
|
+
kErrorCaptureStackTrace = 43,
|
7089
|
+
kErrorPrepareStackTrace = 44,
|
7090
|
+
kErrorStackTraceLimit = 45,
|
7091
|
+
kWebAssemblyInstantiation = 46,
|
7092
|
+
kDeoptimizerDisableSpeculation = 47,
|
7052
7093
|
|
7053
7094
|
// If you add new values here, you'll also need to update Chromium's:
|
7054
|
-
//
|
7095
|
+
// web_feature.mojom, UseCounterCallback.cpp, and enums.xml. V8 changes to
|
7096
|
+
// this list need to be landed first, then changes on the Chromium side.
|
7055
7097
|
kUseCounterFeatureCount // This enum value must be last.
|
7056
7098
|
};
|
7057
7099
|
|
@@ -7102,15 +7144,19 @@ class V8_EXPORT Isolate {
|
|
7102
7144
|
AbortOnUncaughtExceptionCallback callback);
|
7103
7145
|
|
7104
7146
|
/**
|
7105
|
-
* This is an unfinished experimental feature, and is only exposed
|
7106
|
-
* here for internal testing purposes. DO NOT USE.
|
7107
|
-
*
|
7108
7147
|
* This specifies the callback called by the upcoming dynamic
|
7109
7148
|
* import() language feature to load modules.
|
7110
7149
|
*/
|
7111
7150
|
void SetHostImportModuleDynamicallyCallback(
|
7112
7151
|
HostImportModuleDynamicallyCallback callback);
|
7113
7152
|
|
7153
|
+
/**
|
7154
|
+
* This specifies the callback called by the upcoming importa.meta
|
7155
|
+
* language feature to retrieve host-defined meta data for a module.
|
7156
|
+
*/
|
7157
|
+
void SetHostInitializeImportMetaObjectCallback(
|
7158
|
+
HostInitializeImportMetaObjectCallback callback);
|
7159
|
+
|
7114
7160
|
/**
|
7115
7161
|
* Optional notification that the system is running low on memory.
|
7116
7162
|
* V8 uses these notifications to guide heuristics.
|
@@ -7179,6 +7225,14 @@ class V8_EXPORT Isolate {
|
|
7179
7225
|
*/
|
7180
7226
|
V8_INLINE static uint32_t GetNumberOfDataSlots();
|
7181
7227
|
|
7228
|
+
/**
|
7229
|
+
* Return data that was previously attached to the isolate snapshot via
|
7230
|
+
* SnapshotCreator, and removes the reference to it.
|
7231
|
+
* Repeated call with the same index returns an empty MaybeLocal.
|
7232
|
+
*/
|
7233
|
+
template <class T>
|
7234
|
+
V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
|
7235
|
+
|
7182
7236
|
/**
|
7183
7237
|
* Get statistics about the heap memory usage.
|
7184
7238
|
*/
|
@@ -7275,8 +7329,13 @@ class V8_EXPORT Isolate {
|
|
7275
7329
|
* is initialized. It is the embedder's responsibility to stop all CPU
|
7276
7330
|
* profiling activities if it has started any.
|
7277
7331
|
*/
|
7278
|
-
|
7279
|
-
|
7332
|
+
V8_DEPRECATED("CpuProfiler should be created with CpuProfiler::New call.",
|
7333
|
+
CpuProfiler* GetCpuProfiler());
|
7334
|
+
|
7335
|
+
/**
|
7336
|
+
* Tells the CPU profiler whether the embedder is idle.
|
7337
|
+
*/
|
7338
|
+
void SetIdle(bool is_idle);
|
7280
7339
|
|
7281
7340
|
/** Returns true if this isolate has a current context. */
|
7282
7341
|
bool InContext();
|
@@ -7292,7 +7351,7 @@ class V8_EXPORT Isolate {
|
|
7292
7351
|
* context of the top-most JavaScript frame. If there are no
|
7293
7352
|
* JavaScript frames an empty handle is returned.
|
7294
7353
|
*/
|
7295
|
-
|
7354
|
+
V8_DEPRECATED(
|
7296
7355
|
"Calling context concept is not compatible with tail calls, and will be "
|
7297
7356
|
"removed.",
|
7298
7357
|
Local<Context> GetCallingContext());
|
@@ -7469,7 +7528,7 @@ class V8_EXPORT Isolate {
|
|
7469
7528
|
* further callbacks.
|
7470
7529
|
*/
|
7471
7530
|
void AddCallCompletedCallback(CallCompletedCallback callback);
|
7472
|
-
|
7531
|
+
V8_DEPRECATED(
|
7473
7532
|
"Use callback with parameter",
|
7474
7533
|
void AddCallCompletedCallback(DeprecatedCallCompletedCallback callback));
|
7475
7534
|
|
@@ -7477,10 +7536,9 @@ class V8_EXPORT Isolate {
|
|
7477
7536
|
* Removes callback that was installed by AddCallCompletedCallback.
|
7478
7537
|
*/
|
7479
7538
|
void RemoveCallCompletedCallback(CallCompletedCallback callback);
|
7480
|
-
|
7481
|
-
|
7482
|
-
|
7483
|
-
DeprecatedCallCompletedCallback callback));
|
7539
|
+
V8_DEPRECATED("Use callback with parameter",
|
7540
|
+
void RemoveCallCompletedCallback(
|
7541
|
+
DeprecatedCallCompletedCallback callback));
|
7484
7542
|
|
7485
7543
|
/**
|
7486
7544
|
* Set the PromiseHook callback for various promise lifecycle
|
@@ -7495,38 +7553,36 @@ class V8_EXPORT Isolate {
|
|
7495
7553
|
void SetPromiseRejectCallback(PromiseRejectCallback callback);
|
7496
7554
|
|
7497
7555
|
/**
|
7498
|
-
*
|
7556
|
+
* Runs the Microtask Work Queue until empty
|
7499
7557
|
* Any exceptions thrown by microtask callbacks are swallowed.
|
7500
7558
|
*/
|
7501
7559
|
void RunMicrotasks();
|
7502
7560
|
|
7503
7561
|
/**
|
7504
|
-
*
|
7562
|
+
* Enqueues the callback to the Microtask Work Queue
|
7505
7563
|
*/
|
7506
7564
|
void EnqueueMicrotask(Local<Function> microtask);
|
7507
7565
|
|
7508
7566
|
/**
|
7509
|
-
*
|
7567
|
+
* Enqueues the callback to the Microtask Work Queue
|
7510
7568
|
*/
|
7511
|
-
void EnqueueMicrotask(MicrotaskCallback
|
7569
|
+
void EnqueueMicrotask(MicrotaskCallback callback, void* data = nullptr);
|
7512
7570
|
|
7513
7571
|
/**
|
7514
|
-
*
|
7515
|
-
* for details.
|
7572
|
+
* Controls how Microtasks are invoked. See MicrotasksPolicy for details.
|
7516
7573
|
*/
|
7517
7574
|
void SetMicrotasksPolicy(MicrotasksPolicy policy);
|
7518
|
-
|
7519
|
-
|
7575
|
+
V8_DEPRECATED("Use SetMicrotasksPolicy",
|
7576
|
+
void SetAutorunMicrotasks(bool autorun));
|
7520
7577
|
|
7521
7578
|
/**
|
7522
|
-
*
|
7579
|
+
* Returns the policy controlling how Microtasks are invoked.
|
7523
7580
|
*/
|
7524
7581
|
MicrotasksPolicy GetMicrotasksPolicy() const;
|
7525
|
-
|
7526
|
-
bool WillAutorunMicrotasks() const);
|
7582
|
+
V8_DEPRECATED("Use GetMicrotasksPolicy", bool WillAutorunMicrotasks() const);
|
7527
7583
|
|
7528
7584
|
/**
|
7529
|
-
*
|
7585
|
+
* Adds a callback to notify the host application after
|
7530
7586
|
* microtasks were run. The callback is triggered by explicit RunMicrotasks
|
7531
7587
|
* call or automatic microtasks execution (see SetAutorunMicrotasks).
|
7532
7588
|
*
|
@@ -7580,9 +7636,6 @@ class V8_EXPORT Isolate {
|
|
7580
7636
|
*/
|
7581
7637
|
bool IdleNotificationDeadline(double deadline_in_seconds);
|
7582
7638
|
|
7583
|
-
V8_DEPRECATED("use IdleNotificationDeadline()",
|
7584
|
-
bool IdleNotification(int idle_time_in_ms));
|
7585
|
-
|
7586
7639
|
/**
|
7587
7640
|
* Optional notification that the system is running low on memory.
|
7588
7641
|
* V8 uses these notifications to attempt to free memory.
|
@@ -7695,6 +7748,23 @@ class V8_EXPORT Isolate {
|
|
7695
7748
|
/** Set the callback to invoke in case of OOM errors. */
|
7696
7749
|
void SetOOMErrorHandler(OOMErrorCallback that);
|
7697
7750
|
|
7751
|
+
/**
|
7752
|
+
* Add a callback to invoke in case the heap size is close to the heap limit.
|
7753
|
+
* If multiple callbacks are added, only the most recently added callback is
|
7754
|
+
* invoked.
|
7755
|
+
*/
|
7756
|
+
void AddNearHeapLimitCallback(NearHeapLimitCallback callback, void* data);
|
7757
|
+
|
7758
|
+
/**
|
7759
|
+
* Remove the given callback and restore the heap limit to the
|
7760
|
+
* given limit. If the given limit is zero, then it is ignored.
|
7761
|
+
* If the current heap size is greater than the given limit,
|
7762
|
+
* then the heap limit is restored to the minimal limit that
|
7763
|
+
* is possible for the current heap size.
|
7764
|
+
*/
|
7765
|
+
void RemoveNearHeapLimitCallback(NearHeapLimitCallback callback,
|
7766
|
+
size_t heap_limit);
|
7767
|
+
|
7698
7768
|
/**
|
7699
7769
|
* Set the callback to invoke to check if code generation from
|
7700
7770
|
* strings should be allowed.
|
@@ -7702,6 +7772,13 @@ class V8_EXPORT Isolate {
|
|
7702
7772
|
void SetAllowCodeGenerationFromStringsCallback(
|
7703
7773
|
AllowCodeGenerationFromStringsCallback callback);
|
7704
7774
|
|
7775
|
+
/**
|
7776
|
+
* Set the callback to invoke to check if wasm code generation should
|
7777
|
+
* be allowed.
|
7778
|
+
*/
|
7779
|
+
void SetAllowWasmCodeGenerationCallback(
|
7780
|
+
AllowWasmCodeGenerationCallback callback);
|
7781
|
+
|
7705
7782
|
/**
|
7706
7783
|
* Embedder over{ride|load} injection points for wasm APIs. The expectation
|
7707
7784
|
* is that the embedder sets them at most once.
|
@@ -7817,6 +7894,7 @@ class V8_EXPORT Isolate {
|
|
7817
7894
|
template <class K, class V, class Traits>
|
7818
7895
|
friend class PersistentValueMapBase;
|
7819
7896
|
|
7897
|
+
internal::Object** GetDataFromSnapshotOnce(size_t index);
|
7820
7898
|
void ReportExternalAllocationLimitReached();
|
7821
7899
|
void CheckMemoryPressure();
|
7822
7900
|
};
|
@@ -7856,17 +7934,6 @@ typedef uintptr_t (*ReturnAddressLocationResolver)(
|
|
7856
7934
|
*/
|
7857
7935
|
class V8_EXPORT V8 {
|
7858
7936
|
public:
|
7859
|
-
/** Set the callback to invoke in case of fatal errors. */
|
7860
|
-
V8_INLINE static V8_DEPRECATED(
|
7861
|
-
"Use isolate version",
|
7862
|
-
void SetFatalErrorHandler(FatalErrorCallback that));
|
7863
|
-
|
7864
|
-
/**
|
7865
|
-
* Check if V8 is dead and therefore unusable. This is the case after
|
7866
|
-
* fatal errors such as out-of-memory situations.
|
7867
|
-
*/
|
7868
|
-
V8_INLINE static V8_DEPRECATED("Use isolate version", bool IsDead());
|
7869
|
-
|
7870
7937
|
/**
|
7871
7938
|
* Hand startup data to V8, in case the embedder has chosen to build
|
7872
7939
|
* V8 with external startup data.
|
@@ -7907,35 +7974,6 @@ class V8_EXPORT V8 {
|
|
7907
7974
|
/** Set the callback to invoke in case of Dcheck failures. */
|
7908
7975
|
static void SetDcheckErrorHandler(DcheckErrorCallback that);
|
7909
7976
|
|
7910
|
-
/**
|
7911
|
-
* Adds a message listener.
|
7912
|
-
*
|
7913
|
-
* The same message listener can be added more than once and in that
|
7914
|
-
* case it will be called more than once for each message.
|
7915
|
-
*
|
7916
|
-
* If data is specified, it will be passed to the callback when it is called.
|
7917
|
-
* Otherwise, the exception object will be passed to the callback instead.
|
7918
|
-
*/
|
7919
|
-
V8_INLINE static V8_DEPRECATED(
|
7920
|
-
"Use isolate version",
|
7921
|
-
bool AddMessageListener(MessageCallback that,
|
7922
|
-
Local<Value> data = Local<Value>()));
|
7923
|
-
|
7924
|
-
/**
|
7925
|
-
* Remove all message listeners from the specified callback function.
|
7926
|
-
*/
|
7927
|
-
V8_INLINE static V8_DEPRECATED(
|
7928
|
-
"Use isolate version", void RemoveMessageListeners(MessageCallback that));
|
7929
|
-
|
7930
|
-
/**
|
7931
|
-
* Tells V8 to capture current stack trace when uncaught exception occurs
|
7932
|
-
* and report it to the message listeners. The option is off by default.
|
7933
|
-
*/
|
7934
|
-
V8_INLINE static V8_DEPRECATED(
|
7935
|
-
"Use isolate version",
|
7936
|
-
void SetCaptureStackTraceForUncaughtExceptions(
|
7937
|
-
bool capture, int frame_limit = 10,
|
7938
|
-
StackTrace::StackTraceOptions options = StackTrace::kOverview));
|
7939
7977
|
|
7940
7978
|
/**
|
7941
7979
|
* Sets V8 flags from a string.
|
@@ -7952,55 +7990,6 @@ class V8_EXPORT V8 {
|
|
7952
7990
|
/** Get the version string. */
|
7953
7991
|
static const char* GetVersion();
|
7954
7992
|
|
7955
|
-
/** Callback function for reporting failed access checks.*/
|
7956
|
-
V8_INLINE static V8_DEPRECATED(
|
7957
|
-
"Use isolate version",
|
7958
|
-
void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback));
|
7959
|
-
|
7960
|
-
/**
|
7961
|
-
* Enables the host application to receive a notification before a
|
7962
|
-
* garbage collection. Allocations are not allowed in the
|
7963
|
-
* callback function, you therefore cannot manipulate objects (set
|
7964
|
-
* or delete properties for example) since it is possible such
|
7965
|
-
* operations will result in the allocation of objects. It is possible
|
7966
|
-
* to specify the GCType filter for your callback. But it is not possible to
|
7967
|
-
* register the same callback function two times with different
|
7968
|
-
* GCType filters.
|
7969
|
-
*/
|
7970
|
-
static V8_DEPRECATED(
|
7971
|
-
"Use isolate version",
|
7972
|
-
void AddGCPrologueCallback(GCCallback callback,
|
7973
|
-
GCType gc_type_filter = kGCTypeAll));
|
7974
|
-
|
7975
|
-
/**
|
7976
|
-
* This function removes callback which was installed by
|
7977
|
-
* AddGCPrologueCallback function.
|
7978
|
-
*/
|
7979
|
-
static V8_DEPRECATED("Use isolate version",
|
7980
|
-
void RemoveGCPrologueCallback(GCCallback callback));
|
7981
|
-
|
7982
|
-
/**
|
7983
|
-
* Enables the host application to receive a notification after a
|
7984
|
-
* garbage collection. Allocations are not allowed in the
|
7985
|
-
* callback function, you therefore cannot manipulate objects (set
|
7986
|
-
* or delete properties for example) since it is possible such
|
7987
|
-
* operations will result in the allocation of objects. It is possible
|
7988
|
-
* to specify the GCType filter for your callback. But it is not possible to
|
7989
|
-
* register the same callback function two times with different
|
7990
|
-
* GCType filters.
|
7991
|
-
*/
|
7992
|
-
static V8_DEPRECATED(
|
7993
|
-
"Use isolate version",
|
7994
|
-
void AddGCEpilogueCallback(GCCallback callback,
|
7995
|
-
GCType gc_type_filter = kGCTypeAll));
|
7996
|
-
|
7997
|
-
/**
|
7998
|
-
* This function removes callback which was installed by
|
7999
|
-
* AddGCEpilogueCallback function.
|
8000
|
-
*/
|
8001
|
-
static V8_DEPRECATED("Use isolate version",
|
8002
|
-
void RemoveGCEpilogueCallback(GCCallback callback));
|
8003
|
-
|
8004
7993
|
/**
|
8005
7994
|
* Initializes V8. This function needs to be called before the first Isolate
|
8006
7995
|
* is created. It always returns true.
|
@@ -8020,51 +8009,6 @@ class V8_EXPORT V8 {
|
|
8020
8009
|
static void SetReturnAddressLocationResolver(
|
8021
8010
|
ReturnAddressLocationResolver return_address_resolver);
|
8022
8011
|
|
8023
|
-
/**
|
8024
|
-
* Forcefully terminate the current thread of JavaScript execution
|
8025
|
-
* in the given isolate.
|
8026
|
-
*
|
8027
|
-
* This method can be used by any thread even if that thread has not
|
8028
|
-
* acquired the V8 lock with a Locker object.
|
8029
|
-
*
|
8030
|
-
* \param isolate The isolate in which to terminate the current JS execution.
|
8031
|
-
*/
|
8032
|
-
V8_INLINE static V8_DEPRECATED("Use isolate version",
|
8033
|
-
void TerminateExecution(Isolate* isolate));
|
8034
|
-
|
8035
|
-
/**
|
8036
|
-
* Is V8 terminating JavaScript execution.
|
8037
|
-
*
|
8038
|
-
* Returns true if JavaScript execution is currently terminating
|
8039
|
-
* because of a call to TerminateExecution. In that case there are
|
8040
|
-
* still JavaScript frames on the stack and the termination
|
8041
|
-
* exception is still active.
|
8042
|
-
*
|
8043
|
-
* \param isolate The isolate in which to check.
|
8044
|
-
*/
|
8045
|
-
V8_INLINE static V8_DEPRECATED(
|
8046
|
-
"Use isolate version",
|
8047
|
-
bool IsExecutionTerminating(Isolate* isolate = NULL));
|
8048
|
-
|
8049
|
-
/**
|
8050
|
-
* Resume execution capability in the given isolate, whose execution
|
8051
|
-
* was previously forcefully terminated using TerminateExecution().
|
8052
|
-
*
|
8053
|
-
* When execution is forcefully terminated using TerminateExecution(),
|
8054
|
-
* the isolate can not resume execution until all JavaScript frames
|
8055
|
-
* have propagated the uncatchable exception which is generated. This
|
8056
|
-
* method allows the program embedding the engine to handle the
|
8057
|
-
* termination event and resume execution capability, even if
|
8058
|
-
* JavaScript frames remain on the stack.
|
8059
|
-
*
|
8060
|
-
* This method can be used by any thread even if that thread has not
|
8061
|
-
* acquired the V8 lock with a Locker object.
|
8062
|
-
*
|
8063
|
-
* \param isolate The isolate in which to resume execution capability.
|
8064
|
-
*/
|
8065
|
-
V8_INLINE static V8_DEPRECATED(
|
8066
|
-
"Use isolate version", void CancelTerminateExecution(Isolate* isolate));
|
8067
|
-
|
8068
8012
|
/**
|
8069
8013
|
* Releases any resources used by v8 and stops any utility threads
|
8070
8014
|
* that may be running. Note that disposing v8 is permanent, it
|
@@ -8076,44 +8020,6 @@ class V8_EXPORT V8 {
|
|
8076
8020
|
*/
|
8077
8021
|
static bool Dispose();
|
8078
8022
|
|
8079
|
-
/**
|
8080
|
-
* Iterates through all external resources referenced from current isolate
|
8081
|
-
* heap. GC is not invoked prior to iterating, therefore there is no
|
8082
|
-
* guarantee that visited objects are still alive.
|
8083
|
-
*/
|
8084
|
-
V8_INLINE static V8_DEPRECATED(
|
8085
|
-
"Use isolate version",
|
8086
|
-
void VisitExternalResources(ExternalResourceVisitor* visitor));
|
8087
|
-
|
8088
|
-
/**
|
8089
|
-
* Iterates through all the persistent handles in the current isolate's heap
|
8090
|
-
* that have class_ids.
|
8091
|
-
*/
|
8092
|
-
V8_INLINE static V8_DEPRECATED(
|
8093
|
-
"Use isolate version",
|
8094
|
-
void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor));
|
8095
|
-
|
8096
|
-
/**
|
8097
|
-
* Iterates through all the persistent handles in isolate's heap that have
|
8098
|
-
* class_ids.
|
8099
|
-
*/
|
8100
|
-
V8_INLINE static V8_DEPRECATED(
|
8101
|
-
"Use isolate version",
|
8102
|
-
void VisitHandlesWithClassIds(Isolate* isolate,
|
8103
|
-
PersistentHandleVisitor* visitor));
|
8104
|
-
|
8105
|
-
/**
|
8106
|
-
* Iterates through all the persistent handles in the current isolate's heap
|
8107
|
-
* that have class_ids and are candidates to be marked as partially dependent
|
8108
|
-
* handles. This will visit handles to young objects created since the last
|
8109
|
-
* garbage collection but is free to visit an arbitrary superset of these
|
8110
|
-
* objects.
|
8111
|
-
*/
|
8112
|
-
V8_INLINE static V8_DEPRECATED(
|
8113
|
-
"Use isolate version",
|
8114
|
-
void VisitHandlesForPartialDependence(Isolate* isolate,
|
8115
|
-
PersistentHandleVisitor* visitor));
|
8116
|
-
|
8117
8023
|
/**
|
8118
8024
|
* Initialize the ICU library bundled with V8. The embedder should only
|
8119
8025
|
* invoke this method when using the bundled ICU. Returns true on success.
|
@@ -8121,9 +8027,7 @@ class V8_EXPORT V8 {
|
|
8121
8027
|
* If V8 was compiled with the ICU data in an external file, the location
|
8122
8028
|
* of the data file has to be provided.
|
8123
8029
|
*/
|
8124
|
-
|
8125
|
-
"Use version with default location.",
|
8126
|
-
static bool InitializeICU(const char* icu_data_file = nullptr));
|
8030
|
+
static bool InitializeICU(const char* icu_data_file = nullptr);
|
8127
8031
|
|
8128
8032
|
/**
|
8129
8033
|
* Initialize the ICU library bundled with V8. The embedder should only
|
@@ -8198,7 +8102,16 @@ class V8_EXPORT V8 {
|
|
8198
8102
|
* Enable the default signal handler rather than using one provided by the
|
8199
8103
|
* embedder.
|
8200
8104
|
*/
|
8201
|
-
|
8105
|
+
V8_DEPRECATE_SOON("Use EnableWebAssemblyTrapHandler",
|
8106
|
+
static bool RegisterDefaultSignalHandler());
|
8107
|
+
|
8108
|
+
/**
|
8109
|
+
* Activate trap-based bounds checking for WebAssembly.
|
8110
|
+
*
|
8111
|
+
* \param use_v8_signal_handler Whether V8 should install its own signal
|
8112
|
+
* handler or rely on the embedder's.
|
8113
|
+
*/
|
8114
|
+
static bool EnableWebAssemblyTrapHandler(bool use_v8_signal_handler);
|
8202
8115
|
|
8203
8116
|
private:
|
8204
8117
|
V8();
|
@@ -8218,6 +8131,8 @@ class V8_EXPORT V8 {
|
|
8218
8131
|
WeakCallbackInfo<void>::Callback weak_callback);
|
8219
8132
|
static void MakeWeak(internal::Object*** location_addr);
|
8220
8133
|
static void* ClearWeak(internal::Object** location);
|
8134
|
+
static void AnnotateStrongRetainer(internal::Object** location,
|
8135
|
+
const char* label);
|
8221
8136
|
static Value* Eternalize(Isolate* isolate, Value* handle);
|
8222
8137
|
|
8223
8138
|
static void RegisterExternallyReferencedObject(internal::Object** object,
|
@@ -8296,6 +8211,24 @@ class V8_EXPORT SnapshotCreator {
|
|
8296
8211
|
*/
|
8297
8212
|
size_t AddTemplate(Local<Template> template_obj);
|
8298
8213
|
|
8214
|
+
/**
|
8215
|
+
* Attach arbitrary V8::Data to the context snapshot, which can be retrieved
|
8216
|
+
* via Context::GetDataFromSnapshot after deserialization. This data does not
|
8217
|
+
* survive when a new snapshot is created from an existing snapshot.
|
8218
|
+
* \returns the index for retrieval.
|
8219
|
+
*/
|
8220
|
+
template <class T>
|
8221
|
+
V8_INLINE size_t AddData(Local<Context> context, Local<T> object);
|
8222
|
+
|
8223
|
+
/**
|
8224
|
+
* Attach arbitrary V8::Data to the isolate snapshot, which can be retrieved
|
8225
|
+
* via Isolate::GetDataFromSnapshot after deserialization. This data does not
|
8226
|
+
* survive when a new snapshot is created from an existing snapshot.
|
8227
|
+
* \returns the index for retrieval.
|
8228
|
+
*/
|
8229
|
+
template <class T>
|
8230
|
+
V8_INLINE size_t AddData(Local<T> object);
|
8231
|
+
|
8299
8232
|
/**
|
8300
8233
|
* Created a snapshot data blob.
|
8301
8234
|
* This must not be called from within a handle scope.
|
@@ -8311,6 +8244,9 @@ class V8_EXPORT SnapshotCreator {
|
|
8311
8244
|
void operator=(const SnapshotCreator&) = delete;
|
8312
8245
|
|
8313
8246
|
private:
|
8247
|
+
size_t AddData(Local<Context> context, internal::Object* object);
|
8248
|
+
size_t AddData(internal::Object* object);
|
8249
|
+
|
8314
8250
|
void* data_;
|
8315
8251
|
};
|
8316
8252
|
|
@@ -8383,18 +8319,45 @@ class Maybe {
|
|
8383
8319
|
friend Maybe<U> Just(const U& u);
|
8384
8320
|
};
|
8385
8321
|
|
8386
|
-
|
8387
8322
|
template <class T>
|
8388
8323
|
inline Maybe<T> Nothing() {
|
8389
8324
|
return Maybe<T>();
|
8390
8325
|
}
|
8391
8326
|
|
8392
|
-
|
8393
8327
|
template <class T>
|
8394
8328
|
inline Maybe<T> Just(const T& t) {
|
8395
8329
|
return Maybe<T>(t);
|
8396
8330
|
}
|
8397
8331
|
|
8332
|
+
// A template specialization of Maybe<T> for the case of T = void.
|
8333
|
+
template <>
|
8334
|
+
class Maybe<void> {
|
8335
|
+
public:
|
8336
|
+
V8_INLINE bool IsNothing() const { return !is_valid_; }
|
8337
|
+
V8_INLINE bool IsJust() const { return is_valid_; }
|
8338
|
+
|
8339
|
+
V8_INLINE bool operator==(const Maybe& other) const {
|
8340
|
+
return IsJust() == other.IsJust();
|
8341
|
+
}
|
8342
|
+
|
8343
|
+
V8_INLINE bool operator!=(const Maybe& other) const {
|
8344
|
+
return !operator==(other);
|
8345
|
+
}
|
8346
|
+
|
8347
|
+
private:
|
8348
|
+
struct JustTag {};
|
8349
|
+
|
8350
|
+
Maybe() : is_valid_(false) {}
|
8351
|
+
explicit Maybe(JustTag) : is_valid_(true) {}
|
8352
|
+
|
8353
|
+
bool is_valid_;
|
8354
|
+
|
8355
|
+
template <class U>
|
8356
|
+
friend Maybe<U> Nothing();
|
8357
|
+
friend Maybe<void> JustVoid();
|
8358
|
+
};
|
8359
|
+
|
8360
|
+
inline Maybe<void> JustVoid() { return Maybe<void>(Maybe<void>::JustTag()); }
|
8398
8361
|
|
8399
8362
|
/**
|
8400
8363
|
* An external exception handler.
|
@@ -8406,14 +8369,7 @@ class V8_EXPORT TryCatch {
|
|
8406
8369
|
* all TryCatch blocks should be stack allocated because the memory
|
8407
8370
|
* location itself is compared against JavaScript try/catch blocks.
|
8408
8371
|
*/
|
8409
|
-
|
8410
|
-
|
8411
|
-
/**
|
8412
|
-
* Creates a new try/catch block and registers it with v8. Note that
|
8413
|
-
* all TryCatch blocks should be stack allocated because the memory
|
8414
|
-
* location itself is compared against JavaScript try/catch blocks.
|
8415
|
-
*/
|
8416
|
-
TryCatch(Isolate* isolate);
|
8372
|
+
explicit TryCatch(Isolate* isolate);
|
8417
8373
|
|
8418
8374
|
/**
|
8419
8375
|
* Unregisters and deletes this try/catch block.
|
@@ -8470,7 +8426,7 @@ class V8_EXPORT TryCatch {
|
|
8470
8426
|
* Returns the .stack property of the thrown object. If no .stack
|
8471
8427
|
* property is present an empty handle is returned.
|
8472
8428
|
*/
|
8473
|
-
|
8429
|
+
V8_DEPRECATED("Use maybe version.", Local<Value> StackTrace() const);
|
8474
8430
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace(
|
8475
8431
|
Local<Context> context) const;
|
8476
8432
|
|
@@ -8714,6 +8670,11 @@ class V8_EXPORT Context {
|
|
8714
8670
|
*/
|
8715
8671
|
enum EmbedderDataFields { kDebugIdIndex = 0 };
|
8716
8672
|
|
8673
|
+
/**
|
8674
|
+
* Return the number of fields allocated for embedder data.
|
8675
|
+
*/
|
8676
|
+
uint32_t GetNumberOfEmbedderDataFields();
|
8677
|
+
|
8717
8678
|
/**
|
8718
8679
|
* Gets the embedder data with the given index, which must have been set by a
|
8719
8680
|
* previous call to SetEmbedderData with the same index.
|
@@ -8779,9 +8740,12 @@ class V8_EXPORT Context {
|
|
8779
8740
|
void SetErrorMessageForCodeGenerationFromStrings(Local<String> message);
|
8780
8741
|
|
8781
8742
|
/**
|
8782
|
-
*
|
8743
|
+
* Return data that was previously attached to the context snapshot via
|
8744
|
+
* SnapshotCreator, and removes the reference to it.
|
8745
|
+
* Repeated call with the same index returns an empty MaybeLocal.
|
8783
8746
|
*/
|
8784
|
-
|
8747
|
+
template <class T>
|
8748
|
+
V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
|
8785
8749
|
|
8786
8750
|
/**
|
8787
8751
|
* Stack-allocated class which sets the execution context for all
|
@@ -8803,7 +8767,7 @@ class V8_EXPORT Context {
|
|
8803
8767
|
* stack.
|
8804
8768
|
* https://html.spec.whatwg.org/multipage/webappapis.html#backup-incumbent-settings-object-stack
|
8805
8769
|
*/
|
8806
|
-
class BackupIncumbentScope {
|
8770
|
+
class V8_EXPORT BackupIncumbentScope {
|
8807
8771
|
public:
|
8808
8772
|
/**
|
8809
8773
|
* |backup_incumbent_context| is pushed onto the backup incumbent settings
|
@@ -8825,6 +8789,7 @@ class V8_EXPORT Context {
|
|
8825
8789
|
friend class Object;
|
8826
8790
|
friend class Function;
|
8827
8791
|
|
8792
|
+
internal::Object** GetDataFromSnapshotOnce(size_t index);
|
8828
8793
|
Local<Value> SlowGetEmbedderData(int index);
|
8829
8794
|
void* SlowGetAlignedPointerFromEmbedderData(int index);
|
8830
8795
|
};
|
@@ -8965,6 +8930,7 @@ const int kApiInt64Size = sizeof(int64_t); // NOLINT
|
|
8965
8930
|
|
8966
8931
|
// Tag information for HeapObject.
|
8967
8932
|
const int kHeapObjectTag = 1;
|
8933
|
+
const int kWeakHeapObjectTag = 3;
|
8968
8934
|
const int kHeapObjectTagSize = 2;
|
8969
8935
|
const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
|
8970
8936
|
|
@@ -9047,8 +9013,7 @@ class Internals {
|
|
9047
9013
|
// These values match non-compiler-dependent values defined within
|
9048
9014
|
// the implementation of v8.
|
9049
9015
|
static const int kHeapObjectMapOffset = 0;
|
9050
|
-
static const int
|
9051
|
-
1 * kApiPointerSize + kApiIntSize;
|
9016
|
+
static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize;
|
9052
9017
|
static const int kStringResourceOffset = 3 * kApiPointerSize;
|
9053
9018
|
|
9054
9019
|
static const int kOddballKindOffset = 4 * kApiPointerSize + sizeof(double);
|
@@ -9090,8 +9055,9 @@ class Internals {
|
|
9090
9055
|
static const int kFirstNonstringType = 0x80;
|
9091
9056
|
static const int kOddballType = 0x83;
|
9092
9057
|
static const int kForeignType = 0x87;
|
9093
|
-
static const int
|
9094
|
-
static const int
|
9058
|
+
static const int kJSSpecialApiObjectType = 0x410;
|
9059
|
+
static const int kJSApiObjectType = 0x420;
|
9060
|
+
static const int kJSObjectType = 0x421;
|
9095
9061
|
|
9096
9062
|
static const int kUndefinedOddballKind = 5;
|
9097
9063
|
static const int kNullOddballKind = 3;
|
@@ -9125,9 +9091,7 @@ class Internals {
|
|
9125
9091
|
V8_INLINE static int GetInstanceType(const internal::Object* obj) {
|
9126
9092
|
typedef internal::Object O;
|
9127
9093
|
O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
|
9128
|
-
|
9129
|
-
// the LS 8 bits of one 16-bit word, regardless of endianess.
|
9130
|
-
return ReadField<uint16_t>(map, kMapInstanceTypeAndBitFieldOffset) & 0xff;
|
9094
|
+
return ReadField<uint16_t>(map, kMapInstanceTypeOffset);
|
9131
9095
|
}
|
9132
9096
|
|
9133
9097
|
V8_INLINE static int GetOddballKind(const internal::Object* obj) {
|
@@ -9205,6 +9169,29 @@ class Internals {
|
|
9205
9169
|
}
|
9206
9170
|
};
|
9207
9171
|
|
9172
|
+
// Only perform cast check for types derived from v8::Data since
|
9173
|
+
// other types do not implement the Cast method.
|
9174
|
+
template <bool PerformCheck>
|
9175
|
+
struct CastCheck {
|
9176
|
+
template <class T>
|
9177
|
+
static void Perform(T* data);
|
9178
|
+
};
|
9179
|
+
|
9180
|
+
template <>
|
9181
|
+
template <class T>
|
9182
|
+
void CastCheck<true>::Perform(T* data) {
|
9183
|
+
T::Cast(data);
|
9184
|
+
}
|
9185
|
+
|
9186
|
+
template <>
|
9187
|
+
template <class T>
|
9188
|
+
void CastCheck<false>::Perform(T* data) {}
|
9189
|
+
|
9190
|
+
template <class T>
|
9191
|
+
V8_INLINE void PerformCastCheck(T* data) {
|
9192
|
+
CastCheck<std::is_base_of<Data, T>::value>::Perform(data);
|
9193
|
+
}
|
9194
|
+
|
9208
9195
|
} // namespace internal
|
9209
9196
|
|
9210
9197
|
|
@@ -9284,7 +9271,6 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) {
|
|
9284
9271
|
M::Copy(that, this);
|
9285
9272
|
}
|
9286
9273
|
|
9287
|
-
|
9288
9274
|
template <class T>
|
9289
9275
|
bool PersistentBase<T>::IsIndependent() const {
|
9290
9276
|
typedef internal::Internals I;
|
@@ -9293,7 +9279,6 @@ bool PersistentBase<T>::IsIndependent() const {
|
|
9293
9279
|
I::kNodeIsIndependentShift);
|
9294
9280
|
}
|
9295
9281
|
|
9296
|
-
|
9297
9282
|
template <class T>
|
9298
9283
|
bool PersistentBase<T>::IsNearDeath() const {
|
9299
9284
|
typedef internal::Internals I;
|
@@ -9365,6 +9350,12 @@ P* PersistentBase<T>::ClearWeak() {
|
|
9365
9350
|
V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)));
|
9366
9351
|
}
|
9367
9352
|
|
9353
|
+
template <class T>
|
9354
|
+
void PersistentBase<T>::AnnotateStrongRetainer(const char* label) {
|
9355
|
+
V8::AnnotateStrongRetainer(reinterpret_cast<internal::Object**>(this->val_),
|
9356
|
+
label);
|
9357
|
+
}
|
9358
|
+
|
9368
9359
|
template <class T>
|
9369
9360
|
void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const {
|
9370
9361
|
if (IsEmpty()) return;
|
@@ -9377,8 +9368,7 @@ template <class T>
|
|
9377
9368
|
void PersistentBase<T>::MarkIndependent() {
|
9378
9369
|
typedef internal::Internals I;
|
9379
9370
|
if (this->IsEmpty()) return;
|
9380
|
-
I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
|
9381
|
-
true,
|
9371
|
+
I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), true,
|
9382
9372
|
I::kNodeIsIndependentShift);
|
9383
9373
|
}
|
9384
9374
|
|
@@ -9550,13 +9540,6 @@ Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
|
|
9550
9540
|
}
|
9551
9541
|
|
9552
9542
|
|
9553
|
-
template<typename T>
|
9554
|
-
Local<Function> FunctionCallbackInfo<T>::Callee() const {
|
9555
|
-
return Local<Function>(reinterpret_cast<Function*>(
|
9556
|
-
&implicit_args_[kCalleeIndex]));
|
9557
|
-
}
|
9558
|
-
|
9559
|
-
|
9560
9543
|
template<typename T>
|
9561
9544
|
Local<Object> FunctionCallbackInfo<T>::This() const {
|
9562
9545
|
return Local<Object>(reinterpret_cast<Object*>(values_ + 1));
|
@@ -9686,6 +9669,33 @@ void Template::Set(Isolate* isolate, const char* name, Local<Data> value) {
|
|
9686
9669
|
value);
|
9687
9670
|
}
|
9688
9671
|
|
9672
|
+
FunctionTemplate* FunctionTemplate::Cast(Data* data) {
|
9673
|
+
#ifdef V8_ENABLE_CHECKS
|
9674
|
+
CheckCast(data);
|
9675
|
+
#endif
|
9676
|
+
return reinterpret_cast<FunctionTemplate*>(data);
|
9677
|
+
}
|
9678
|
+
|
9679
|
+
ObjectTemplate* ObjectTemplate::Cast(Data* data) {
|
9680
|
+
#ifdef V8_ENABLE_CHECKS
|
9681
|
+
CheckCast(data);
|
9682
|
+
#endif
|
9683
|
+
return reinterpret_cast<ObjectTemplate*>(data);
|
9684
|
+
}
|
9685
|
+
|
9686
|
+
Signature* Signature::Cast(Data* data) {
|
9687
|
+
#ifdef V8_ENABLE_CHECKS
|
9688
|
+
CheckCast(data);
|
9689
|
+
#endif
|
9690
|
+
return reinterpret_cast<Signature*>(data);
|
9691
|
+
}
|
9692
|
+
|
9693
|
+
AccessorSignature* AccessorSignature::Cast(Data* data) {
|
9694
|
+
#ifdef V8_ENABLE_CHECKS
|
9695
|
+
CheckCast(data);
|
9696
|
+
#endif
|
9697
|
+
return reinterpret_cast<AccessorSignature*>(data);
|
9698
|
+
}
|
9689
9699
|
|
9690
9700
|
Local<Value> Object::GetInternalField(int index) {
|
9691
9701
|
#ifndef V8_ENABLE_CHECKS
|
@@ -9697,7 +9707,8 @@ Local<Value> Object::GetInternalField(int index) {
|
|
9697
9707
|
// know where to find the internal fields and can return the value directly.
|
9698
9708
|
auto instance_type = I::GetInstanceType(obj);
|
9699
9709
|
if (instance_type == I::kJSObjectType ||
|
9700
|
-
instance_type == I::kJSApiObjectType
|
9710
|
+
instance_type == I::kJSApiObjectType ||
|
9711
|
+
instance_type == I::kJSSpecialApiObjectType) {
|
9701
9712
|
int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
|
9702
9713
|
O* value = I::ReadField<O*>(obj, offset);
|
9703
9714
|
O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value);
|
@@ -9717,7 +9728,8 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
|
|
9717
9728
|
// know where to find the internal fields and can return the value directly.
|
9718
9729
|
auto instance_type = I::GetInstanceType(obj);
|
9719
9730
|
if (V8_LIKELY(instance_type == I::kJSObjectType ||
|
9720
|
-
instance_type == I::kJSApiObjectType
|
9731
|
+
instance_type == I::kJSApiObjectType ||
|
9732
|
+
instance_type == I::kJSSpecialApiObjectType)) {
|
9721
9733
|
int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
|
9722
9734
|
return I::ReadField<void*>(obj, offset);
|
9723
9735
|
}
|
@@ -9861,24 +9873,12 @@ Local<Boolean> Value::ToBoolean() const {
|
|
9861
9873
|
}
|
9862
9874
|
|
9863
9875
|
|
9864
|
-
Local<Number> Value::ToNumber() const {
|
9865
|
-
return ToNumber(Isolate::GetCurrent()->GetCurrentContext())
|
9866
|
-
.FromMaybe(Local<Number>());
|
9867
|
-
}
|
9868
|
-
|
9869
|
-
|
9870
9876
|
Local<String> Value::ToString() const {
|
9871
9877
|
return ToString(Isolate::GetCurrent()->GetCurrentContext())
|
9872
9878
|
.FromMaybe(Local<String>());
|
9873
9879
|
}
|
9874
9880
|
|
9875
9881
|
|
9876
|
-
Local<String> Value::ToDetailString() const {
|
9877
|
-
return ToDetailString(Isolate::GetCurrent()->GetCurrentContext())
|
9878
|
-
.FromMaybe(Local<String>());
|
9879
|
-
}
|
9880
|
-
|
9881
|
-
|
9882
9882
|
Local<Object> Value::ToObject() const {
|
9883
9883
|
return ToObject(Isolate::GetCurrent()->GetCurrentContext())
|
9884
9884
|
.FromMaybe(Local<Object>());
|
@@ -9891,18 +9891,6 @@ Local<Integer> Value::ToInteger() const {
|
|
9891
9891
|
}
|
9892
9892
|
|
9893
9893
|
|
9894
|
-
Local<Uint32> Value::ToUint32() const {
|
9895
|
-
return ToUint32(Isolate::GetCurrent()->GetCurrentContext())
|
9896
|
-
.FromMaybe(Local<Uint32>());
|
9897
|
-
}
|
9898
|
-
|
9899
|
-
|
9900
|
-
Local<Int32> Value::ToInt32() const {
|
9901
|
-
return ToInt32(Isolate::GetCurrent()->GetCurrentContext())
|
9902
|
-
.FromMaybe(Local<Int32>());
|
9903
|
-
}
|
9904
|
-
|
9905
|
-
|
9906
9894
|
Boolean* Boolean::Cast(v8::Value* value) {
|
9907
9895
|
#ifdef V8_ENABLE_CHECKS
|
9908
9896
|
CheckCast(value);
|
@@ -9927,6 +9915,14 @@ Symbol* Symbol::Cast(v8::Value* value) {
|
|
9927
9915
|
}
|
9928
9916
|
|
9929
9917
|
|
9918
|
+
Private* Private::Cast(Data* data) {
|
9919
|
+
#ifdef V8_ENABLE_CHECKS
|
9920
|
+
CheckCast(data);
|
9921
|
+
#endif
|
9922
|
+
return reinterpret_cast<Private*>(data);
|
9923
|
+
}
|
9924
|
+
|
9925
|
+
|
9930
9926
|
Number* Number::Cast(v8::Value* value) {
|
9931
9927
|
#ifdef V8_ENABLE_CHECKS
|
9932
9928
|
CheckCast(value);
|
@@ -9958,6 +9954,12 @@ Uint32* Uint32::Cast(v8::Value* value) {
|
|
9958
9954
|
return static_cast<Uint32*>(value);
|
9959
9955
|
}
|
9960
9956
|
|
9957
|
+
BigInt* BigInt::Cast(v8::Value* value) {
|
9958
|
+
#ifdef V8_ENABLE_CHECKS
|
9959
|
+
CheckCast(value);
|
9960
|
+
#endif
|
9961
|
+
return static_cast<BigInt*>(value);
|
9962
|
+
}
|
9961
9963
|
|
9962
9964
|
Date* Date::Cast(v8::Value* value) {
|
9963
9965
|
#ifdef V8_ENABLE_CHECKS
|
@@ -9990,6 +9992,12 @@ NumberObject* NumberObject::Cast(v8::Value* value) {
|
|
9990
9992
|
return static_cast<NumberObject*>(value);
|
9991
9993
|
}
|
9992
9994
|
|
9995
|
+
BigIntObject* BigIntObject::Cast(v8::Value* value) {
|
9996
|
+
#ifdef V8_ENABLE_CHECKS
|
9997
|
+
CheckCast(value);
|
9998
|
+
#endif
|
9999
|
+
return static_cast<BigIntObject*>(value);
|
10000
|
+
}
|
9993
10001
|
|
9994
10002
|
BooleanObject* BooleanObject::Cast(v8::Value* value) {
|
9995
10003
|
#ifdef V8_ENABLE_CHECKS
|
@@ -10156,6 +10164,19 @@ Float64Array* Float64Array::Cast(v8::Value* value) {
|
|
10156
10164
|
return static_cast<Float64Array*>(value);
|
10157
10165
|
}
|
10158
10166
|
|
10167
|
+
BigInt64Array* BigInt64Array::Cast(v8::Value* value) {
|
10168
|
+
#ifdef V8_ENABLE_CHECKS
|
10169
|
+
CheckCast(value);
|
10170
|
+
#endif
|
10171
|
+
return static_cast<BigInt64Array*>(value);
|
10172
|
+
}
|
10173
|
+
|
10174
|
+
BigUint64Array* BigUint64Array::Cast(v8::Value* value) {
|
10175
|
+
#ifdef V8_ENABLE_CHECKS
|
10176
|
+
CheckCast(value);
|
10177
|
+
#endif
|
10178
|
+
return static_cast<BigUint64Array*>(value);
|
10179
|
+
}
|
10159
10180
|
|
10160
10181
|
Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) {
|
10161
10182
|
#ifdef V8_ENABLE_CHECKS
|
@@ -10286,6 +10307,12 @@ uint32_t Isolate::GetNumberOfDataSlots() {
|
|
10286
10307
|
return I::kNumIsolateDataSlots;
|
10287
10308
|
}
|
10288
10309
|
|
10310
|
+
template <class T>
|
10311
|
+
MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) {
|
10312
|
+
T* data = reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
|
10313
|
+
if (data) internal::PerformCastCheck(data);
|
10314
|
+
return Local<T>(data);
|
10315
|
+
}
|
10289
10316
|
|
10290
10317
|
int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
|
10291
10318
|
int64_t change_in_bytes) {
|
@@ -10345,81 +10372,25 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
|
|
10345
10372
|
#endif
|
10346
10373
|
}
|
10347
10374
|
|
10348
|
-
|
10349
|
-
|
10350
|
-
|
10351
|
-
|
10352
|
-
|
10353
|
-
|
10354
|
-
bool V8::AddMessageListener(MessageCallback that, Local<Value> data) {
|
10355
|
-
Isolate* isolate = Isolate::GetCurrent();
|
10356
|
-
return isolate->AddMessageListener(that, data);
|
10357
|
-
}
|
10358
|
-
|
10359
|
-
|
10360
|
-
void V8::RemoveMessageListeners(MessageCallback that) {
|
10361
|
-
Isolate* isolate = Isolate::GetCurrent();
|
10362
|
-
isolate->RemoveMessageListeners(that);
|
10363
|
-
}
|
10364
|
-
|
10365
|
-
|
10366
|
-
void V8::SetFailedAccessCheckCallbackFunction(
|
10367
|
-
FailedAccessCheckCallback callback) {
|
10368
|
-
Isolate* isolate = Isolate::GetCurrent();
|
10369
|
-
isolate->SetFailedAccessCheckCallbackFunction(callback);
|
10370
|
-
}
|
10371
|
-
|
10372
|
-
|
10373
|
-
void V8::SetCaptureStackTraceForUncaughtExceptions(
|
10374
|
-
bool capture, int frame_limit, StackTrace::StackTraceOptions options) {
|
10375
|
-
Isolate* isolate = Isolate::GetCurrent();
|
10376
|
-
isolate->SetCaptureStackTraceForUncaughtExceptions(capture, frame_limit,
|
10377
|
-
options);
|
10378
|
-
}
|
10379
|
-
|
10380
|
-
|
10381
|
-
void V8::SetFatalErrorHandler(FatalErrorCallback callback) {
|
10382
|
-
Isolate* isolate = Isolate::GetCurrent();
|
10383
|
-
isolate->SetFatalErrorHandler(callback);
|
10384
|
-
}
|
10385
|
-
|
10386
|
-
void V8::TerminateExecution(Isolate* isolate) { isolate->TerminateExecution(); }
|
10387
|
-
|
10388
|
-
|
10389
|
-
bool V8::IsExecutionTerminating(Isolate* isolate) {
|
10390
|
-
if (isolate == NULL) {
|
10391
|
-
isolate = Isolate::GetCurrent();
|
10392
|
-
}
|
10393
|
-
return isolate->IsExecutionTerminating();
|
10394
|
-
}
|
10395
|
-
|
10396
|
-
|
10397
|
-
void V8::CancelTerminateExecution(Isolate* isolate) {
|
10398
|
-
isolate->CancelTerminateExecution();
|
10399
|
-
}
|
10400
|
-
|
10401
|
-
|
10402
|
-
void V8::VisitExternalResources(ExternalResourceVisitor* visitor) {
|
10403
|
-
Isolate* isolate = Isolate::GetCurrent();
|
10404
|
-
isolate->VisitExternalResources(visitor);
|
10405
|
-
}
|
10406
|
-
|
10407
|
-
|
10408
|
-
void V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) {
|
10409
|
-
Isolate* isolate = Isolate::GetCurrent();
|
10410
|
-
isolate->VisitHandlesWithClassIds(visitor);
|
10375
|
+
template <class T>
|
10376
|
+
MaybeLocal<T> Context::GetDataFromSnapshotOnce(size_t index) {
|
10377
|
+
T* data = reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
|
10378
|
+
if (data) internal::PerformCastCheck(data);
|
10379
|
+
return Local<T>(data);
|
10411
10380
|
}
|
10412
10381
|
|
10413
|
-
|
10414
|
-
|
10415
|
-
|
10416
|
-
|
10382
|
+
template <class T>
|
10383
|
+
size_t SnapshotCreator::AddData(Local<Context> context, Local<T> object) {
|
10384
|
+
T* object_ptr = *object;
|
10385
|
+
internal::Object** p = reinterpret_cast<internal::Object**>(object_ptr);
|
10386
|
+
return AddData(context, *p);
|
10417
10387
|
}
|
10418
10388
|
|
10419
|
-
|
10420
|
-
|
10421
|
-
|
10422
|
-
|
10389
|
+
template <class T>
|
10390
|
+
size_t SnapshotCreator::AddData(Local<T> object) {
|
10391
|
+
T* object_ptr = *object;
|
10392
|
+
internal::Object** p = reinterpret_cast<internal::Object**>(object_ptr);
|
10393
|
+
return AddData(*p);
|
10423
10394
|
}
|
10424
10395
|
|
10425
10396
|
/**
|