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

Side by Side Diff: test/cctest/wasm/test-run-wasm-module.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-64.cc ('k') | test/cctest/wasm/test-run-wasm-relocation.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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include "src/wasm/encoder.h" 8 #include "src/wasm/encoder.h"
9 #include "src/wasm/wasm-js.h" 9 #include "src/wasm/wasm-js.h"
10 #include "src/wasm/wasm-macro-gen.h" 10 #include "src/wasm/wasm-macro-gen.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 f->EmitCode(code, sizeof(code)); 149 f->EmitCode(code, sizeof(code));
150 TestModule(&zone, builder, 55); 150 TestModule(&zone, builder, 55);
151 } 151 }
152 152
153 TEST(Run_WasmModule_Global) { 153 TEST(Run_WasmModule_Global) {
154 v8::base::AccountingAllocator allocator; 154 v8::base::AccountingAllocator allocator;
155 Zone zone(&allocator); 155 Zone zone(&allocator);
156 TestSignatures sigs; 156 TestSignatures sigs;
157 157
158 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); 158 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
159 uint32_t global1 = builder->AddGlobal(MachineType::Int32(), 0); 159 uint32_t global1 = builder->AddGlobal(kAstI32, 0);
160 uint32_t global2 = builder->AddGlobal(MachineType::Int32(), 0); 160 uint32_t global2 = builder->AddGlobal(kAstI32, 0);
161 uint16_t f1_index = builder->AddFunction(); 161 uint16_t f1_index = builder->AddFunction();
162 WasmFunctionBuilder* f = builder->FunctionAt(f1_index); 162 WasmFunctionBuilder* f = builder->FunctionAt(f1_index);
163 f->SetSignature(sigs.i_v()); 163 f->SetSignature(sigs.i_v());
164 byte code1[] = { 164 byte code1[] = {
165 WASM_I32_ADD(WASM_LOAD_GLOBAL(global1), WASM_LOAD_GLOBAL(global2))}; 165 WASM_I32_ADD(WASM_LOAD_GLOBAL(global1), WASM_LOAD_GLOBAL(global2))};
166 f->EmitCode(code1, sizeof(code1)); 166 f->EmitCode(code1, sizeof(code1));
167 uint16_t f2_index = builder->AddFunction(); 167 uint16_t f2_index = builder->AddFunction();
168 f = builder->FunctionAt(f2_index); 168 f = builder->FunctionAt(f2_index);
169 f->SetSignature(sigs.i_v()); 169 f->SetSignature(sigs.i_v());
170 ExportAsMain(f); 170 ExportAsMain(f);
171 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), 171 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)),
172 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), 172 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)),
173 WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))}; 173 WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))};
174 f->EmitCode(code2, sizeof(code2)); 174 f->EmitCode(code2, sizeof(code2));
175 TestModule(&zone, builder, 97); 175 TestModule(&zone, builder, 97);
176 } 176 }
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm-64.cc ('k') | test/cctest/wasm/test-run-wasm-relocation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698