• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INL_H_
6 #define V8_OBJECTS_FRAME_ARRAY_INL_H_
7 
8 #include "src/objects/frame-array.h"
9 
10 #include "src/objects/foreign-inl.h"
11 #include "src/wasm/wasm-objects-inl.h"
12 
13 // Has to be the last include (doesn't have include guards):
14 #include "src/objects/object-macros.h"
15 
16 namespace v8 {
17 namespace internal {
18 
OBJECT_CONSTRUCTORS_IMPL(FrameArray,FixedArray)19 OBJECT_CONSTRUCTORS_IMPL(FrameArray, FixedArray)
20 CAST_ACCESSOR(FrameArray)
21 
22 #define DEFINE_FRAME_ARRAY_ACCESSORS(name, type)                              \
23   type FrameArray::name(int frame_ix) const {                                 \
24     Object obj =                                                              \
25         get(kFirstIndex + frame_ix * kElementsPerFrame + k##name##Offset);    \
26     return type::cast(obj);                                                   \
27   }                                                                           \
28                                                                               \
29   void FrameArray::Set##name(int frame_ix, type value) {                      \
30     set(kFirstIndex + frame_ix * kElementsPerFrame + k##name##Offset, value); \
31   }
32 FRAME_ARRAY_FIELD_LIST(DEFINE_FRAME_ARRAY_ACCESSORS)
33 #undef DEFINE_FRAME_ARRAY_ACCESSORS
34 
35 bool FrameArray::IsWasmFrame(int frame_ix) const {
36   const int flags = Flags(frame_ix).value();
37   return (flags & kIsWasmFrame) != 0;
38 }
39 
IsAsmJsWasmFrame(int frame_ix)40 bool FrameArray::IsAsmJsWasmFrame(int frame_ix) const {
41   const int flags = Flags(frame_ix).value();
42   return (flags & kIsAsmJsWasmFrame) != 0;
43 }
44 
IsAnyWasmFrame(int frame_ix)45 bool FrameArray::IsAnyWasmFrame(int frame_ix) const {
46   return IsWasmFrame(frame_ix) || IsAsmJsWasmFrame(frame_ix);
47 }
48 
FrameCount()49 int FrameArray::FrameCount() const {
50   const int frame_count = Smi::ToInt(get(kFrameCountIndex));
51   DCHECK_LE(0, frame_count);
52   return frame_count;
53 }
54 
55 }  // namespace internal
56 }  // namespace v8
57 
58 #include "src/objects/object-macros-undef.h"
59 
60 #endif  // V8_OBJECTS_FRAME_ARRAY_INL_H_
61