Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Unified Diff: src/objects.h

Issue 2270783002: Add new FrameArray type (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/messages.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index b7c67030c5076332dc2bc2d2e24cf2804078b0e1..2d90acdb1d73c3c1dec43b900b20e5796290a8c2 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -76,6 +76,7 @@
// - BytecodeArray
// - FixedArray
// - DescriptorArray
+// - FrameArray
// - LiteralsArray
// - HashTable
// - Dictionary
@@ -862,7 +863,7 @@ enum class ComparisonResult {
INLINE(static type* cast(Object* object)); \
INLINE(static const type* cast(const Object* object));
-
+class AbstractCode;
class AccessorPair;
class AllocationSite;
class AllocationSiteCreationContext;
@@ -961,6 +962,7 @@ template <class C> inline bool Is(Object* obj);
V(JSGeneratorObject) \
V(Map) \
V(DescriptorArray) \
+ V(FrameArray) \
V(TransitionArray) \
V(LiteralsArray) \
V(TypeFeedbackMetadata) \
@@ -2895,7 +2897,6 @@ class WeakFixedArray : public FixedArray {
DISALLOW_IMPLICIT_CONSTRUCTORS(WeakFixedArray);
};
-
// Generic array grows dynamically with O(1) amortized insertion.
class ArrayList : public FixedArray {
public:
@@ -2925,6 +2926,76 @@ class ArrayList : public FixedArray {
DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList);
};
+#define FRAME_ARRAY_FIELD_LIST(V) \
+ V(WasmObject, Object) \
+ V(WasmFunctionIndex, Smi) \
+ V(Receiver, Object) \
+ V(Function, JSFunction) \
+ V(Code, AbstractCode) \
+ V(Offset, Smi)
+
+// Container object for data collected during simple stack trace captures.
+class FrameArray : public FixedArray {
+ public:
+#define DECLARE_FRAME_ARRAY_ACCESSORS(name, type) \
+ inline type* name(int frame_ix) const; \
+ inline void Set##name(int frame_ix, type* value);
+ FRAME_ARRAY_FIELD_LIST(DECLARE_FRAME_ARRAY_ACCESSORS)
+#undef DECLARE_FRAME_ARRAY_ACCESSORS
+
+ inline void SetSloppyFrameCount(int count);
+ inline int SloppyFrameCount() const;
+
+ inline bool IsWasmFrame(int frame_ix) const;
+ inline int FrameCount() const;
+
+ void ShrinkToFit();
+
+ static Handle<FrameArray> AppendJSFrame(Handle<FrameArray> in,
+ Handle<Object> receiver,
+ Handle<JSFunction> function,
+ Handle<AbstractCode> code,
+ int offset);
+ static Handle<FrameArray> AppendWasmFrame(Handle<FrameArray> in,
+ Handle<Object> wasm_object,
+ int wasm_function_index,
+ Handle<AbstractCode> code,
+ int offset);
+
+ DECLARE_CAST(FrameArray)
+
+ private:
+ // The underlying fixed array embodies a captured stack trace. The number of
+ // sloppy frames is stored at array[kFirstIndex]. Frame i occupies indices
+ // kFirstIndex + 1 + [i * kElementsPerFrame, (i + 1) * kElementsPerFrame[,
+ // with internal offsets as below:
+
+ static const int kWasmObjectOffset = 0;
+ static const int kWasmFunctionIndexOffset = 1;
+
+ static const int kReceiverOffset = 0;
+ static const int kFunctionOffset = 1;
+
+ static const int kCodeOffset = 2;
+ static const int kOffsetOffset = 3;
+
+ static const int kElementsPerFrame = 4;
+
+ // Array layout indices.
+
+ static const int kFrameCountIndex = 0;
+ static const int kSloppyFramesIndex = 1;
+ static const int kFirstIndex = 2;
+
+ static int LengthFor(int frame_count) {
+ return kFirstIndex + frame_count * kElementsPerFrame;
+ }
+
+ static Handle<FrameArray> EnsureSpace(Handle<FrameArray> array, int length);
+
+ friend class Factory;
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FrameArray);
+};
// DescriptorArrays are fixed arrays used to hold instance descriptors.
// The format of the these objects is:
« no previous file with comments | « src/messages.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698