@@ -1275,8 +1275,9 @@ class V8_EXPORT SealHandleScope {
1275
1275
1276
1276
// --- Special objects ---
1277
1277
1278
+
1278
1279
/* *
1279
- * The superclass of objects that can reside on V8's heap .
1280
+ * The superclass of values and API object templates .
1280
1281
*/
1281
1282
class V8_EXPORT Data {
1282
1283
private:
@@ -1423,7 +1424,7 @@ class V8_EXPORT UnboundScript {
1423
1424
/* *
1424
1425
* A compiled JavaScript module, not yet tied to a Context.
1425
1426
*/
1426
- class V8_EXPORT UnboundModuleScript : public Data {
1427
+ class V8_EXPORT UnboundModuleScript {
1427
1428
// Only used as a container for code caching.
1428
1429
};
1429
1430
@@ -1446,7 +1447,7 @@ class V8_EXPORT Location {
1446
1447
/* *
1447
1448
* A compiled JavaScript module.
1448
1449
*/
1449
- class V8_EXPORT Module : public Data {
1450
+ class V8_EXPORT Module {
1450
1451
public:
1451
1452
/* *
1452
1453
* The different states a module can be in.
@@ -4644,37 +4645,47 @@ class V8_EXPORT CompiledWasmModule {
4644
4645
// An instance of WebAssembly.Module.
4645
4646
class V8_EXPORT WasmModuleObject : public Object {
4646
4647
public:
4647
- WasmModuleObject () = delete ;
4648
-
4649
4648
/* *
4650
4649
* An opaque, native heap object for transferring wasm modules. It
4651
4650
* supports move semantics, and does not support copy semantics.
4651
+ * TODO(wasm): Merge this with CompiledWasmModule once code sharing is always
4652
+ * enabled.
4652
4653
*/
4653
- using TransferrableModule = CompiledWasmModule;
4654
+ class TransferrableModule final {
4655
+ public:
4656
+ TransferrableModule (TransferrableModule&& src) = default ;
4657
+ TransferrableModule (const TransferrableModule& src) = delete ;
4658
+
4659
+ TransferrableModule& operator =(TransferrableModule&& src) = default ;
4660
+ TransferrableModule& operator =(const TransferrableModule& src) = delete ;
4661
+
4662
+ private:
4663
+ typedef std::shared_ptr<internal::wasm::NativeModule> SharedModule;
4664
+ friend class WasmModuleObject ;
4665
+ explicit TransferrableModule (SharedModule shared_module)
4666
+ : shared_module_(std::move(shared_module)) {}
4667
+ TransferrableModule (OwnedBuffer serialized, OwnedBuffer bytes)
4668
+ : serialized_(std::move(serialized)), wire_bytes_(std::move(bytes)) {}
4669
+
4670
+ SharedModule shared_module_;
4671
+ OwnedBuffer serialized_ = {nullptr , 0 };
4672
+ OwnedBuffer wire_bytes_ = {nullptr , 0 };
4673
+ };
4654
4674
4655
4675
/* *
4656
4676
* Get an in-memory, non-persistable, and context-independent (meaning,
4657
4677
* suitable for transfer to another Isolate and Context) representation
4658
4678
* of this wasm compiled module.
4659
4679
*/
4660
- V8_DEPRECATED (" Use GetCompiledModule" )
4661
4680
TransferrableModule GetTransferrableModule ();
4662
4681
4663
4682
/* *
4664
4683
* Efficiently re-create a WasmModuleObject, without recompiling, from
4665
4684
* a TransferrableModule.
4666
4685
*/
4667
- V8_DEPRECATED (" Use FromCompiledModule" )
4668
4686
static MaybeLocal<WasmModuleObject> FromTransferrableModule (
4669
4687
Isolate* isolate, const TransferrableModule&);
4670
4688
4671
- /* *
4672
- * Efficiently re-create a WasmModuleObject, without recompiling, from
4673
- * a CompiledWasmModule.
4674
- */
4675
- static MaybeLocal<WasmModuleObject> FromCompiledModule (
4676
- Isolate* isolate, const CompiledWasmModule&);
4677
-
4678
4689
/* *
4679
4690
* Get the compiled module for this module object. The compiled module can be
4680
4691
* shared by several module objects.
@@ -4697,7 +4708,11 @@ class V8_EXPORT WasmModuleObject : public Object {
4697
4708
static MaybeLocal<WasmModuleObject> Compile (Isolate* isolate,
4698
4709
const uint8_t * start,
4699
4710
size_t length);
4711
+ static MemorySpan<const uint8_t > AsReference (const OwnedBuffer& buff) {
4712
+ return {buff.buffer .get (), buff.size };
4713
+ }
4700
4714
4715
+ WasmModuleObject ();
4701
4716
static void CheckCast (Value* obj);
4702
4717
};
4703
4718
@@ -5053,6 +5068,12 @@ class V8_EXPORT ArrayBuffer : public Object {
5053
5068
*/
5054
5069
bool IsDetachable () const ;
5055
5070
5071
+ // TODO(913887): fix the use of 'neuter' in the API.
5072
+ V8_DEPRECATED (" Use IsDetachable() instead." )
5073
+ inline bool IsNeuterable() const {
5074
+ return IsDetachable ();
5075
+ }
5076
+
5056
5077
/* *
5057
5078
* Detaches this ArrayBuffer and all its views (typed arrays).
5058
5079
* Detaching sets the byte length of the buffer and all typed arrays to zero,
@@ -5061,6 +5082,10 @@ class V8_EXPORT ArrayBuffer : public Object {
5061
5082
*/
5062
5083
void Detach ();
5063
5084
5085
+ // TODO(913887): fix the use of 'neuter' in the API.
5086
+ V8_DEPRECATED (" Use Detach() instead." )
5087
+ inline void Neuter() { Detach (); }
5088
+
5064
5089
/* *
5065
5090
* Make this ArrayBuffer external. The pointer to underlying memory block
5066
5091
* and byte length are returned as |Contents| structure. After ArrayBuffer
@@ -7670,9 +7695,7 @@ class V8_EXPORT EmbedderHeapTracer {
7670
7695
virtual void RegisterV8References (
7671
7696
const std::vector<std::pair<void *, void *> >& embedder_fields) = 0;
7672
7697
7673
- V8_DEPRECATE_SOON (" Use version taking TracedReferenceBase<v8::Data> argument" )
7674
7698
void RegisterEmbedderReference (const TracedReferenceBase<v8::Value>& ref);
7675
- void RegisterEmbedderReference (const TracedReferenceBase<v8::Data>& ref);
7676
7699
7677
7700
/* *
7678
7701
* Called at the beginning of a GC cycle.
@@ -7849,7 +7872,6 @@ class V8_EXPORT Isolate {
7849
7872
create_histogram_callback(nullptr ),
7850
7873
add_histogram_sample_callback(nullptr ),
7851
7874
array_buffer_allocator(nullptr ),
7852
- array_buffer_allocator_shared(),
7853
7875
external_references(nullptr ),
7854
7876
allow_atomics_wait(true ),
7855
7877
only_terminate_in_safe_scope(false ) {}
@@ -7896,7 +7918,6 @@ class V8_EXPORT Isolate {
7896
7918
* management for the allocator instance.
7897
7919
*/
7898
7920
ArrayBuffer::Allocator* array_buffer_allocator;
7899
- std::shared_ptr<ArrayBuffer::Allocator> array_buffer_allocator_shared;
7900
7921
7901
7922
/* *
7902
7923
* Specifies an optional nullptr-terminated array of raw addresses in the
@@ -7918,6 +7939,9 @@ class V8_EXPORT Isolate {
7918
7939
bool only_terminate_in_safe_scope;
7919
7940
};
7920
7941
7942
+ void SetArrayBufferAllocatorShared (
7943
+ std::shared_ptr<ArrayBuffer::Allocator> allocator);
7944
+
7921
7945
7922
7946
/* *
7923
7947
* Stack-allocated class which sets the isolate for all operations
@@ -9192,6 +9216,8 @@ class V8_EXPORT V8 {
9192
9216
*/
9193
9217
static void SetFlagsFromString (const char * str);
9194
9218
static void SetFlagsFromString (const char * str, size_t length);
9219
+ V8_DEPRECATED (" use size_t version" )
9220
+ static void SetFlagsFromString (const char * str, int length);
9195
9221
9196
9222
/* *
9197
9223
* Sets V8 flags from the command line.
0 commit comments