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