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

Unified Diff: src/objects.h

Issue 2270783002: Add new FrameArray type (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index b7c67030c5076332dc2bc2d2e24cf2804078b0e1..58b8bcd879274b0f9efc03c767425551263d778b 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -862,7 +862,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 +961,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 +2896,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 +2925,66 @@ 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 bool IsWasmFrame(int frame_ix) const;
+ inline int FrameCount() const;
+
+ static Handle<FrameArray> Allocate(Isolate* isolate, int number_of_frames);
+
+ static Handle<FrameArray> AppendJSFrame(Handle<FrameArray> in, int frame_ix,
+ Handle<Object> receiver,
+ Handle<JSFunction> function,
+ Handle<AbstractCode> code,
+ int offset);
+ static Handle<FrameArray> AppendWasmFrame(Handle<FrameArray> in, int frame_ix,
+ Handle<Object> wasm_object,
+ int wasm_function_index,
+ Handle<AbstractCode> code,
+ int offset);
+
+ static int LengthFor(int frame_count) {
+ return 1 + frame_count * kElementsPerFrame;
+ }
+
+ DECLARE_CAST(FrameArray)
+
+ private:
+ // The underlying fixed array embodies a captured stack trace. The number of
+ // sloppy frames is stored at array[0]. Frame i occupies indices
+ // 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;
+
+ static Handle<FrameArray> EnsureSpace(Handle<FrameArray> array, int length);
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FrameArray);
+};
// DescriptorArrays are fixed arrays used to hold instance descriptors.
// The format of the these objects is:

Powered by Google App Engine
This is Rietveld 408576698