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

Side by Side Diff: test/cctest/compiler/test-run-wasm-machops.cc

Issue 2732273003: Disentangle assembler from isolate. (Closed)
Patch Set: Address feedback. 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
« no previous file with comments | « src/x87/macro-assembler-x87.cc ('k') | test/cctest/test-run-wasm-relocation-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. Use of this 1 // Copyright 2016 the V8 project authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 #include <functional> 6 #include <functional>
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 10 matching lines...) Expand all
21 static void UpdateMemoryReferences(Handle<Code> code, Address old_base, 21 static void UpdateMemoryReferences(Handle<Code> code, Address old_base,
22 Address new_base, uint32_t old_size, 22 Address new_base, uint32_t old_size,
23 uint32_t new_size) { 23 uint32_t new_size) {
24 Isolate* isolate = CcTest::i_isolate(); 24 Isolate* isolate = CcTest::i_isolate();
25 bool modified = false; 25 bool modified = false;
26 int mode_mask = RelocInfo::ModeMask(RelocInfo::WASM_MEMORY_REFERENCE) | 26 int mode_mask = RelocInfo::ModeMask(RelocInfo::WASM_MEMORY_REFERENCE) |
27 RelocInfo::ModeMask(RelocInfo::WASM_MEMORY_SIZE_REFERENCE); 27 RelocInfo::ModeMask(RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
28 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 28 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
29 RelocInfo::Mode mode = it.rinfo()->rmode(); 29 RelocInfo::Mode mode = it.rinfo()->rmode();
30 if (RelocInfo::IsWasmMemoryReference(mode)) { 30 if (RelocInfo::IsWasmMemoryReference(mode)) {
31 it.rinfo()->update_wasm_memory_reference(old_base, new_base); 31 it.rinfo()->update_wasm_memory_reference(isolate, old_base, new_base);
32 } else { 32 } else {
33 DCHECK(RelocInfo::IsWasmMemorySizeReference(mode)); 33 DCHECK(RelocInfo::IsWasmMemorySizeReference(mode));
34 it.rinfo()->update_wasm_memory_size(old_size, new_size); 34 it.rinfo()->update_wasm_memory_size(isolate, old_size, new_size);
35 } 35 }
36 modified = true; 36 modified = true;
37 } 37 }
38 if (modified) { 38 if (modified) {
39 Assembler::FlushICache(isolate, code->instruction_start(), 39 Assembler::FlushICache(isolate, code->instruction_start(),
40 code->instruction_size()); 40 code->instruction_size());
41 } 41 }
42 } 42 }
43 43
44 static void UpdateFunctionTableSizeReferences(Handle<Code> code, 44 static void UpdateFunctionTableSizeReferences(Handle<Code> code,
45 uint32_t old_size, 45 uint32_t old_size,
46 uint32_t new_size) { 46 uint32_t new_size) {
47 Isolate* isolate = CcTest::i_isolate(); 47 Isolate* isolate = CcTest::i_isolate();
48 bool modified = false; 48 bool modified = false;
49 int mode_mask = 49 int mode_mask =
50 RelocInfo::ModeMask(RelocInfo::WASM_FUNCTION_TABLE_SIZE_REFERENCE); 50 RelocInfo::ModeMask(RelocInfo::WASM_FUNCTION_TABLE_SIZE_REFERENCE);
51 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 51 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
52 RelocInfo::Mode mode = it.rinfo()->rmode(); 52 RelocInfo::Mode mode = it.rinfo()->rmode();
53 if (RelocInfo::IsWasmFunctionTableSizeReference(mode)) { 53 if (RelocInfo::IsWasmFunctionTableSizeReference(mode)) {
54 it.rinfo()->update_wasm_function_table_size_reference(old_size, new_size); 54 it.rinfo()->update_wasm_function_table_size_reference(isolate, old_size,
55 new_size);
55 modified = true; 56 modified = true;
56 } 57 }
57 } 58 }
58 if (modified) { 59 if (modified) {
59 Assembler::FlushICache(isolate, code->instruction_start(), 60 Assembler::FlushICache(isolate, code->instruction_start(),
60 code->instruction_size()); 61 code->instruction_size());
61 } 62 }
62 } 63 }
63 64
64 template <typename CType> 65 template <typename CType>
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 m.Return(m.Int32Constant(0xdeadbeef)); 205 m.Return(m.Int32Constant(0xdeadbeef));
205 // Check that index is out of bounds with current size 206 // Check that index is out of bounds with current size
206 CHECK_EQ(0xdeadbeef, m.Call()); 207 CHECK_EQ(0xdeadbeef, m.Call());
207 m.GenerateCode(); 208 m.GenerateCode();
208 209
209 Handle<Code> code = m.GetCode(); 210 Handle<Code> code = m.GetCode();
210 UpdateFunctionTableSizeReferences(code, 0x200, 0x400); 211 UpdateFunctionTableSizeReferences(code, 0x200, 0x400);
211 // Check that after limit is increased, index is within bounds. 212 // Check that after limit is increased, index is within bounds.
212 CHECK_EQ(0xaced, m.Call()); 213 CHECK_EQ(0xaced, m.Call());
213 } 214 }
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.cc ('k') | test/cctest/test-run-wasm-relocation-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698