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

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

Issue 2306403002: Revert of [wasm] reuse the first compiled module (Closed)
Patch Set: Created 4 years, 3 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/runtime/runtime-test.cc ('k') | src/snapshot/code-serializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-wasm.cc
diff --git a/src/runtime/runtime-wasm.cc b/src/runtime/runtime-wasm.cc
index 80468306ca846c84a11130bf7fcffd6833a72ee3..6fc72767ea57bba5cbb4fe9c9be65433ebb4bca0 100644
--- a/src/runtime/runtime-wasm.cc
+++ b/src/runtime/runtime-wasm.cc
@@ -18,12 +18,16 @@
namespace v8 {
namespace internal {
+namespace {
+const int kWasmMemArrayBuffer = 2;
+}
+
RUNTIME_FUNCTION(Runtime_WasmGrowMemory) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
uint32_t delta_pages = 0;
CHECK(args[0]->ToUint32(&delta_pages));
- Handle<JSObject> module_instance;
+ Handle<JSObject> module_object;
{
// Get the module JSObject
@@ -37,17 +41,17 @@
Object* owning_instance = wasm::GetOwningWasmInstance(undefined, code);
CHECK_NOT_NULL(owning_instance);
CHECK_NE(owning_instance, undefined);
- module_instance = handle(JSObject::cast(owning_instance), isolate);
+ module_object = handle(JSObject::cast(owning_instance), isolate);
}
Address old_mem_start, new_mem_start;
uint32_t old_size, new_size;
// Get mem buffer associated with module object
- MaybeHandle<JSArrayBuffer> maybe_mem_buffer =
- wasm::GetInstanceMemory(isolate, module_instance);
- Handle<JSArrayBuffer> old_buffer;
- if (!maybe_mem_buffer.ToHandle(&old_buffer)) {
+ Handle<Object> obj(module_object->GetInternalField(kWasmMemArrayBuffer),
+ isolate);
+
+ if (obj->IsUndefined(isolate)) {
// If module object does not have linear memory associated with it,
// Allocate new array buffer of given size.
old_mem_start = nullptr;
@@ -69,6 +73,7 @@
}
#endif
} else {
+ Handle<JSArrayBuffer> old_buffer = Handle<JSArrayBuffer>::cast(obj);
old_mem_start = static_cast<Address>(old_buffer->backing_store());
old_size = old_buffer->byte_length()->Number();
// If the old memory was zero-sized, we should have been in the
@@ -96,10 +101,9 @@
buffer->set_is_neuterable(false);
// Set new buffer to be wasm memory
+ module_object->SetInternalField(kWasmMemArrayBuffer, *buffer);
- wasm::SetInstanceMemory(module_instance, *buffer);
-
- CHECK(wasm::UpdateWasmModuleMemory(module_instance, old_mem_start,
+ CHECK(wasm::UpdateWasmModuleMemory(module_object, old_mem_start,
new_mem_start, old_size, new_size));
return *isolate->factory()->NewNumberFromInt(old_size /
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | src/snapshot/code-serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698