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

Unified Diff: runtime/vm/freelist.h

Issue 10450014: Request for comments on overall approach. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix scavenger and freelist handling Created 8 years, 7 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: runtime/vm/freelist.h
diff --git a/runtime/vm/freelist.h b/runtime/vm/freelist.h
index 64f0574811c49ee13cbf2235338349c61d2ebc13..617976f15883fe1ec8e524c733f0db56b9bd8c06 100644
--- a/runtime/vm/freelist.h
+++ b/runtime/vm/freelist.h
@@ -32,43 +32,31 @@ class FreeListElement {
next_ = addr | 1;
}
- intptr_t Size() const {
- if (class_ == minimal_element_class_) {
- return kObjectAlignment;
- }
- ASSERT(class_ == element_class_);
- return *SizeAddress();
+ intptr_t size() const {
+ return size_;
+ }
+ void set_size(intptr_t size) {
+ size_ = size;
}
static FreeListElement* AsElement(uword addr, intptr_t size);
static bool IsSpecialClass(RawObject* raw_obj) {
- return (raw_obj == minimal_element_class_) || (raw_obj == element_class_);
+ return raw_obj->IsFree();
}
static void InitOnce();
+ static RawClass* freelist_class() {
+ return freelist_class_;
+ }
+
private:
// This layout mirrors the layout of RawObject.
- RawClass* class_;
uword next_;
Ivan Posva 2012/05/26 04:34:46 I don't think this works. How do you plan to itera
Vyacheslav Egorov (Google) 2012/05/26 16:48:22 Yes it does have exactly the same layout as RawObj
+ intptr_t size_;
- // Returns the address of the embedded size.
- intptr_t* SizeAddress() const {
- ASSERT(class_ == element_class_);
- uword addr = reinterpret_cast<uword>(&next_) + kWordSize;
- return reinterpret_cast<intptr_t*>(addr);
- }
-
- // The two fake classe being used by the FreeList to identify free objects in
- // the heap. These can be static and shared between isolates since they
- // contain no per-isolate information. Actually, they need to be static so
- // that they can be used from free list elements efficiently.
- // The minimal_element_class_ is used by minimally sized free list elements
- // which cannot hold the size within the element.
- // element_class_ is used for free lists elements containing a size.
- static RawClass* minimal_element_class_;
- static RawClass* element_class_;
+ static RawClass* freelist_class_;
// FreeListElements cannot be allocated. Instead references to them are
// created using the AsElement factory method.

Powered by Google App Engine
This is Rietveld 408576698