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_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 :
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 23534616 : FRAME_ARRAY_FIELD_LIST(DEFINE_FRAME_ARRAY_ACCESSORS)
33 : #undef DEFINE_FRAME_ARRAY_ACCESSORS
34 :
35 85010 : bool FrameArray::IsWasmFrame(int frame_ix) const {
36 : const int flags = Flags(frame_ix)->value();
37 85010 : return (flags & kIsWasmFrame) != 0;
38 : }
39 :
40 89846 : bool FrameArray::IsWasmInterpretedFrame(int frame_ix) const {
41 : const int flags = Flags(frame_ix)->value();
42 89846 : return (flags & kIsWasmInterpretedFrame) != 0;
43 : }
44 :
45 83666 : bool FrameArray::IsAsmJsWasmFrame(int frame_ix) const {
46 : const int flags = Flags(frame_ix)->value();
47 83666 : return (flags & kIsAsmJsWasmFrame) != 0;
48 : }
49 :
50 84074 : bool FrameArray::IsAnyWasmFrame(int frame_ix) const {
51 166804 : return IsWasmFrame(frame_ix) || IsWasmInterpretedFrame(frame_ix) ||
52 166804 : IsAsmJsWasmFrame(frame_ix);
53 : }
54 :
55 : int FrameArray::FrameCount() const {
56 : const int frame_count = Smi::ToInt(get(kFrameCountIndex));
57 : DCHECK_LE(0, frame_count);
58 : return frame_count;
59 : }
60 :
61 : } // namespace internal
62 : } // namespace v8
63 :
64 : #include "src/objects/object-macros-undef.h"
65 :
66 : #endif // V8_OBJECTS_FRAME_ARRAY_INL_H_
|