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

Unified Diff: test/cctest/test-run-wasm-relocation-arm64.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/test-run-wasm-relocation-arm.cc ('k') | test/cctest/test-run-wasm-relocation-ia32.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-arm64.cc
diff --git a/test/cctest/test-run-wasm-relocation-arm64.cc b/test/cctest/test-run-wasm-relocation-arm64.cc
index 48f9e85ba1769db731524897c16347c4f99be140..81530046274c6f954072db8f69277cc9b9ec853c 100644
--- a/test/cctest/test-run-wasm-relocation-arm64.cc
+++ b/test/cctest/test-run-wasm-relocation-arm64.cc
@@ -24,8 +24,7 @@ using namespace v8::internal::compiler;
static int64_t DummyStaticFunction(Object* result) { return 1; }
-TEST(WasmRelocationArm64) {
- CcTest::InitializeVM();
+TEST(WasmRelocationArm64MemoryReference) {
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
v8::internal::byte buffer[4096];
@@ -79,4 +78,61 @@ TEST(WasmRelocationArm64) {
#endif
}
+TEST(WasmRelocationArm64MemorySizeReference) {
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+ v8::internal::byte buffer[4096];
+ DummyStaticFunction(NULL);
+ Immediate size = Immediate(512, RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
+ Label fail;
+
+ MacroAssembler masm(isolate, buffer, sizeof buffer,
+ v8::internal::CodeObjectRequired::kYes);
+
+ __ Mov(x0, size);
+ __ Cmp(x0, size);
+ __ B(ne, &fail);
+ __ Ret();
+ __ Bind(&fail);
+ __ Mov(x0, Immediate(0xdeadbeef));
+ __ Ret();
+
+ CodeDesc desc;
+ masm.GetCode(&desc);
+ Handle<Code> code = isolate->factory()->NewCode(
+ desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
+
+ CSignature0<int64_t> csig;
+ CodeRunner<int64_t> runnable(isolate, code, &csig);
+ int64_t ret_value = runnable.Call();
+ CHECK_NE(ret_value, 0xdeadbeef);
+
+#ifdef DEBUG
+ OFStream os(stdout);
+ code->Print(os);
+ ::printf("f() = %ld\n\n", ret_value);
+#endif
+ int32_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>(0x1234), reinterpret_cast<Address>(0x1234),
+ 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() = %ld\n\n", ret_value);
+#endif
+}
+
#undef __
« no previous file with comments | « test/cctest/test-run-wasm-relocation-arm.cc ('k') | test/cctest/test-run-wasm-relocation-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698