OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef WASM_RUN_UTILS_H | 5 #ifndef WASM_RUN_UTILS_H |
6 #define WASM_RUN_UTILS_H | 6 #define WASM_RUN_UTILS_H |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 CHECK_LT(global_offset, kMaxGlobalsSize); | 254 CHECK_LT(global_offset, kMaxGlobalsSize); |
255 return &module->globals.back(); | 255 return &module->globals.back(); |
256 } | 256 } |
257 }; | 257 }; |
258 | 258 |
259 inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, | 259 inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, |
260 FunctionSig* sig, | 260 FunctionSig* sig, |
261 SourcePositionTable* source_position_table, | 261 SourcePositionTable* source_position_table, |
262 const byte* start, const byte* end) { | 262 const byte* start, const byte* end) { |
263 compiler::WasmGraphBuilder builder(zone, jsgraph, sig, source_position_table); | 263 compiler::WasmGraphBuilder builder(zone, jsgraph, sig, source_position_table); |
264 TreeResult result = | 264 DecodeResult result = |
265 BuildTFGraph(zone->allocator(), &builder, module, sig, start, end); | 265 BuildTFGraph(zone->allocator(), &builder, module, sig, start, end); |
266 if (result.failed()) { | 266 if (result.failed()) { |
267 ptrdiff_t pc = result.error_pc - result.start; | 267 ptrdiff_t pc = result.error_pc - result.start; |
268 ptrdiff_t pt = result.error_pt - result.start; | 268 ptrdiff_t pt = result.error_pt - result.start; |
269 std::ostringstream str; | 269 std::ostringstream str; |
270 str << "Verification failed: " << result.error_code << " pc = +" << pc; | 270 str << "Verification failed: " << result.error_code << " pc = +" << pc; |
271 if (result.error_pt) str << ", pt = +" << pt; | 271 if (result.error_pt) str << ", pt = +" << pt; |
272 str << ", msg = " << result.error_msg.get(); | 272 str << ", msg = " << result.error_msg.get(); |
273 FATAL(str.str().c_str()); | 273 FATAL(str.str().c_str()); |
274 } | 274 } |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 // interpreter. | 755 // interpreter. |
756 #define WASM_EXEC_TEST(name) \ | 756 #define WASM_EXEC_TEST(name) \ |
757 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 757 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
758 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 758 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
759 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 759 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
760 void RunWasm_##name(WasmExecutionMode execution_mode) | 760 void RunWasm_##name(WasmExecutionMode execution_mode) |
761 | 761 |
762 } // namespace | 762 } // namespace |
763 | 763 |
764 #endif | 764 #endif |
OLD | NEW |