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

Side by Side Diff: test/cctest/test-run-wasm-relocation-arm64.cc

Issue 2735103003: Merged: [wasm] Fix code specialization for empty memory buffer (Closed)
Patch Set: Created 3 years, 9 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
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 <iostream> // NOLINT(readability/streams) 5 #include <iostream> // NOLINT(readability/streams)
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
9 9
10 #include "src/arm64/simulator-arm64.h" 10 #include "src/arm64/simulator-arm64.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #ifdef DEBUG 50 #ifdef DEBUG
51 OFStream os(stdout); 51 OFStream os(stdout);
52 code->Print(os); 52 code->Print(os);
53 ::printf("f() = %" PRIx64 "\n\n", ret_value); 53 ::printf("f() = %" PRIx64 "\n\n", ret_value);
54 #endif 54 #endif
55 int offset = 1234; 55 int offset = 1234;
56 56
57 // Relocating reference by offset 57 // Relocating reference by offset
58 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); 58 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE);
59 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 59 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
60 RelocInfo::Mode mode = it.rinfo()->rmode(); 60 DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode()));
61 if (RelocInfo::IsWasmMemoryReference(mode)) { 61 it.rinfo()->update_wasm_memory_reference(
62 // Dummy values of size used here as the objective of the test is to 62 it.rinfo()->wasm_memory_reference(),
63 // verify that the immediate is patched correctly 63 it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH);
64 it.rinfo()->update_wasm_memory_reference(
65 it.rinfo()->wasm_memory_reference(),
66 it.rinfo()->wasm_memory_reference() + offset, 1, 2,
67 SKIP_ICACHE_FLUSH);
68 }
69 } 64 }
70 65
71 // Call into relocated code object 66 // Call into relocated code object
72 ret_value = runnable.Call(); 67 ret_value = runnable.Call();
73 CHECK_EQ((imm + offset), ret_value); 68 CHECK_EQ((imm + offset), ret_value);
74 69
75 #ifdef DEBUG 70 #ifdef DEBUG
76 code->Print(os); 71 code->Print(os);
77 ::printf("f() = %" PRIx64 "\n\n", ret_value); 72 ::printf("f() = %" PRIx64 "\n\n", ret_value);
78 #endif 73 #endif
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 105
111 #ifdef DEBUG 106 #ifdef DEBUG
112 OFStream os(stdout); 107 OFStream os(stdout);
113 code->Print(os); 108 code->Print(os);
114 ::printf("f() = %" PRIx64 "\n\n", ret_value); 109 ::printf("f() = %" PRIx64 "\n\n", ret_value);
115 #endif 110 #endif
116 int32_t diff = 512; 111 int32_t diff = 512;
117 112
118 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); 113 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
119 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 114 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
120 RelocInfo::Mode mode = it.rinfo()->rmode(); 115 DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode()));
121 if (RelocInfo::IsWasmMemorySizeReference(mode)) { 116 it.rinfo()->update_wasm_memory_size(
122 it.rinfo()->update_wasm_memory_reference( 117 it.rinfo()->wasm_memory_size_reference(),
123 reinterpret_cast<Address>(0x1234), reinterpret_cast<Address>(0x1234), 118 it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH);
124 it.rinfo()->wasm_memory_size_reference(),
125 it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH);
126 }
127 } 119 }
128 120
129 ret_value = runnable.Call(); 121 ret_value = runnable.Call();
130 CHECK_NE(ret_value, 0xdeadbeef); 122 CHECK_NE(ret_value, 0xdeadbeef);
131 123
132 #ifdef DEBUG 124 #ifdef DEBUG
133 code->Print(os); 125 code->Print(os);
134 ::printf("f() = %" PRIx64 "\n\n", ret_value); 126 ::printf("f() = %" PRIx64 "\n\n", ret_value);
135 #endif 127 #endif
136 } 128 }
137 129
138 #undef __ 130 #undef __
OLDNEW
« 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