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

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

Issue 1921203002: Add new relocation type WASM_MEMORY_SIZE_REFERENCE, use relocatable pointers to update wasm memory … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add compiler test Created 4 years, 8 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
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index 60fbfbb62c01159818fe57bb31d99e926922abfc..7945457da6bec1c25a7853cf080dec9b4e8e394b 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2515,10 +2515,13 @@ Node* WasmGraphBuilder::MemSize(uint32_t offset) {
DCHECK(module_ && module_->instance);
uint32_t size = static_cast<uint32_t>(module_->instance->mem_size);
if (offset == 0) {
- if (!mem_size_) mem_size_ = jsgraph()->Int32Constant(size);
+ if (!mem_size_)
+ mem_size_ = jsgraph()->RelocatableInt32Constant(
+ size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
return mem_size_;
} else {
- return jsgraph()->Int32Constant(size + offset);
+ return jsgraph()->RelocatableInt32Constant(
+ size + offset, RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
}
}
@@ -2576,9 +2579,10 @@ void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index,
// Check against the limit.
size_t limit = size - offset - memsize;
CHECK(limit <= kMaxUInt32);
- cond = graph()->NewNode(
- jsgraph()->machine()->Uint32LessThanOrEqual(), index,
- jsgraph()->Int32Constant(static_cast<uint32_t>(limit)));
+ cond = graph()->NewNode(jsgraph()->machine()->Uint32LessThanOrEqual(),
+ index, jsgraph()->RelocatableInt32Constant(
+ static_cast<uint32_t>(limit),
+ RelocInfo::WASM_MEMORY_SIZE_REFERENCE));
}
trap_->AddTrapIfFalse(wasm::kTrapMemOutOfBounds, cond);

Powered by Google App Engine
This is Rietveld 408576698