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

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 2077623002: [wasm] memory size is an uint32_t, not a size_t. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixes 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compiler/wasm-compiler.h" 5 #include "src/compiler/wasm-compiler.h"
6 6
7 #include "src/isolate-inl.h" 7 #include "src/isolate-inl.h"
8 8
9 #include "src/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), val, 2571 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), val,
2572 *effect_, *control_); 2572 *effect_, *control_);
2573 *effect_ = node; 2573 *effect_ = node;
2574 return node; 2574 return node;
2575 } 2575 }
2576 2576
2577 void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index, 2577 void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index,
2578 uint32_t offset, 2578 uint32_t offset,
2579 wasm::WasmCodePosition position) { 2579 wasm::WasmCodePosition position) {
2580 DCHECK(module_ && module_->instance); 2580 DCHECK(module_ && module_->instance);
2581 size_t size = module_->instance->mem_size; 2581 uint32_t size = module_->instance->mem_size;
2582 byte memsize = wasm::WasmOpcodes::MemSize(memtype); 2582 byte memsize = wasm::WasmOpcodes::MemSize(memtype);
2583 2583
2584 // Check against the effective size. 2584 // Check against the effective size.
2585 size_t effective_size; 2585 size_t effective_size;
2586 if (offset >= size || (static_cast<uint64_t>(offset) + memsize) > size) { 2586 if (offset >= size || (static_cast<uint64_t>(offset) + memsize) > size) {
2587 effective_size = 0; 2587 effective_size = 0;
2588 } else { 2588 } else {
2589 effective_size = size - offset - memsize + 1; 2589 effective_size = size - offset - memsize + 1;
2590 } 2590 }
2591 CHECK(effective_size <= kMaxUInt32); 2591 CHECK(effective_size <= kMaxUInt32);
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
3287 function_->code_start_offset), 3287 function_->code_start_offset),
3288 compile_ms); 3288 compile_ms);
3289 } 3289 }
3290 3290
3291 return code; 3291 return code;
3292 } 3292 }
3293 3293
3294 } // namespace compiler 3294 } // namespace compiler
3295 } // namespace internal 3295 } // namespace internal
3296 } // namespace v8 3296 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698