LCOV - code coverage report
Current view: top level - src/builtins - builtins-async-gen.h (source / functions) Hit Total Coverage
Test: app.info Lines: 6 6 100.0 %
Date: 2017-10-20 Functions: 2 2 100.0 %

          Line data    Source code
       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
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_BUILTINS_BUILTINS_ASYNC_H_
       6             : #define V8_BUILTINS_BUILTINS_ASYNC_H_
       7             : 
       8             : #include "src/builtins/builtins-promise-gen.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13             : class AsyncBuiltinsAssembler : public PromiseBuiltinsAssembler {
      14             :  public:
      15             :   explicit AsyncBuiltinsAssembler(compiler::CodeAssemblerState* state)
      16             :       : PromiseBuiltinsAssembler(state) {}
      17             : 
      18             :  protected:
      19             :   typedef std::function<void(Node*)> ContextInitializer;
      20             : 
      21             :   // Perform steps to resume generator after `value` is resolved.
      22             :   // `on_reject_context_index` is an index into the Native Context, which should
      23             :   // point to a SharedFunctioninfo instance used to create the closure. The
      24             :   // value following the reject index should be a similar value for the resolve
      25             :   // closure. Returns the Promise-wrapped `value`.
      26             :   Node* Await(Node* context, Node* generator, Node* value, Node* outer_promise,
      27             :               int context_length,
      28             :               const ContextInitializer& init_closure_context,
      29             :               Node* on_resolve_context_index, Node* on_reject_context_index,
      30             :               Node* is_predicted_as_caught);
      31         155 :   Node* Await(Node* context, Node* generator, Node* value, Node* outer_promise,
      32             :               int context_length,
      33             :               const ContextInitializer& init_closure_context,
      34             :               int on_resolve_context_index, int on_reject_context_index,
      35             :               Node* is_predicted_as_caught) {
      36             :     return Await(context, generator, value, outer_promise, context_length,
      37         155 :                  init_closure_context, IntPtrConstant(on_resolve_context_index),
      38         155 :                  IntPtrConstant(on_reject_context_index),
      39         465 :                  is_predicted_as_caught);
      40             :   }
      41         124 :   Node* Await(Node* context, Node* generator, Node* value, Node* outer_promise,
      42             :               int context_length,
      43             :               const ContextInitializer& init_closure_context,
      44             :               int on_resolve_context_index, int on_reject_context_index,
      45             :               bool is_predicted_as_caught) {
      46             :     return Await(context, generator, value, outer_promise, context_length,
      47             :                  init_closure_context, on_resolve_context_index,
      48             :                  on_reject_context_index,
      49         248 :                  BooleanConstant(is_predicted_as_caught));
      50             :   }
      51             : 
      52             :   // Return a new built-in function object as defined in
      53             :   // Async Iterator Value Unwrap Functions
      54             :   Node* CreateUnwrapClosure(Node* const native_context, Node* const done);
      55             : 
      56             :  private:
      57             :   void InitializeNativeClosure(Node* context, Node* native_context,
      58             :                                Node* function, Node* context_index);
      59             :   Node* AllocateAsyncIteratorValueUnwrapContext(Node* native_context,
      60             :                                                 Node* done);
      61             : };
      62             : 
      63             : }  // namespace internal
      64             : }  // namespace v8
      65             : 
      66             : #endif  // V8_BUILTINS_BUILTINS_ASYNC_H_

Generated by: LCOV version 1.10