LCOV - code coverage report
Current view: top level - src/builtins - builtins-typed-array-gen.h (source / functions) Hit Total Coverage
Test: app.info Lines: 3 3 100.0 %
Date: 2019-02-19 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright 2018 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_TYPED_ARRAY_GEN_H_
       6             : #define V8_BUILTINS_BUILTINS_TYPED_ARRAY_GEN_H_
       7             : 
       8             : #include "src/code-stub-assembler.h"
       9             : #include "torque-generated/builtins-typed-array-from-dsl-gen.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14        3192 : class TypedArrayBuiltinsAssembler : public CodeStubAssembler {
      15             :  public:
      16             :   using ElementsInfo =
      17             :       TypedArrayBuiltinsFromDSLAssembler::TypedArrayElementsInfo;
      18        3192 :   explicit TypedArrayBuiltinsAssembler(compiler::CodeAssemblerState* state)
      19        3192 :       : CodeStubAssembler(state) {}
      20             : 
      21             :   template <class... TArgs>
      22             :   TNode<JSTypedArray> TypedArraySpeciesCreate(const char* method_name,
      23             :                                               TNode<Context> context,
      24             :                                               TNode<JSTypedArray> exemplar,
      25             :                                               TArgs... args);
      26             : 
      27             :   TNode<JSTypedArray> TypedArraySpeciesCreateByLength(
      28             :       TNode<Context> context, TNode<JSTypedArray> exemplar, TNode<Smi> len,
      29             :       const char* method_name);
      30             : 
      31             :   void GenerateTypedArrayPrototypeIterationMethod(TNode<Context> context,
      32             :                                                   TNode<Object> receiver,
      33             :                                                   const char* method_name,
      34             :                                                   IterationKind iteration_kind);
      35             : 
      36             :   void SetupTypedArray(TNode<JSTypedArray> holder, TNode<Smi> length,
      37             :                        TNode<UintPtrT> byte_offset,
      38             :                        TNode<UintPtrT> byte_length);
      39             :   void AttachBuffer(TNode<JSTypedArray> holder, TNode<JSArrayBuffer> buffer,
      40             :                     TNode<Map> map, TNode<Smi> length,
      41             :                     TNode<Number> byte_offset);
      42             : 
      43             :   TNode<JSArrayBuffer> AllocateEmptyOnHeapBuffer(TNode<Context> context,
      44             :                                                  TNode<JSTypedArray> holder,
      45             :                                                  TNode<UintPtrT> byte_length);
      46             : 
      47             :   TNode<FixedTypedArrayBase> AllocateOnHeapElements(TNode<Map> map,
      48             :                                                     TNode<IntPtrT> byte_length,
      49             :                                                     TNode<Number> length);
      50             : 
      51             :   TNode<Map> LoadMapForType(TNode<JSTypedArray> array);
      52             :   TNode<UintPtrT> CalculateExternalPointer(TNode<UintPtrT> backing_store,
      53             :                                            TNode<Number> byte_offset);
      54             :   Node* LoadDataPtr(Node* typed_array);
      55             :   TNode<BoolT> ByteLengthIsValid(TNode<Number> byte_length);
      56             : 
      57             :   // Returns true if kind is either UINT8_ELEMENTS or UINT8_CLAMPED_ELEMENTS.
      58             :   TNode<Word32T> IsUint8ElementsKind(TNode<Word32T> kind);
      59             : 
      60             :   // Returns true if kind is either BIGINT64_ELEMENTS or BIGUINT64_ELEMENTS.
      61             :   TNode<Word32T> IsBigInt64ElementsKind(TNode<Word32T> kind);
      62             : 
      63             :   // Returns the byte size of an element for a TypedArray elements kind.
      64             :   TNode<IntPtrT> GetTypedArrayElementSize(TNode<Word32T> elements_kind);
      65             : 
      66             :   // Returns information (byte size and map) about a TypedArray's elements.
      67             :   ElementsInfo GetTypedArrayElementsInfo(TNode<JSTypedArray> typed_array);
      68             : 
      69             :   TNode<JSFunction> GetDefaultConstructor(TNode<Context> context,
      70             :                                           TNode<JSTypedArray> exemplar);
      71             : 
      72             :   TNode<JSTypedArray> TypedArrayCreateByLength(TNode<Context> context,
      73             :                                                TNode<Object> constructor,
      74             :                                                TNode<Smi> len,
      75             :                                                const char* method_name);
      76             : 
      77             :   void ThrowIfLengthLessThan(TNode<Context> context,
      78             :                              TNode<JSTypedArray> typed_array,
      79             :                              TNode<Smi> min_length);
      80             : 
      81             :   TNode<JSArrayBuffer> GetBuffer(TNode<Context> context,
      82             :                                  TNode<JSTypedArray> array);
      83             : 
      84             :   TNode<JSTypedArray> ValidateTypedArray(TNode<Context> context,
      85             :                                          TNode<Object> obj,
      86             :                                          const char* method_name);
      87             : 
      88             :   // Fast path for setting a TypedArray (source) onto another TypedArray
      89             :   // (target) at an element offset.
      90             :   void SetTypedArraySource(TNode<Context> context, TNode<JSTypedArray> source,
      91             :                            TNode<JSTypedArray> target, TNode<IntPtrT> offset,
      92             :                            Label* call_runtime, Label* if_source_too_large);
      93             : 
      94             :   void SetJSArraySource(TNode<Context> context, TNode<JSArray> source,
      95             :                         TNode<JSTypedArray> target, TNode<IntPtrT> offset,
      96             :                         Label* call_runtime, Label* if_source_too_large);
      97             : 
      98             :   void CallCMemmove(TNode<IntPtrT> dest_ptr, TNode<IntPtrT> src_ptr,
      99             :                     TNode<IntPtrT> byte_length);
     100             : 
     101             :   void CallCMemcpy(TNode<RawPtrT> dest_ptr, TNode<RawPtrT> src_ptr,
     102             :                    TNode<UintPtrT> byte_length);
     103             : 
     104             :   void CallCMemset(TNode<RawPtrT> dest_ptr, TNode<IntPtrT> value,
     105             :                    TNode<UintPtrT> length);
     106             : 
     107             :   void CallCCopyFastNumberJSArrayElementsToTypedArray(
     108             :       TNode<Context> context, TNode<JSArray> source, TNode<JSTypedArray> dest,
     109             :       TNode<IntPtrT> source_length, TNode<IntPtrT> offset);
     110             : 
     111             :   void CallCCopyTypedArrayElementsToTypedArray(TNode<JSTypedArray> source,
     112             :                                                TNode<JSTypedArray> dest,
     113             :                                                TNode<IntPtrT> source_length,
     114             :                                                TNode<IntPtrT> offset);
     115             : 
     116             :   void CallCCopyTypedArrayElementsSlice(TNode<JSTypedArray> source,
     117             :                                         TNode<JSTypedArray> dest,
     118             :                                         TNode<IntPtrT> start,
     119             :                                         TNode<IntPtrT> end);
     120             : 
     121             :   typedef std::function<void(ElementsKind, int, int)> TypedArraySwitchCase;
     122             : 
     123             :   void DispatchTypedArrayByElementsKind(
     124             :       TNode<Word32T> elements_kind, const TypedArraySwitchCase& case_function);
     125             : 
     126             :   TNode<BoolT> IsSharedArrayBuffer(TNode<JSArrayBuffer> buffer);
     127             : };
     128             : 
     129             : }  // namespace internal
     130             : }  // namespace v8
     131             : 
     132             : #endif  // V8_BUILTINS_BUILTINS_TYPED_ARRAY_GEN_H_

Generated by: LCOV version 1.10