OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 V8_WASM_MODULE_COMPILER_H_ | 5 #ifndef V8_WASM_MODULE_COMPILER_H_ |
6 #define V8_WASM_MODULE_COMPILER_H_ | 6 #define V8_WASM_MODULE_COMPILER_H_ |
7 | 7 |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "src/base/atomic-utils.h" | 10 #include "src/base/atomic-utils.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 }; | 257 }; |
258 | 258 |
259 // Encapsulates all the state and steps of an asynchronous compilation. | 259 // Encapsulates all the state and steps of an asynchronous compilation. |
260 // An asynchronous compile job consists of a number of tasks that are executed | 260 // An asynchronous compile job consists of a number of tasks that are executed |
261 // as foreground and background tasks. Any phase that touches the V8 heap or | 261 // as foreground and background tasks. Any phase that touches the V8 heap or |
262 // allocates on the V8 heap (e.g. creating the module object) must be a | 262 // allocates on the V8 heap (e.g. creating the module object) must be a |
263 // foreground task. All other tasks (e.g. decoding and validating, the majority | 263 // foreground task. All other tasks (e.g. decoding and validating, the majority |
264 // of the work of compilation) can be background tasks. | 264 // of the work of compilation) can be background tasks. |
265 // TODO(wasm): factor out common parts of this with the synchronous pipeline. | 265 // TODO(wasm): factor out common parts of this with the synchronous pipeline. |
266 class AsyncCompileJob { | 266 class AsyncCompileJob { |
267 // TODO(ahaas): Fix https://bugs.chromium.org/p/v8/issues/detail?id=6263 to | |
268 // make sure that d8 does not shut down before the AsyncCompileJob is | |
269 // finished. | |
270 public: | 267 public: |
271 explicit AsyncCompileJob(Isolate* isolate, std::unique_ptr<byte[]> bytes_copy, | 268 explicit AsyncCompileJob(Isolate* isolate, std::unique_ptr<byte[]> bytes_copy, |
272 size_t length, Handle<Context> context, | 269 size_t length, Handle<Context> context, |
273 Handle<JSPromise> promise); | 270 Handle<JSPromise> promise); |
274 | 271 |
275 void Start(); | 272 void Start(); |
276 | 273 |
277 ~AsyncCompileJob(); | 274 ~AsyncCompileJob(); |
278 | 275 |
279 private: | 276 private: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 328 |
332 template <typename Task, typename... Args> | 329 template <typename Task, typename... Args> |
333 void DoAsync(Args&&... args); | 330 void DoAsync(Args&&... args); |
334 }; | 331 }; |
335 | 332 |
336 } // namespace wasm | 333 } // namespace wasm |
337 } // namespace internal | 334 } // namespace internal |
338 } // namespace v8 | 335 } // namespace v8 |
339 | 336 |
340 #endif // V8_WASM_MODULE_COMPILER_H_ | 337 #endif // V8_WASM_MODULE_COMPILER_H_ |
OLD | NEW |