Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1160)

Unified Diff: src/wasm/wasm-module.cc

Issue 2386183004: [wasm] Call a runtime function for a MemorySize instruction. (Closed)
Patch Set: Comments addressed Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index 884f651aeb271b240d510c1ca06a80825c668739..f4cf505f5a910761dda7ba846dcc2f4ee630be89 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1809,6 +1809,17 @@ void SetInstanceMemory(Handle<JSObject> instance, JSArrayBuffer* buffer) {
module->set_ptr_to_heap(buffer);
}
+int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance) {
+ MaybeHandle<JSArrayBuffer> maybe_mem_buffer =
+ GetInstanceMemory(isolate, instance);
+ Handle<JSArrayBuffer> buffer;
+ if (!maybe_mem_buffer.ToHandle(&buffer)) {
+ return 0;
+ } else {
+ return buffer->byte_length()->Number() / WasmModule::kPageSize;
+ }
+}
+
int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance,
uint32_t pages) {
Address old_mem_start = nullptr;
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698