| 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 int32_t result = runner.Call<void*, void*, void*, void*, void*>( | 699 int32_t result = runner.Call<void*, void*, void*, void*, void*>( |
| 700 &p0, &p1, &p2, &p3, &return_value); | 700 &p0, &p1, &p2, &p3, &return_value); |
| 701 CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result); | 701 CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result); |
| 702 return return_value; | 702 return return_value; |
| 703 } | 703 } |
| 704 } | 704 } |
| 705 | 705 |
| 706 ReturnType CallInterpreter(Vector<WasmVal> args) { | 706 ReturnType CallInterpreter(Vector<WasmVal> args) { |
| 707 CHECK_EQ(args.length(), | 707 CHECK_EQ(args.length(), |
| 708 static_cast<int>(compiler_.function_->sig->parameter_count())); | 708 static_cast<int>(compiler_.function_->sig->parameter_count())); |
| 709 WasmInterpreter::Thread& thread = interpreter()->GetThread(0); | 709 WasmInterpreter::Thread* thread = interpreter()->GetThread(0); |
| 710 thread.Reset(); | 710 thread->Reset(); |
| 711 thread.PushFrame(compiler_.function_, args.start()); | 711 thread->PushFrame(compiler_.function_, args.start()); |
| 712 if (thread.Run() == WasmInterpreter::FINISHED) { | 712 if (thread->Run() == WasmInterpreter::FINISHED) { |
| 713 WasmVal val = thread.GetReturnValue(); | 713 WasmVal val = thread->GetReturnValue(); |
| 714 return val.to<ReturnType>(); | 714 return val.to<ReturnType>(); |
| 715 } else if (thread.state() == WasmInterpreter::TRAPPED) { | 715 } else if (thread->state() == WasmInterpreter::TRAPPED) { |
| 716 // TODO(titzer): return the correct trap code | 716 // TODO(titzer): return the correct trap code |
| 717 int64_t result = 0xdeadbeefdeadbeef; | 717 int64_t result = 0xdeadbeefdeadbeef; |
| 718 return static_cast<ReturnType>(result); | 718 return static_cast<ReturnType>(result); |
| 719 } else { | 719 } else { |
| 720 // TODO(titzer): falling off end | 720 // TODO(titzer): falling off end |
| 721 ReturnType val = 0; | 721 ReturnType val = 0; |
| 722 return val; | 722 return val; |
| 723 } | 723 } |
| 724 } | 724 } |
| 725 | 725 |
| (...skipping 29 matching lines...) Expand all 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 |