LCOV - code coverage report
Current view: top level - src/objects - frame-array.h (source / functions) Hit Total Coverage
Test: app.info Lines: 1 1 100.0 %
Date: 2017-04-26 Functions: 0 0 -

          Line data    Source code
       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
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_OBJECTS_FRAME_ARRAY_H_
       6             : #define V8_OBJECTS_FRAME_ARRAY_H_
       7             : 
       8             : #include "src/objects.h"
       9             : 
      10             : // Has to be the last include (doesn't have include guards):
      11             : #include "src/objects/object-macros.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : 
      16             : template <typename T>
      17             : class Handle;
      18             : 
      19             : #define FRAME_ARRAY_FIELD_LIST(V) \
      20             :   V(WasmInstance, Object)         \
      21             :   V(WasmFunctionIndex, Smi)       \
      22             :   V(Receiver, Object)             \
      23             :   V(Function, JSFunction)         \
      24             :   V(Code, AbstractCode)           \
      25             :   V(Offset, Smi)                  \
      26             :   V(Flags, Smi)
      27             : 
      28             : // Container object for data collected during simple stack trace captures.
      29             : class FrameArray : public FixedArray {
      30             :  public:
      31             : #define DECLARE_FRAME_ARRAY_ACCESSORS(name, type) \
      32             :   inline type* name(int frame_ix) const;          \
      33             :   inline void Set##name(int frame_ix, type* value);
      34             :   FRAME_ARRAY_FIELD_LIST(DECLARE_FRAME_ARRAY_ACCESSORS)
      35             : #undef DECLARE_FRAME_ARRAY_ACCESSORS
      36             : 
      37             :   inline bool IsWasmFrame(int frame_ix) const;
      38             :   inline bool IsWasmInterpretedFrame(int frame_ix) const;
      39             :   inline bool IsAsmJsWasmFrame(int frame_ix) const;
      40             :   inline int FrameCount() const;
      41             : 
      42             :   void ShrinkToFit();
      43             : 
      44             :   // Flags.
      45             :   enum Flag {
      46             :     kIsWasmFrame = 1 << 0,
      47             :     kIsWasmInterpretedFrame = 1 << 1,
      48             :     kIsAsmJsWasmFrame = 1 << 2,
      49             :     kIsStrict = 1 << 3,
      50             :     kForceConstructor = 1 << 4,
      51             :     kAsmJsAtNumberConversion = 1 << 5
      52             :   };
      53             : 
      54             :   static Handle<FrameArray> AppendJSFrame(Handle<FrameArray> in,
      55             :                                           Handle<Object> receiver,
      56             :                                           Handle<JSFunction> function,
      57             :                                           Handle<AbstractCode> code, int offset,
      58             :                                           int flags);
      59             :   static Handle<FrameArray> AppendWasmFrame(Handle<FrameArray> in,
      60             :                                             Handle<Object> wasm_instance,
      61             :                                             int wasm_function_index,
      62             :                                             Handle<AbstractCode> code,
      63             :                                             int offset, int flags);
      64             : 
      65             :   DECLARE_CAST(FrameArray)
      66             : 
      67             :  private:
      68             :   // The underlying fixed array embodies a captured stack trace. Frame i
      69             :   // occupies indices
      70             :   //
      71             :   // kFirstIndex + 1 + [i * kElementsPerFrame, (i + 1) * kElementsPerFrame[,
      72             :   //
      73             :   // with internal offsets as below:
      74             : 
      75             :   static const int kWasmInstanceOffset = 0;
      76             :   static const int kWasmFunctionIndexOffset = 1;
      77             : 
      78             :   static const int kReceiverOffset = 0;
      79             :   static const int kFunctionOffset = 1;
      80             : 
      81             :   static const int kCodeOffset = 2;
      82             :   static const int kOffsetOffset = 3;
      83             : 
      84             :   static const int kFlagsOffset = 4;
      85             : 
      86             :   static const int kElementsPerFrame = 5;
      87             : 
      88             :   // Array layout indices.
      89             : 
      90             :   static const int kFrameCountIndex = 0;
      91             :   static const int kFirstIndex = 1;
      92             : 
      93             :   static int LengthFor(int frame_count) {
      94     7188691 :     return kFirstIndex + frame_count * kElementsPerFrame;
      95             :   }
      96             : 
      97             :   static Handle<FrameArray> EnsureSpace(Handle<FrameArray> array, int length);
      98             : 
      99             :   friend class Factory;
     100             :   DISALLOW_IMPLICIT_CONSTRUCTORS(FrameArray);
     101             : };
     102             : 
     103             : }  // namespace internal
     104             : }  // namespace v8
     105             : 
     106             : #include "src/objects/object-macros-undef.h"
     107             : 
     108             : #endif  // V8_OBJECTS_FRAME_ARRAY_H_

Generated by: LCOV version 1.10