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

Side by Side Diff: vm/raw_object.h

Issue 9791048: - Wire the stack frame iterator to use stack maps for traversing objects if there are stack maps in… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 ASSERT(result == SizeFromClass()); 244 ASSERT(result == SizeFromClass());
245 return result; 245 return result;
246 } 246 }
247 result = SizeFromClass(); 247 result = SizeFromClass();
248 ASSERT((result > SizeTag::kMaxSizeTag) || FreeBit::decode(tags)); 248 ASSERT((result > SizeTag::kMaxSizeTag) || FreeBit::decode(tags));
249 return result; 249 return result;
250 } 250 }
251 251
252 void Validate() const; 252 void Validate() const;
253 intptr_t VisitPointers(ObjectPointerVisitor* visitor); 253 intptr_t VisitPointers(ObjectPointerVisitor* visitor);
254 bool FindObject(FindObjectVisitor* visitor);
254 255
255 static RawObject* FromAddr(uword addr) { 256 static RawObject* FromAddr(uword addr) {
256 // We expect the untagged address here. 257 // We expect the untagged address here.
257 ASSERT((addr & kSmiTagMask) != kHeapObjectTag); 258 ASSERT((addr & kSmiTagMask) != kHeapObjectTag);
258 return reinterpret_cast<RawObject*>(addr + kHeapObjectTag); 259 return reinterpret_cast<RawObject*>(addr + kHeapObjectTag);
259 } 260 }
260 261
261 static uword ToAddr(RawObject* raw_obj) { 262 static uword ToAddr(RawObject* raw_obj) {
262 return reinterpret_cast<uword>(raw_obj->ptr()); 263 return reinterpret_cast<uword>(raw_obj->ptr());
263 } 264 }
264 265
265 static bool IsCreatedFromSnapshot(intptr_t value) { 266 static bool IsCreatedFromSnapshot(intptr_t value) {
266 return CreatedFromSnapshotTag::decode(value); 267 return CreatedFromSnapshotTag::decode(value);
267 } 268 }
268 269
269 static bool IsCanonical(intptr_t value) { 270 static bool IsCanonical(intptr_t value) {
270 return CanonicalObjectTag::decode(value); 271 return CanonicalObjectTag::decode(value);
271 } 272 }
272 273
274 static bool IsRawInstruction(RawObject* raw_obj);
275
273 protected: 276 protected:
274 RawClass* class_; 277 RawClass* class_;
275 uword tags_; // Various object tags (bits). 278 uword tags_; // Various object tags (bits).
276 279
277 private: 280 private:
278 class FreeBit : public BitField<bool, kFreeBit, 1> {}; 281 class FreeBit : public BitField<bool, kFreeBit, 1> {};
279 282
280 class MarkBit : public BitField<bool, kMarkBit, 1> {}; 283 class MarkBit : public BitField<bool, kMarkBit, 1> {};
281 284
282 class CanonicalObjectTag : public BitField<bool, kCanonicalBit, 1> {}; 285 class CanonicalObjectTag : public BitField<bool, kCanonicalBit, 1> {};
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 RawObject** to() { 661 RawObject** to() {
659 return reinterpret_cast<RawObject**>(&ptr()->var_descriptors_); 662 return reinterpret_cast<RawObject**>(&ptr()->var_descriptors_);
660 } 663 }
661 664
662 intptr_t pointer_offsets_length_; 665 intptr_t pointer_offsets_length_;
663 // This cannot be boolean because of alignment issues on x64 architectures. 666 // This cannot be boolean because of alignment issues on x64 architectures.
664 intptr_t is_optimized_; 667 intptr_t is_optimized_;
665 668
666 // Variable length data follows here. 669 // Variable length data follows here.
667 int32_t data_[0]; 670 int32_t data_[0];
671
672 // Private helper function used while visiting stack frames during
673 // GC. The code which iterates over dart frames during GC is not
674 // allowed to create handles.
675 RawStackmap* GetStackmap(uword pc) const;
676
677 friend class DartFrame;
678 friend class StubFrame;
668 }; 679 };
669 680
670 681
671 class RawInstructions : public RawObject { 682 class RawInstructions : public RawObject {
672 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); 683 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions);
673 684
674 RawCode* code_; 685 RawCode* code_;
675 intptr_t size_; 686 intptr_t size_;
676 687
677 // Variable length data follows here. 688 // Variable length data follows here.
678 uint8_t data_[0]; 689 uint8_t data_[0];
679 690
691 // Private helper function used while visiting stack frames. The
692 // code which iterates over dart frames is also called during GC and
693 // is not allowed to create handles.
694 static bool ContainsPC(RawObject* raw_obj, uword pc);
695
680 friend class RawCode; 696 friend class RawCode;
697 friend class StackFrame;
681 }; 698 };
682 699
683 700
684 class RawPcDescriptors : public RawObject { 701 class RawPcDescriptors : public RawObject {
685 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); 702 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors);
686 703
687 RawSmi* length_; // Number of descriptors. 704 RawSmi* length_; // Number of descriptors.
688 705
689 // Variable length data follows here. 706 // Variable length data follows here.
690 intptr_t data_[0]; 707 intptr_t data_[0];
(...skipping 16 matching lines...) Expand all
707 } 724 }
708 RawCode* code_; // Code object corresponding to the frame described. 725 RawCode* code_; // Code object corresponding to the frame described.
709 RawSmi* bitmap_size_in_bytes_; // Size of the bit map in bytes. 726 RawSmi* bitmap_size_in_bytes_; // Size of the bit map in bytes.
710 RawObject** to() { 727 RawObject** to() {
711 return reinterpret_cast<RawObject**>(&ptr()->bitmap_size_in_bytes_); 728 return reinterpret_cast<RawObject**>(&ptr()->bitmap_size_in_bytes_);
712 } 729 }
713 uword pc_; // PC corresponding to this stack map representation. 730 uword pc_; // PC corresponding to this stack map representation.
714 731
715 // Variable length data follows here (bitmap of the stack layout). 732 // Variable length data follows here (bitmap of the stack layout).
716 uint8_t data_[0]; 733 uint8_t data_[0];
734
735 // Private helper functions used while visiting stack frames during
736 // GC. The code which iterates over dart frames during GC is not
737 // allowed to create handles.
738 bool IsObject(intptr_t bit_offset) const;
739 intptr_t SizeInBits() const;
740 uword PC() const { return ptr()->pc_; }
741
742 friend class RawCode;
743 friend class DartFrame;
717 }; 744 };
718 745
719 746
720 class RawLocalVarDescriptors : public RawObject { 747 class RawLocalVarDescriptors : public RawObject {
721 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors); 748 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors);
722 749
723 struct VarInfo { 750 struct VarInfo {
724 intptr_t index; // Slot index on stack or in context. 751 intptr_t index; // Slot index on stack or in context.
725 intptr_t scope_id; // Scope to which the variable belongs. 752 intptr_t scope_id; // Scope to which the variable belongs.
726 intptr_t begin_pos; // Token position of scope start. 753 intptr_t begin_pos; // Token position of scope start.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 RawSmi* length_; 1051 RawSmi* length_;
1025 // Variable length data follows here. 1052 // Variable length data follows here.
1026 RawObject** data() { 1053 RawObject** data() {
1027 uword address_of_length = reinterpret_cast<uword>(&length_); 1054 uword address_of_length = reinterpret_cast<uword>(&length_);
1028 return reinterpret_cast<RawObject**>(address_of_length + kWordSize); 1055 return reinterpret_cast<RawObject**>(address_of_length + kWordSize);
1029 } 1056 }
1030 RawObject** to(intptr_t length) { 1057 RawObject** to(intptr_t length) {
1031 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]); 1058 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]);
1032 } 1059 }
1033 1060
1061 // Private helper functions used while visiting stack frames during
1062 // GC. The code which iterates over dart frames during GC is not
1063 // allowed to create handles.
1064 intptr_t Length() const;
1065 RawObject* DataAt(intptr_t index) const { return ptr()->data()[index]; }
1066
1067 friend class RawCode;
1034 friend class RawImmutableArray; 1068 friend class RawImmutableArray;
1035 friend class SnapshotReader; 1069 friend class SnapshotReader;
1036 friend class GrowableObjectArray; 1070 friend class GrowableObjectArray;
1037 }; 1071 };
1038 1072
1039 1073
1040 class RawImmutableArray : public RawArray { 1074 class RawImmutableArray : public RawArray {
1041 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); 1075 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray);
1042 1076
1043 friend class SnapshotReader; 1077 friend class SnapshotReader;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 intptr_t type_; // Uninitialized, simple or complex. 1198 intptr_t type_; // Uninitialized, simple or complex.
1165 intptr_t flags_; // Represents global/local, case insensitive, multiline. 1199 intptr_t flags_; // Represents global/local, case insensitive, multiline.
1166 1200
1167 // Variable length data follows here. 1201 // Variable length data follows here.
1168 uint8_t data_[0]; 1202 uint8_t data_[0];
1169 }; 1203 };
1170 1204
1171 } // namespace dart 1205 } // namespace dart
1172 1206
1173 #endif // VM_RAW_OBJECT_H_ 1207 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698