Index: src/runtime/runtime-wasm.cc |
diff --git a/src/runtime/runtime-wasm.cc b/src/runtime/runtime-wasm.cc |
index c6f214c89888926a011d91f5498d38ee17e73c63..6fc72767ea57bba5cbb4fe9c9be65433ebb4bca0 100644 |
--- a/src/runtime/runtime-wasm.cc |
+++ b/src/runtime/runtime-wasm.cc |
@@ -58,9 +58,8 @@ RUNTIME_FUNCTION(Runtime_WasmGrowMemory) { |
old_size = 0; |
// TODO(gdeepti): Fix bounds check to take into account size of memtype. |
new_size = delta_pages * wasm::WasmModule::kPageSize; |
- if (delta_pages > wasm::WasmModule::kMaxMemPages) { |
- return *isolate->factory()->NewNumberFromInt(-1); |
- } |
+ // The code generated in the wasm compiler guarantees this precondition. |
+ DCHECK(delta_pages <= wasm::WasmModule::kMaxMemPages); |
new_mem_start = |
static_cast<Address>(isolate->array_buffer_allocator()->Allocate( |
static_cast<uint32_t>(new_size))); |