| OLD | NEW |
| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(kAstI32, 0); | 159 uint32_t global1 = builder->AddGlobal(kAstI32, 0); |
| 160 uint32_t global2 = builder->AddGlobal(kAstI32, 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_GET_GLOBAL(global1), WASM_GET_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_SET_GLOBAL(global1, WASM_I32V_1(56)), |
| 172 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), | 172 WASM_SET_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 } |
| OLD | NEW |