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

Side by Side 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, 3 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
« no previous file with comments | « no previous file | runtime/vm/scavenger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 }; 286 };
287 287
288 class ClassIdTag : 288 class ClassIdTag :
289 public BitField<intptr_t, kClassIdTagPos, kClassIdTagSize> {}; // NOLINT 289 public BitField<intptr_t, kClassIdTagPos, kClassIdTagSize> {}; // NOLINT
290 290
291 bool IsHeapObject() const { 291 bool IsHeapObject() const {
292 uword value = reinterpret_cast<uword>(this); 292 uword value = reinterpret_cast<uword>(this);
293 return (value & kSmiTagMask) == kHeapObjectTag; 293 return (value & kSmiTagMask) == kHeapObjectTag;
294 } 294 }
295 295 // Assumes this is a heap object.
296 bool IsNewObject() const { 296 bool IsNewObject() const {
297 ASSERT(IsHeapObject()); 297 ASSERT(IsHeapObject());
298 uword addr = reinterpret_cast<uword>(this); 298 uword addr = reinterpret_cast<uword>(this);
299 return (addr & kNewObjectAlignmentOffset) == kNewObjectAlignmentOffset; 299 return (addr & kNewObjectAlignmentOffset) == kNewObjectAlignmentOffset;
300 } 300 }
301 // Assumes this is a heap object.
301 bool IsOldObject() const { 302 bool IsOldObject() const {
302 ASSERT(IsHeapObject()); 303 ASSERT(IsHeapObject());
303 uword addr = reinterpret_cast<uword>(this); 304 uword addr = reinterpret_cast<uword>(this);
304 return (addr & kNewObjectAlignmentOffset) == kOldObjectAlignmentOffset; 305 return (addr & kNewObjectAlignmentOffset) == kOldObjectAlignmentOffset;
305 } 306 }
307 // Assumes this is a heap object.
306 bool IsVMHeapObject() const; 308 bool IsVMHeapObject() const;
307 309
310 // Like !IsHeapObject() || IsOldObject(), but compiles to a single branch.
311 bool IsSmiOrOldObject() const {
312 COMPILE_ASSERT(kHeapObjectTag == 1);
313 COMPILE_ASSERT(kNewObjectAlignmentOffset == kWordSize);
314 static const uword kNewObjectBits =
315 (kNewObjectAlignmentOffset | kHeapObjectTag);
316 const uword addr = reinterpret_cast<uword>(this);
317 return (addr & kNewObjectBits) != kNewObjectBits;
318 }
319
308 // Support for GC marking bit. 320 // Support for GC marking bit.
309 bool IsMarked() const { 321 bool IsMarked() const {
310 return MarkBit::decode(ptr()->tags_); 322 return MarkBit::decode(ptr()->tags_);
311 } 323 }
312 void SetMarkBit() { 324 void SetMarkBit() {
313 ASSERT(!IsMarked()); 325 ASSERT(!IsMarked());
314 uword tags = ptr()->tags_; 326 uword tags = ptr()->tags_;
315 ptr()->tags_ = MarkBit::update(true, tags); 327 ptr()->tags_ = MarkBit::update(true, tags);
316 } 328 }
317 void ClearMarkBit() { 329 void ClearMarkBit() {
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 1997 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
1986 kTypedDataInt8ArrayViewCid + 15); 1998 kTypedDataInt8ArrayViewCid + 15);
1987 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 1999 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
1988 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2000 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
1989 return (kNullCid - kTypedDataInt8ArrayCid); 2001 return (kNullCid - kTypedDataInt8ArrayCid);
1990 } 2002 }
1991 2003
1992 } // namespace dart 2004 } // namespace dart
1993 2005
1994 #endif // VM_RAW_OBJECT_H_ 2006 #endif // VM_RAW_OBJECT_H_
OLDNEW
« 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