| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/wasm/wasm-interpreter.h" | 5 #include "src/wasm/wasm-interpreter.h" |
| 6 | 6 |
| 7 #include "src/utils.h" | 7 #include "src/utils.h" |
| 8 #include "src/wasm/ast-decoder.h" | 8 #include "src/wasm/ast-decoder.h" |
| 9 #include "src/wasm/decoder.h" | 9 #include "src/wasm/decoder.h" |
| 10 #include "src/wasm/wasm-external-refs.h" | 10 #include "src/wasm/wasm-external-refs.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 if (delta_pages > wasm::WasmModule::kMaxMemPages) { | 661 if (delta_pages > wasm::WasmModule::kMaxMemPages) { |
| 662 return -1; | 662 return -1; |
| 663 } | 663 } |
| 664 uint32_t old_size = instance->mem_size; | 664 uint32_t old_size = instance->mem_size; |
| 665 uint32_t new_size; | 665 uint32_t new_size; |
| 666 byte* new_mem_start; | 666 byte* new_mem_start; |
| 667 if (instance->mem_size == 0) { | 667 if (instance->mem_size == 0) { |
| 668 if (delta_pages > wasm::WasmModule::kMaxMemPages) { | 668 if (delta_pages > wasm::WasmModule::kMaxMemPages) { |
| 669 return -1; | 669 return -1; |
| 670 } | 670 } |
| 671 // TODO(gdeepti): Fix bounds check to take into account size of memtype. | |
| 672 new_size = delta_pages * wasm::WasmModule::kPageSize; | 671 new_size = delta_pages * wasm::WasmModule::kPageSize; |
| 673 new_mem_start = static_cast<byte*>(calloc(new_size, sizeof(byte))); | 672 new_mem_start = static_cast<byte*>(calloc(new_size, sizeof(byte))); |
| 674 if (!new_mem_start) { | 673 if (!new_mem_start) { |
| 675 return -1; | 674 return -1; |
| 676 } | 675 } |
| 677 } else { | 676 } else { |
| 678 DCHECK_NOT_NULL(instance->mem_start); | 677 DCHECK_NOT_NULL(instance->mem_start); |
| 679 new_size = old_size + delta_pages * wasm::WasmModule::kPageSize; | 678 new_size = old_size + delta_pages * wasm::WasmModule::kPageSize; |
| 680 if (new_size > | 679 if (new_size > |
| 681 wasm::WasmModule::kMaxMemPages * wasm::WasmModule::kPageSize) { | 680 wasm::WasmModule::kMaxMemPages * wasm::WasmModule::kPageSize) { |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 | 1843 |
| 1845 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( | 1844 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( |
| 1846 Zone* zone, const byte* start, const byte* end) { | 1845 Zone* zone, const byte* start, const byte* end) { |
| 1847 ControlTransfers targets(zone, nullptr, nullptr, start, end); | 1846 ControlTransfers targets(zone, nullptr, nullptr, start, end); |
| 1848 return targets.map_; | 1847 return targets.map_; |
| 1849 } | 1848 } |
| 1850 | 1849 |
| 1851 } // namespace wasm | 1850 } // namespace wasm |
| 1852 } // namespace internal | 1851 } // namespace internal |
| 1853 } // namespace v8 | 1852 } // namespace v8 |
| OLD | NEW |