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

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

Issue 2062003002: [wasm] Relocatable Globals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: {float|double}_t -> {float|double} Created 4 years, 6 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/cctest.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include <stdlib.h>
6
7 #include "src/v8.h"
8
9 #include "test/cctest/cctest.h"
10 #include "test/cctest/compiler/c-signature.h"
11 #include "test/cctest/wasm/wasm-run-utils.h"
12
13 using namespace v8::internal;
14 using namespace v8::internal::compiler;
15
16 #define FOREACH_TYPE(TEST_BODY) \
17 TEST_BODY(int8_t, Int8, WASM_I32_ADD) \
18 TEST_BODY(uint8_t, Uint8, WASM_I32_ADD) \
19 TEST_BODY(int16_t, Int16, WASM_I32_ADD) \
20 TEST_BODY(uint16_t, Uint16, WASM_I32_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
26 #define LOAD_STORE_GLOBAL_TEST_BODY(C_TYPE, MACHINE_TYPE, ADD) \
27 TEST(WasmRelocateGlobal##MACHINE_TYPE) { \
28 TestingModule module(kExecuteCompiled); \
29 module.AddGlobal<int32_t>(MachineType::MACHINE_TYPE()); \
30 module.AddGlobal<int32_t>(MachineType::MACHINE_TYPE()); \
31 \
32 WasmRunner<C_TYPE> r(&module, MachineType::MACHINE_TYPE()); \
33 \
34 /* global = global + p0 */ \
35 BUILD(r, \
36 WASM_STORE_GLOBAL(1, ADD(WASM_LOAD_GLOBAL(0), WASM_GET_LOCAL(0)))); \
37 CHECK_EQ(1, module.instance->function_code.size()); \
38 \
39 int filter = 1 << RelocInfo::WASM_GLOBAL_REFERENCE; \
40 \
41 Handle<Code> code = module.instance->function_code[0]; \
42 \
43 Address old_start = module.instance->globals_start; \
44 Address new_start = old_start + 1; \
45 \
46 Address old_addresses[2]; \
47 uint32_t address_index = 0U; \
48 for (RelocIterator it(*code, filter); !it.done(); it.next()) { \
49 old_addresses[address_index] = it.rinfo()->wasm_global_reference(); \
50 it.rinfo()->update_wasm_global_reference(old_start, new_start); \
51 ++address_index; \
52 } \
53 CHECK_EQ(2U, address_index); \
54 \
55 address_index = 0U; \
56 for (RelocIterator it(*code, filter); !it.done(); it.next()) { \
57 CHECK_EQ(old_addresses[address_index] + 1, \
58 it.rinfo()->wasm_global_reference()); \
59 ++address_index; \
60 } \
61 CHECK_EQ(2U, address_index); \
62 }
63
64 FOREACH_TYPE(LOAD_STORE_GLOBAL_TEST_BODY)
OLDNEW
« no previous file with comments | « test/cctest/cctest.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698