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

Unified Diff: src/objects-inl.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/objects.cc ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 3d82bf8205a895693d45fc1d1a27e3118c8959ec..3f44c718ab6adc71a205faf1c49af7a389c99230 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -709,6 +709,8 @@ bool HeapObject::IsJSCollection() const { return IsJSMap() || IsJSSet(); }
bool HeapObject::IsDescriptorArray() const { return IsFixedArray(); }
+bool HeapObject::IsFrameArray() const { return IsFixedArray(); }
+
bool HeapObject::IsArrayList() const { return IsFixedArray(); }
bool Object::IsLayoutDescriptor() const {
@@ -2610,6 +2612,38 @@ Object** FixedArray::RawFieldOfElementAt(int index) {
return HeapObject::RawField(this, OffsetOfElementAt(index));
}
+#define DEFINE_FRAME_ARRAY_ACCESSORS(name, type) \
+ type* FrameArray::name(int frame_ix) const { \
+ Object* obj = \
+ get(kFirstIndex + frame_ix * kElementsPerFrame + k##name##Offset); \
+ return type::cast(obj); \
+ } \
+ \
+ void FrameArray::Set##name(int frame_ix, type* value) { \
+ set(kFirstIndex + frame_ix * kElementsPerFrame + k##name##Offset, value); \
+ }
+FRAME_ARRAY_FIELD_LIST(DEFINE_FRAME_ARRAY_ACCESSORS)
+#undef DEFINE_FRAME_ARRAY_ACCESSORS
+
+int FrameArray::SloppyFrameCount() const {
+ return Smi::cast(get(kSloppyFramesIndex))->value();
+}
+
+void FrameArray::SetSloppyFrameCount(int count) {
+ return set(kSloppyFramesIndex, Smi::FromInt(count));
+}
+
+bool FrameArray::IsWasmFrame(int frame_ix) const {
+ Object* obj = get(kFirstIndex + frame_ix * kElementsPerFrame +
+ kWasmFunctionIndexOffset);
+ return obj->IsSmi();
+}
+
+int FrameArray::FrameCount() const {
+ const int frame_count = Smi::cast(get(kFrameCountIndex))->value();
+ DCHECK_LE(0, frame_count);
+ return frame_count;
+}
bool DescriptorArray::IsEmpty() {
DCHECK(length() >= kFirstIndex ||
@@ -3223,6 +3257,7 @@ CAST_ACCESSOR(FixedDoubleArray)
CAST_ACCESSOR(FixedTypedArrayBase)
CAST_ACCESSOR(Float32x4)
CAST_ACCESSOR(Foreign)
+CAST_ACCESSOR(FrameArray)
CAST_ACCESSOR(GlobalDictionary)
CAST_ACCESSOR(HandlerTable)
CAST_ACCESSOR(HeapObject)
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698