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

Unified Diff: runtime/vm/raw_object.h

Issue 504953002: Optimize "smi or old" filter in scavenger. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « no previous file | runtime/vm/scavenger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.h
===================================================================
--- runtime/vm/raw_object.h (revision 39523)
+++ runtime/vm/raw_object.h (working copy)
@@ -292,19 +292,31 @@
uword value = reinterpret_cast<uword>(this);
return (value & kSmiTagMask) == kHeapObjectTag;
}
-
+ // Assumes this is a heap object.
bool IsNewObject() const {
ASSERT(IsHeapObject());
uword addr = reinterpret_cast<uword>(this);
return (addr & kNewObjectAlignmentOffset) == kNewObjectAlignmentOffset;
}
+ // Assumes this is a heap object.
bool IsOldObject() const {
ASSERT(IsHeapObject());
uword addr = reinterpret_cast<uword>(this);
return (addr & kNewObjectAlignmentOffset) == kOldObjectAlignmentOffset;
}
+ // Assumes this is a heap object.
bool IsVMHeapObject() const;
+ // Like !IsHeapObject() || IsOldObject(), but compiles to a single branch.
+ bool IsSmiOrOldObject() const {
+ COMPILE_ASSERT(kHeapObjectTag == 1);
+ COMPILE_ASSERT(kNewObjectAlignmentOffset == kWordSize);
+ static const uword kNewObjectBits =
+ (kNewObjectAlignmentOffset | kHeapObjectTag);
+ const uword addr = reinterpret_cast<uword>(this);
+ return (addr & kNewObjectBits) != kNewObjectBits;
+ }
+
// Support for GC marking bit.
bool IsMarked() const {
return MarkBit::decode(ptr()->tags_);
« no previous file with comments | « no previous file | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698