OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2925 static const int kFirstIndex = 1; | 2925 static const int kFirstIndex = 1; |
2926 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); | 2926 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); |
2927 }; | 2927 }; |
2928 | 2928 |
2929 #define FRAME_ARRAY_FIELD_LIST(V) \ | 2929 #define FRAME_ARRAY_FIELD_LIST(V) \ |
2930 V(WasmObject, Object) \ | 2930 V(WasmObject, Object) \ |
2931 V(WasmFunctionIndex, Smi) \ | 2931 V(WasmFunctionIndex, Smi) \ |
2932 V(Receiver, Object) \ | 2932 V(Receiver, Object) \ |
2933 V(Function, JSFunction) \ | 2933 V(Function, JSFunction) \ |
2934 V(Code, AbstractCode) \ | 2934 V(Code, AbstractCode) \ |
2935 V(Offset, Smi) | 2935 V(Offset, Smi) \ |
| 2936 V(Flags, Smi) |
2936 | 2937 |
2937 // Container object for data collected during simple stack trace captures. | 2938 // Container object for data collected during simple stack trace captures. |
2938 class FrameArray : public FixedArray { | 2939 class FrameArray : public FixedArray { |
2939 public: | 2940 public: |
2940 #define DECLARE_FRAME_ARRAY_ACCESSORS(name, type) \ | 2941 #define DECLARE_FRAME_ARRAY_ACCESSORS(name, type) \ |
2941 inline type* name(int frame_ix) const; \ | 2942 inline type* name(int frame_ix) const; \ |
2942 inline void Set##name(int frame_ix, type* value); | 2943 inline void Set##name(int frame_ix, type* value); |
2943 FRAME_ARRAY_FIELD_LIST(DECLARE_FRAME_ARRAY_ACCESSORS) | 2944 FRAME_ARRAY_FIELD_LIST(DECLARE_FRAME_ARRAY_ACCESSORS) |
2944 #undef DECLARE_FRAME_ARRAY_ACCESSORS | 2945 #undef DECLARE_FRAME_ARRAY_ACCESSORS |
2945 | 2946 |
2946 inline void SetSloppyFrameCount(int count); | |
2947 inline int SloppyFrameCount() const; | |
2948 | |
2949 inline bool IsWasmFrame(int frame_ix) const; | 2947 inline bool IsWasmFrame(int frame_ix) const; |
2950 inline int FrameCount() const; | 2948 inline int FrameCount() const; |
2951 | 2949 |
2952 void ShrinkToFit(); | 2950 void ShrinkToFit(); |
2953 | 2951 |
| 2952 // Flags. |
| 2953 static const int kIsWasmFrame = 1 << 0; |
| 2954 static const int kIsStrict = 1 << 1; |
| 2955 static const int kForceConstructor = 1 << 2; |
| 2956 |
2954 static Handle<FrameArray> AppendJSFrame(Handle<FrameArray> in, | 2957 static Handle<FrameArray> AppendJSFrame(Handle<FrameArray> in, |
2955 Handle<Object> receiver, | 2958 Handle<Object> receiver, |
2956 Handle<JSFunction> function, | 2959 Handle<JSFunction> function, |
2957 Handle<AbstractCode> code, | 2960 Handle<AbstractCode> code, int offset, |
2958 int offset); | 2961 int flags); |
2959 static Handle<FrameArray> AppendWasmFrame(Handle<FrameArray> in, | 2962 static Handle<FrameArray> AppendWasmFrame(Handle<FrameArray> in, |
2960 Handle<Object> wasm_object, | 2963 Handle<Object> wasm_object, |
2961 int wasm_function_index, | 2964 int wasm_function_index, |
2962 Handle<AbstractCode> code, | 2965 Handle<AbstractCode> code, |
2963 int offset); | 2966 int offset, int flags); |
2964 | 2967 |
2965 DECLARE_CAST(FrameArray) | 2968 DECLARE_CAST(FrameArray) |
2966 | 2969 |
2967 private: | 2970 private: |
2968 // The underlying fixed array embodies a captured stack trace. The number of | 2971 // The underlying fixed array embodies a captured stack trace. Frame i |
2969 // sloppy frames is stored at array[kFirstIndex]. Frame i occupies indices | 2972 // occupies indices |
| 2973 // |
2970 // kFirstIndex + 1 + [i * kElementsPerFrame, (i + 1) * kElementsPerFrame[, | 2974 // kFirstIndex + 1 + [i * kElementsPerFrame, (i + 1) * kElementsPerFrame[, |
| 2975 // |
2971 // with internal offsets as below: | 2976 // with internal offsets as below: |
2972 | 2977 |
2973 static const int kWasmObjectOffset = 0; | 2978 static const int kWasmObjectOffset = 0; |
2974 static const int kWasmFunctionIndexOffset = 1; | 2979 static const int kWasmFunctionIndexOffset = 1; |
2975 | 2980 |
2976 static const int kReceiverOffset = 0; | 2981 static const int kReceiverOffset = 0; |
2977 static const int kFunctionOffset = 1; | 2982 static const int kFunctionOffset = 1; |
2978 | 2983 |
2979 static const int kCodeOffset = 2; | 2984 static const int kCodeOffset = 2; |
2980 static const int kOffsetOffset = 3; | 2985 static const int kOffsetOffset = 3; |
2981 | 2986 |
2982 static const int kElementsPerFrame = 4; | 2987 static const int kFlagsOffset = 4; |
| 2988 |
| 2989 static const int kElementsPerFrame = 5; |
2983 | 2990 |
2984 // Array layout indices. | 2991 // Array layout indices. |
2985 | 2992 |
2986 static const int kFrameCountIndex = 0; | 2993 static const int kFrameCountIndex = 0; |
2987 static const int kSloppyFramesIndex = 1; | 2994 static const int kFirstIndex = 1; |
2988 static const int kFirstIndex = 2; | |
2989 | 2995 |
2990 static int LengthFor(int frame_count) { | 2996 static int LengthFor(int frame_count) { |
2991 return kFirstIndex + frame_count * kElementsPerFrame; | 2997 return kFirstIndex + frame_count * kElementsPerFrame; |
2992 } | 2998 } |
2993 | 2999 |
2994 static Handle<FrameArray> EnsureSpace(Handle<FrameArray> array, int length); | 3000 static Handle<FrameArray> EnsureSpace(Handle<FrameArray> array, int length); |
2995 | 3001 |
2996 friend class Factory; | 3002 friend class Factory; |
2997 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameArray); | 3003 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameArray); |
2998 }; | 3004 }; |
(...skipping 8168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11167 } | 11173 } |
11168 return value; | 11174 return value; |
11169 } | 11175 } |
11170 }; | 11176 }; |
11171 | 11177 |
11172 | 11178 |
11173 } // NOLINT, false-positive due to second-order macros. | 11179 } // NOLINT, false-positive due to second-order macros. |
11174 } // NOLINT, false-positive due to second-order macros. | 11180 } // NOLINT, false-positive due to second-order macros. |
11175 | 11181 |
11176 #endif // V8_OBJECTS_H_ | 11182 #endif // V8_OBJECTS_H_ |
OLD | NEW |