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

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

Issue 2165633006: [wasm] Remove special memory type for (internal) globals and use local type instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] Remove special memory type for (internal) globals and use local type instead. Created 4 years, 5 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 | « test/cctest/wasm/test-run-wasm-module.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('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 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 "test/cctest/cctest.h" 9 #include "test/cctest/cctest.h"
10 #include "test/cctest/compiler/c-signature.h" 10 #include "test/cctest/compiler/c-signature.h"
11 #include "test/cctest/wasm/wasm-run-utils.h" 11 #include "test/cctest/wasm/wasm-run-utils.h"
12 12
13 using namespace v8::internal; 13 using namespace v8::internal;
14 using namespace v8::internal::compiler; 14 using namespace v8::internal::compiler;
15 15
16 #define FOREACH_TYPE(TEST_BODY) \ 16 #define FOREACH_TYPE(TEST_BODY) \
17 TEST_BODY(int8_t, Int8, WASM_I32_ADD) \ 17 TEST_BODY(int32_t, I32, WASM_I32_ADD) \
18 TEST_BODY(uint8_t, Uint8, WASM_I32_ADD) \ 18 TEST_BODY(int64_t, I64, WASM_I64_ADD) \
19 TEST_BODY(int16_t, Int16, WASM_I32_ADD) \ 19 TEST_BODY(float, F32, WASM_F32_ADD) \
20 TEST_BODY(uint16_t, Uint16, WASM_I32_ADD) \ 20 TEST_BODY(double, F64, WASM_F64_ADD)
21 TEST_BODY(int32_t, Int32, WASM_I32_ADD) \
22 TEST_BODY(uint32_t, Uint32, WASM_I32_ADD) \
23 TEST_BODY(float, Float32, WASM_F32_ADD) \
24 TEST_BODY(double, Float64, WASM_F64_ADD)
25 21
26 #define LOAD_STORE_GLOBAL_TEST_BODY(C_TYPE, MACHINE_TYPE, ADD) \ 22 #define LOAD_STORE_GLOBAL_TEST_BODY(C_TYPE, MACHINE_TYPE, ADD) \
27 TEST(WasmRelocateGlobal##MACHINE_TYPE) { \ 23 TEST(WasmRelocateGlobal##MACHINE_TYPE) { \
28 TestingModule module(kExecuteCompiled); \ 24 TestingModule module(kExecuteCompiled); \
29 module.AddGlobal<int32_t>(MachineType::MACHINE_TYPE()); \ 25 module.AddGlobal<C_TYPE>(kAst##MACHINE_TYPE); \
30 module.AddGlobal<int32_t>(MachineType::MACHINE_TYPE()); \ 26 module.AddGlobal<C_TYPE>(kAst##MACHINE_TYPE); \
31 \ 27 \
32 WasmRunner<C_TYPE> r(&module, MachineType::MACHINE_TYPE()); \ 28 WasmRunner<C_TYPE> r(&module, \
29 WasmOpcodes::MachineTypeFor(kAst##MACHINE_TYPE)); \
33 \ 30 \
34 /* global = global + p0 */ \ 31 /* global = global + p0 */ \
35 BUILD(r, \ 32 BUILD(r, \
36 WASM_STORE_GLOBAL(1, ADD(WASM_LOAD_GLOBAL(0), WASM_GET_LOCAL(0)))); \ 33 WASM_STORE_GLOBAL(1, ADD(WASM_LOAD_GLOBAL(0), WASM_GET_LOCAL(0)))); \
37 CHECK_EQ(1, module.instance->function_code.size()); \ 34 CHECK_EQ(1, module.instance->function_code.size()); \
38 \ 35 \
39 int filter = 1 << RelocInfo::WASM_GLOBAL_REFERENCE; \ 36 int filter = 1 << RelocInfo::WASM_GLOBAL_REFERENCE; \
40 \ 37 \
41 Handle<Code> code = module.instance->function_code[0]; \ 38 Handle<Code> code = module.instance->function_code[0]; \
42 \ 39 \
(...skipping 12 matching lines...) Expand all
55 address_index = 0U; \ 52 address_index = 0U; \
56 for (RelocIterator it(*code, filter); !it.done(); it.next()) { \ 53 for (RelocIterator it(*code, filter); !it.done(); it.next()) { \
57 CHECK_EQ(old_addresses[address_index] + 1, \ 54 CHECK_EQ(old_addresses[address_index] + 1, \
58 it.rinfo()->wasm_global_reference()); \ 55 it.rinfo()->wasm_global_reference()); \
59 ++address_index; \ 56 ++address_index; \
60 } \ 57 } \
61 CHECK_EQ(2U, address_index); \ 58 CHECK_EQ(2U, address_index); \
62 } 59 }
63 60
64 FOREACH_TYPE(LOAD_STORE_GLOBAL_TEST_BODY) 61 FOREACH_TYPE(LOAD_STORE_GLOBAL_TEST_BODY)
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm-module.cc ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698