summaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/wasm-memory.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/wasm/wasm-memory.h')
-rw-r--r--deps/v8/src/wasm/wasm-memory.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/deps/v8/src/wasm/wasm-memory.h b/deps/v8/src/wasm/wasm-memory.h
index 2676f3ade7..c5d6ef5154 100644
--- a/deps/v8/src/wasm/wasm-memory.h
+++ b/deps/v8/src/wasm/wasm-memory.h
@@ -13,8 +13,28 @@ namespace v8 {
namespace internal {
namespace wasm {
+class WasmAllocationTracker {
+ public:
+ WasmAllocationTracker() {}
+ ~WasmAllocationTracker();
+
+ // ReserveAddressSpace attempts to increase the reserved address space counter
+ // to determine whether there is enough headroom to allocate another guarded
+ // Wasm memory. Returns true if successful (meaning it is okay to go ahead and
+ // allocate the buffer), false otherwise.
+ bool ReserveAddressSpace(size_t num_bytes);
+
+ // Reduces the address space counter so that the space can be reused.
+ void ReleaseAddressSpace(size_t num_bytes);
+
+ private:
+ std::atomic_size_t allocated_address_space_{0};
+
+ DISALLOW_COPY_AND_ASSIGN(WasmAllocationTracker);
+};
+
Handle<JSArrayBuffer> NewArrayBuffer(
- Isolate*, size_t size, bool enable_guard_regions,
+ Isolate*, size_t size, bool require_guard_regions,
SharedFlag shared = SharedFlag::kNotShared);
Handle<JSArrayBuffer> SetupArrayBuffer(