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 #include "src/wasm/wasm-interpreter.h" | 5 #include "src/wasm/wasm-interpreter.h" |
6 | 6 |
7 #include "src/utils.h" | 7 #include "src/utils.h" |
8 #include "src/wasm/ast-decoder.h" | 8 #include "src/wasm/ast-decoder.h" |
9 #include "src/wasm/decoder.h" | 9 #include "src/wasm/decoder.h" |
10 #include "src/wasm/wasm-external-refs.h" | 10 #include "src/wasm/wasm-external-refs.h" |
11 #include "src/wasm/wasm-module.h" | 11 #include "src/wasm/wasm-module.h" |
12 | 12 |
13 #include "src/base/accounting-allocator.h" | 13 #include "src/zone/accounting-allocator.h" |
14 #include "src/zone-containers.h" | 14 #include "src/zone/zone-containers.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 namespace wasm { | 18 namespace wasm { |
19 | 19 |
20 #if DEBUG | 20 #if DEBUG |
21 #define TRACE(...) \ | 21 #define TRACE(...) \ |
22 do { \ | 22 do { \ |
23 if (FLAG_trace_wasm_interpreter) PrintF(__VA_ARGS__); \ | 23 if (FLAG_trace_wasm_interpreter) PrintF(__VA_ARGS__); \ |
24 } while (false) | 24 } while (false) |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 // TODO(titzer): CFI doesn't like threads in the ZoneVector. | 1739 // TODO(titzer): CFI doesn't like threads in the ZoneVector. |
1740 for (auto t : threads_) delete t; | 1740 for (auto t : threads_) delete t; |
1741 threads_.resize(0); | 1741 threads_.resize(0); |
1742 } | 1742 } |
1743 }; | 1743 }; |
1744 | 1744 |
1745 //============================================================================ | 1745 //============================================================================ |
1746 // Implementation of the public interface of the interpreter. | 1746 // Implementation of the public interface of the interpreter. |
1747 //============================================================================ | 1747 //============================================================================ |
1748 WasmInterpreter::WasmInterpreter(WasmModuleInstance* instance, | 1748 WasmInterpreter::WasmInterpreter(WasmModuleInstance* instance, |
1749 base::AccountingAllocator* allocator) | 1749 AccountingAllocator* allocator) |
1750 : zone_(allocator), | 1750 : zone_(allocator), |
1751 internals_(new (&zone_) WasmInterpreterInternals(&zone_, instance)) {} | 1751 internals_(new (&zone_) WasmInterpreterInternals(&zone_, instance)) {} |
1752 | 1752 |
1753 WasmInterpreter::~WasmInterpreter() { internals_->Delete(); } | 1753 WasmInterpreter::~WasmInterpreter() { internals_->Delete(); } |
1754 | 1754 |
1755 void WasmInterpreter::Run() { internals_->threads_[0]->Run(); } | 1755 void WasmInterpreter::Run() { internals_->threads_[0]->Run(); } |
1756 | 1756 |
1757 void WasmInterpreter::Pause() { internals_->threads_[0]->Pause(); } | 1757 void WasmInterpreter::Pause() { internals_->threads_[0]->Pause(); } |
1758 | 1758 |
1759 bool WasmInterpreter::SetBreakpoint(const WasmFunction* function, pc_t pc, | 1759 bool WasmInterpreter::SetBreakpoint(const WasmFunction* function, pc_t pc, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 | 1850 |
1851 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( | 1851 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( |
1852 Zone* zone, const byte* start, const byte* end) { | 1852 Zone* zone, const byte* start, const byte* end) { |
1853 ControlTransfers targets(zone, 0, start, end); | 1853 ControlTransfers targets(zone, 0, start, end); |
1854 return targets.map_; | 1854 return targets.map_; |
1855 } | 1855 } |
1856 | 1856 |
1857 } // namespace wasm | 1857 } // namespace wasm |
1858 } // namespace internal | 1858 } // namespace internal |
1859 } // namespace v8 | 1859 } // namespace v8 |
OLD | NEW |