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

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

Issue 2102193003: Revert "Revert "[wasm] Complete separation of compilation and instantiation"" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Some DCHECKs Created 4 years, 6 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/objects-inl.h ('k') | src/signature.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 6026032074c055963dfb15550487f7b4120bcc9a..75e2a76b8b2965527828af6fee0c07e4be38f1f8 100644
--- a/src/runtime/runtime-wasm.cc
+++ b/src/runtime/runtime-wasm.cc
@@ -39,13 +39,11 @@ RUNTIME_FUNCTION(Runtime_WasmGrowMemory) {
// Get mem buffer associated with module object
Object* obj = module_object->GetInternalField(kWasmMemArrayBuffer);
- Handle<JSArrayBuffer> old_buffer =
- Handle<JSArrayBuffer>(JSArrayBuffer::cast(obj));
- if (old_buffer->byte_length()->Number() == 0) {
+ 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 = static_cast<Address>(old_buffer->backing_store());
+ old_mem_start = nullptr;
old_size = 0;
// TODO(gdeepti): Fix bounds check to take into account size of memtype.
new_size = delta_pages * wasm::WasmModule::kPageSize;
@@ -67,8 +65,15 @@ RUNTIME_FUNCTION(Runtime_WasmGrowMemory) {
}
#endif
} else {
+ Handle<JSArrayBuffer> old_buffer =
+ Handle<JSArrayBuffer>(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
+ // "undefined" case above.
+ DCHECK_NOT_NULL(old_mem_start);
+ DCHECK_NE(0, old_size);
+
new_size = old_size + delta_pages * wasm::WasmModule::kPageSize;
if (new_size >
wasm::WasmModule::kMaxMemPages * wasm::WasmModule::kPageSize) {
« no previous file with comments | « src/objects-inl.h ('k') | src/signature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698