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

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

Issue 2492793005: [wasm] Fix more -Wsign-compare warnings. (Closed)
Patch Set: Created 4 years, 1 month 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-interpreter.cc ('k') | test/cctest/test-run-wasm-relocation-arm64.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 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 <iostream> // NOLINT(readability/streams) 5 #include <iostream> // NOLINT(readability/streams)
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
9 9
10 #include "src/arm/assembler-arm-inl.h" 10 #include "src/arm/assembler-arm-inl.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 CSignature0<int32_t> csig; 43 CSignature0<int32_t> csig;
44 CodeRunner<int32_t> runnable(isolate, code, &csig); 44 CodeRunner<int32_t> runnable(isolate, code, &csig);
45 int32_t ret_value = runnable.Call(); 45 int32_t ret_value = runnable.Call();
46 CHECK_EQ(ret_value, imm); 46 CHECK_EQ(ret_value, imm);
47 47
48 #ifdef DEBUG 48 #ifdef DEBUG
49 OFStream os(stdout); 49 OFStream os(stdout);
50 code->Print(os); 50 code->Print(os);
51 ::printf("f() = %d\n\n", ret_value); 51 ::printf("f() = %d\n\n", ret_value);
52 #endif 52 #endif
53 size_t offset = 1234; 53 int offset = 1234;
54 54
55 // Relocating references by offset 55 // Relocating references by offset
56 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); 56 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE);
57 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 57 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
58 RelocInfo::Mode mode = it.rinfo()->rmode(); 58 RelocInfo::Mode mode = it.rinfo()->rmode();
59 if (RelocInfo::IsWasmMemoryReference(mode)) { 59 if (RelocInfo::IsWasmMemoryReference(mode)) {
60 // Dummy values of size used here as the objective of the test is to 60 // Dummy values of size used here as the objective of the test is to
61 // verify that the immediate is patched correctly 61 // verify that the immediate is patched correctly
62 it.rinfo()->update_wasm_memory_reference( 62 it.rinfo()->update_wasm_memory_reference(
63 it.rinfo()->wasm_memory_reference(), 63 it.rinfo()->wasm_memory_reference(),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 __ mov(pc, Operand(lr)); 96 __ mov(pc, Operand(lr));
97 97
98 CodeDesc desc; 98 CodeDesc desc;
99 assm.GetCode(&desc); 99 assm.GetCode(&desc);
100 Handle<Code> code = isolate->factory()->NewCode( 100 Handle<Code> code = isolate->factory()->NewCode(
101 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 101 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
102 102
103 CSignature0<int32_t> csig; 103 CSignature0<int32_t> csig;
104 CodeRunner<int32_t> runnable(isolate, code, &csig); 104 CodeRunner<int32_t> runnable(isolate, code, &csig);
105 int32_t ret_value = runnable.Call(); 105 int32_t ret_value = runnable.Call();
106 CHECK_NE(ret_value, 0xdeadbeef); 106 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef));
107 107
108 #ifdef DEBUG 108 #ifdef DEBUG
109 OFStream os(stdout); 109 OFStream os(stdout);
110 code->Print(os); 110 code->Print(os);
111 ::printf("f() = %d\n\n", ret_value); 111 ::printf("f() = %d\n\n", ret_value);
112 #endif 112 #endif
113 size_t diff = 512; 113 size_t diff = 512;
114 114
115 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); 115 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
116 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { 116 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
117 RelocInfo::Mode mode = it.rinfo()->rmode(); 117 RelocInfo::Mode mode = it.rinfo()->rmode();
118 if (RelocInfo::IsWasmMemorySizeReference(mode)) { 118 if (RelocInfo::IsWasmMemorySizeReference(mode)) {
119 it.rinfo()->update_wasm_memory_reference( 119 it.rinfo()->update_wasm_memory_reference(
120 reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234), 120 reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234),
121 it.rinfo()->wasm_memory_size_reference(), 121 it.rinfo()->wasm_memory_size_reference(),
122 it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); 122 it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH);
123 } 123 }
124 } 124 }
125 125
126 ret_value = runnable.Call(); 126 ret_value = runnable.Call();
127 CHECK_NE(ret_value, 0xdeadbeef); 127 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef));
128 128
129 #ifdef DEBUG 129 #ifdef DEBUG
130 code->Print(os); 130 code->Print(os);
131 ::printf("f() = %d\n\n", ret_value); 131 ::printf("f() = %d\n\n", ret_value);
132 #endif 132 #endif
133 } 133 }
134 #undef __ 134 #undef __
OLDNEW
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | test/cctest/test-run-wasm-relocation-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698