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

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

Issue 2386183004: [wasm] Call a runtime function for a MemorySize instruction. (Closed)
Patch Set: Adjust to the refactoring of GrowMemory. 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..01fba594047a6bcfe21c99dfecf1993bb01e9e87 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> old_buffer;
gdeepti 2016/10/05 06:52:39 s/old_buffer/buffer as this is still the buffer as
+ if (!maybe_mem_buffer.ToHandle(&old_buffer)) {
+ return 0;
+ } else {
+ return old_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