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

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: 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
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 f->EmitCode(code, sizeof(code)); 150 f->EmitCode(code, sizeof(code));
151 TestModule(&zone, builder, 55); 151 TestModule(&zone, builder, 55);
152 } 152 }
153 153
154 TEST(Run_WasmModule_Global) { 154 TEST(Run_WasmModule_Global) {
155 v8::base::AccountingAllocator allocator; 155 v8::base::AccountingAllocator allocator;
156 Zone zone(&allocator); 156 Zone zone(&allocator);
157 TestSignatures sigs; 157 TestSignatures sigs;
158 158
159 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); 159 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
160 uint32_t global1 = builder->AddGlobal(MachineType::Int32(), 0); 160 uint32_t global1 = builder->AddGlobal(kAstI32, 0);
161 uint32_t global2 = builder->AddGlobal(MachineType::Int32(), 0); 161 uint32_t global2 = builder->AddGlobal(kAstI32, 0);
162 uint16_t f1_index = builder->AddFunction(); 162 uint16_t f1_index = builder->AddFunction();
163 WasmFunctionBuilder* f = builder->FunctionAt(f1_index); 163 WasmFunctionBuilder* f = builder->FunctionAt(f1_index);
164 f->SetSignature(sigs.i_v()); 164 f->SetSignature(sigs.i_v());
165 byte code1[] = { 165 byte code1[] = {
166 WASM_I32_ADD(WASM_LOAD_GLOBAL(global1), WASM_LOAD_GLOBAL(global2))}; 166 WASM_I32_ADD(WASM_LOAD_GLOBAL(global1), WASM_LOAD_GLOBAL(global2))};
167 f->EmitCode(code1, sizeof(code1)); 167 f->EmitCode(code1, sizeof(code1));
168 uint16_t f2_index = builder->AddFunction(); 168 uint16_t f2_index = builder->AddFunction();
169 f = builder->FunctionAt(f2_index); 169 f = builder->FunctionAt(f2_index);
170 f->SetSignature(sigs.i_v()); 170 f->SetSignature(sigs.i_v());
171 ExportAsMain(f); 171 ExportAsMain(f);
172 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), 172 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)),
173 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), 173 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)),
174 WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))}; 174 WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))};
175 f->EmitCode(code2, sizeof(code2)); 175 f->EmitCode(code2, sizeof(code2));
176 TestModule(&zone, builder, 97); 176 TestModule(&zone, builder, 97);
177 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698