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

Side by Side Diff: test/cctest/compiler/test-run-wasm-machops.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
« no previous file with comments | « src/wasm/wasm-module.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"
11 #include "src/codegen.h" 11 #include "src/codegen.h"
12 #include "src/objects-inl.h" 12 #include "src/objects-inl.h"
13 #include "test/cctest/cctest.h" 13 #include "test/cctest/cctest.h"
14 #include "test/cctest/compiler/codegen-tester.h" 14 #include "test/cctest/compiler/codegen-tester.h"
15 #include "test/cctest/compiler/graph-builder-tester.h" 15 #include "test/cctest/compiler/graph-builder-tester.h"
16 #include "test/cctest/compiler/value-helper.h" 16 #include "test/cctest/compiler/value-helper.h"
17 17
18 using namespace v8::internal; 18 using namespace v8::internal;
19 using namespace v8::internal::compiler; 19 using namespace v8::internal::compiler;
20 20
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 RelocInfo::IsWasmMemorySizeReference(mode)) { 31 it.rinfo()->update_wasm_memory_reference(old_base, new_base);
32 // Patch addresses with change in memory start address 32 } else {
33 it.rinfo()->update_wasm_memory_reference(old_base, new_base, old_size, 33 DCHECK(RelocInfo::IsWasmMemorySizeReference(mode));
34 new_size); 34 it.rinfo()->update_wasm_memory_size(old_size, new_size);
35 modified = true;
36 } 35 }
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) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 m.Return(m.Int32Constant(0xdeadbeef)); 204 m.Return(m.Int32Constant(0xdeadbeef));
205 // Check that index is out of bounds with current size 205 // Check that index is out of bounds with current size
206 CHECK_EQ(0xdeadbeef, m.Call()); 206 CHECK_EQ(0xdeadbeef, m.Call());
207 m.GenerateCode(); 207 m.GenerateCode();
208 208
209 Handle<Code> code = m.GetCode(); 209 Handle<Code> code = m.GetCode();
210 UpdateFunctionTableSizeReferences(code, 0x200, 0x400); 210 UpdateFunctionTableSizeReferences(code, 0x200, 0x400);
211 // Check that after limit is increased, index is within bounds. 211 // Check that after limit is increased, index is within bounds.
212 CHECK_EQ(0xaced, m.Call()); 212 CHECK_EQ(0xaced, m.Call());
213 } 213 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.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