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

Side by Side Diff: test/cctest/test-run-wasm-relocation-ia32.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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/disasm.h" 10 #include "src/disasm.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 byte* begin = code->instruction_start(); 54 byte* begin = code->instruction_start();
55 byte* end = begin + code->instruction_size(); 55 byte* end = begin + code->instruction_size();
56 disasm::Disassembler::Disassemble(stdout, begin, end); 56 disasm::Disassembler::Disassemble(stdout, begin, end);
57 #endif 57 #endif
58 58
59 int offset = 1234; 59 int offset = 1234;
60 60
61 // Relocating references by offset 61 // Relocating references by offset
62 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); 62 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE);
63 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 63 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
64 RelocInfo::Mode mode = it.rinfo()->rmode(); 64 DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode()));
65 if (RelocInfo::IsWasmMemoryReference(mode)) { 65 it.rinfo()->update_wasm_memory_reference(
66 // Dummy values of size used here as the objective of the test is to 66 it.rinfo()->wasm_memory_reference(),
67 // verify that the immediate is patched correctly 67 it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH);
68 it.rinfo()->update_wasm_memory_reference(
69 it.rinfo()->wasm_memory_reference(),
70 it.rinfo()->wasm_memory_reference() + offset, 1, 2,
71 SKIP_ICACHE_FLUSH);
72 }
73 } 68 }
74 69
75 // Check if immediate is updated correctly 70 // Check if immediate is updated correctly
76 ret_value = runnable.Call(); 71 ret_value = runnable.Call();
77 CHECK_EQ(ret_value, imm + offset); 72 CHECK_EQ(ret_value, imm + offset);
78 73
79 #ifdef OBJECT_PRINT 74 #ifdef OBJECT_PRINT
80 code->Print(os); 75 code->Print(os);
81 begin = code->instruction_start(); 76 begin = code->instruction_start();
82 end = begin + code->instruction_size(); 77 end = begin + code->instruction_size();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 code->Print(os); 116 code->Print(os);
122 byte* begin = code->instruction_start(); 117 byte* begin = code->instruction_start();
123 byte* end = begin + code->instruction_size(); 118 byte* end = begin + code->instruction_size();
124 disasm::Disassembler::Disassemble(stdout, begin, end); 119 disasm::Disassembler::Disassemble(stdout, begin, end);
125 #endif 120 #endif
126 121
127 size_t offset = 10; 122 size_t offset = 10;
128 123
129 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); 124 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
130 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 125 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
131 RelocInfo::Mode mode = it.rinfo()->rmode(); 126 DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode()));
132 if (RelocInfo::IsWasmMemorySizeReference(mode)) { 127 it.rinfo()->update_wasm_memory_size(
133 it.rinfo()->update_wasm_memory_reference( 128 it.rinfo()->wasm_memory_size_reference(),
134 reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234), 129 it.rinfo()->wasm_memory_size_reference() + offset, SKIP_ICACHE_FLUSH);
135 it.rinfo()->wasm_memory_size_reference(),
136 it.rinfo()->wasm_memory_size_reference() + offset, SKIP_ICACHE_FLUSH);
137 }
138 } 130 }
139 131
140 ret_value = runnable.Call(); 132 ret_value = runnable.Call();
141 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); 133 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef));
142 134
143 #ifdef OBJECT_PRINT 135 #ifdef OBJECT_PRINT
144 code->Print(os); 136 code->Print(os);
145 begin = code->instruction_start(); 137 begin = code->instruction_start();
146 end = begin + code->instruction_size(); 138 end = begin + code->instruction_size();
147 disasm::Disassembler::Disassemble(stdout, begin, end); 139 disasm::Disassembler::Disassemble(stdout, begin, end);
148 #endif 140 #endif
149 } 141 }
150 #undef __ 142 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-run-wasm-relocation-arm64.cc ('k') | test/cctest/test-run-wasm-relocation-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698