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

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

Issue 2416543002: [wasm] Fix bounds check for zero initial memory. (Closed)
Patch Set: Add aTODO Created 4 years, 2 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/compiler/s390/code-generator-s390.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index c52b45269229296c1b93a7fbb31e3f945aa64c13..89d4e1da0717a95f8b635d401253641f7da0e066 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2855,6 +2855,14 @@ void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index,
// Check against the effective size.
size_t effective_size;
if (size == 0) {
+ // TODO(gdeepti): Remove filler check used here to stash the size of
+ // memtype for when code is relocated.
bradn 2016/10/13 22:43:41 Maybe a single reloc type will work after all? If
gdeepti 2016/10/14 01:28:44 Done.
+ Node* cond = graph()->NewNode(jsgraph()->machine()->Uint32LessThan(),
+ jsgraph()->Int32Constant(0),
+ jsgraph()->RelocatableInt32Constant(
+ static_cast<uint32_t>(memsize),
+ RelocInfo::WASM_MEMTYPE_SIZE_REFERENCE));
+ trap_->AddTrapIfFalse(wasm::kTrapMemOutOfBounds, cond, position);
effective_size = 0;
} else if (offset >= size ||
(static_cast<uint64_t>(offset) + memsize) > size) {
« no previous file with comments | « src/compiler/s390/code-generator-s390.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698