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

Unified Diff: test/cctest/test-run-wasm-relocation-arm.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: Ben's review Created 4 years, 7 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 | « test/cctest/compiler/test-run-wasm-machops.cc ('k') | test/cctest/test-run-wasm-relocation-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-run-wasm-relocation-arm.cc
diff --git a/test/cctest/test-run-wasm-relocation-arm.cc b/test/cctest/test-run-wasm-relocation-arm.cc
index adfeb28b2f0a1f3d542acfde17338d4bbd825995..b2e6ec3a3b2bc669c390c52c82e507a11e7e90fd 100644
--- a/test/cctest/test-run-wasm-relocation-arm.cc
+++ b/test/cctest/test-run-wasm-relocation-arm.cc
@@ -23,8 +23,7 @@ using namespace v8::internal::compiler;
static int32_t DummyStaticFunction(Object* result) { return 1; }
-TEST(WasmRelocationArm) {
- CcTest::InitializeVM();
+TEST(WasmRelocationArmMemoryReference) {
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
v8::internal::byte buffer[4096];
@@ -77,4 +76,59 @@ TEST(WasmRelocationArm) {
#endif
}
+TEST(WasmRelocationArmMemorySizeReference) {
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+ v8::internal::byte buffer[4096];
+ DummyStaticFunction(NULL);
+ int32_t size = 512;
+ Label fail;
+
+ Assembler assm(isolate, buffer, sizeof buffer);
+
+ __ mov(r0, Operand(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE));
+ __ cmp(r0, Operand(size, RelocInfo::WASM_MEMORY_SIZE_REFERENCE));
+ __ b(ne, &fail);
+ __ mov(pc, Operand(lr));
+ __ bind(&fail);
+ __ mov(r0, Operand(0xdeadbeef));
+ __ mov(pc, Operand(lr));
+
+ CodeDesc desc;
+ assm.GetCode(&desc);
+ Handle<Code> code = isolate->factory()->NewCode(
+ desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
+
+ CSignature0<int32_t> csig;
+ CodeRunner<int32_t> runnable(isolate, code, &csig);
+ int32_t ret_value = runnable.Call();
+ CHECK_NE(ret_value, 0xdeadbeef);
+
+#ifdef DEBUG
+ OFStream os(stdout);
+ code->Print(os);
+ ::printf("f() = %d\n\n", ret_value);
+#endif
+ size_t diff = 512;
+
+ int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
+ for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
+ RelocInfo::Mode mode = it.rinfo()->rmode();
+ if (RelocInfo::IsWasmMemorySizeReference(mode)) {
+ it.rinfo()->update_wasm_memory_reference(
+ reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234),
+ it.rinfo()->wasm_memory_size_reference(),
+ it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH);
+ }
+ }
+
+ ret_value = runnable.Call();
+ CHECK_NE(ret_value, 0xdeadbeef);
+
+#ifdef DEBUG
+ code->Print(os);
+ ::printf("f() = %d\n\n", ret_value);
+#endif
+}
#undef __
« no previous file with comments | « test/cctest/compiler/test-run-wasm-machops.cc ('k') | test/cctest/test-run-wasm-relocation-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698