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 <setjmp.h> | 8 #include <setjmp.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 compiled_module->set_max_mem_pages(Smi::kMaxValue); | 328 compiled_module->set_max_mem_pages(Smi::kMaxValue); |
329 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); | 329 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); |
330 return WasmInstanceObject::New(isolate_, compiled_module); | 330 return WasmInstanceObject::New(isolate_, compiled_module); |
331 } | 331 } |
332 }; | 332 }; |
333 | 333 |
334 inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, | 334 inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, |
335 FunctionSig* sig, | 335 FunctionSig* sig, |
336 SourcePositionTable* source_position_table, | 336 SourcePositionTable* source_position_table, |
337 const byte* start, const byte* end) { | 337 const byte* start, const byte* end) { |
338 compiler::WasmGraphBuilder builder(zone, jsgraph, sig, source_position_table); | 338 compiler::WasmGraphBuilder builder(module, zone, jsgraph, sig, |
| 339 source_position_table); |
339 DecodeResult result = | 340 DecodeResult result = |
340 BuildTFGraph(zone->allocator(), &builder, module, sig, start, end); | 341 BuildTFGraph(zone->allocator(), &builder, sig, start, end); |
341 if (result.failed()) { | 342 if (result.failed()) { |
342 if (!FLAG_trace_wasm_decoder) { | 343 if (!FLAG_trace_wasm_decoder) { |
343 // Retry the compilation with the tracing flag on, to help in debugging. | 344 // Retry the compilation with the tracing flag on, to help in debugging. |
344 FLAG_trace_wasm_decoder = true; | 345 FLAG_trace_wasm_decoder = true; |
345 result = | 346 result = BuildTFGraph(zone->allocator(), &builder, sig, start, end); |
346 BuildTFGraph(zone->allocator(), &builder, module, sig, start, end); | |
347 } | 347 } |
348 | 348 |
349 ptrdiff_t pc = result.error_pc - result.start; | 349 ptrdiff_t pc = result.error_pc - result.start; |
350 ptrdiff_t pt = result.error_pt - result.start; | 350 ptrdiff_t pt = result.error_pt - result.start; |
351 std::ostringstream str; | 351 std::ostringstream str; |
352 str << "Verification failed: " << result.error_code << " pc = +" << pc; | 352 str << "Verification failed: " << result.error_code << " pc = +" << pc; |
353 if (result.error_pt) str << ", pt = +" << pt; | 353 if (result.error_pt) str << ", pt = +" << pt; |
354 str << ", msg = " << result.error_msg.get(); | 354 str << ", msg = " << result.error_msg.get(); |
355 FATAL(str.str().c_str()); | 355 FATAL(str.str().c_str()); |
356 } | 356 } |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 void RunWasm_##name(WasmExecutionMode execution_mode) | 796 void RunWasm_##name(WasmExecutionMode execution_mode) |
797 | 797 |
798 #define WASM_EXEC_COMPILED_TEST(name) \ | 798 #define WASM_EXEC_COMPILED_TEST(name) \ |
799 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 799 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
800 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 800 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
801 void RunWasm_##name(WasmExecutionMode execution_mode) | 801 void RunWasm_##name(WasmExecutionMode execution_mode) |
802 | 802 |
803 } // namespace | 803 } // namespace |
804 | 804 |
805 #endif | 805 #endif |
OLD | NEW |