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

Side by Side Diff: runtime/vm/scavenger.cc

Issue 14648004: - Remove kFreeBit, as it is not needed any longer (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #include "vm/scavenger.h" 5 #include "vm/scavenger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
11 #include "vm/dart.h" 11 #include "vm/dart.h"
12 #include "vm/dart_api_state.h" 12 #include "vm/dart_api_state.h"
13 #include "vm/isolate.h" 13 #include "vm/isolate.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #include "vm/stack_frame.h" 15 #include "vm/stack_frame.h"
16 #include "vm/store_buffer.h" 16 #include "vm/store_buffer.h"
17 #include "vm/verifier.h" 17 #include "vm/verifier.h"
18 #include "vm/visitor.h" 18 #include "vm/visitor.h"
19 19
20 namespace dart { 20 namespace dart {
21 21
22 // Scavenger uses RawObject::kFreeBit to distinguish forwaded and non-forwarded 22 // Scavenger uses RawObject::kMarkBit to distinguish forwaded and non-forwarded
23 // objects because scavenger can never encounter free list element during 23 // objects because scavenger can never encounter free list element during
Vyacheslav Egorov (Google) 2013/04/30 14:36:01 this comment is out of date (mentions free lists a
Ivan Posva 2013/04/30 15:03:53 Simplified comment.
24 // evacuation and thus all objects scavenger encounters have 24 // evacuation and thus all objects scavenger encounters have
25 // kFreeBit cleared. 25 // kFreeBit cleared.
26 enum { 26 enum {
27 kForwardingMask = 1, 27 kForwardingMask = 1 << RawObject::kMarkBit,
28 kNotForwarded = 0, 28 kNotForwarded = 0,
29 kForwarded = 1, 29 kForwarded = kForwardingMask,
30 }; 30 };
31 31
32 32
33 static inline bool IsForwarding(uword header) { 33 static inline bool IsForwarding(uword header) {
34 uword bits = header & kForwardingMask; 34 uword bits = header & kForwardingMask;
35 ASSERT((bits == kNotForwarded) || (bits == kForwarded)); 35 ASSERT((bits == kNotForwarded) || (bits == kForwarded));
36 return bits == kForwarded; 36 return bits == kForwarded;
37 } 37 }
38 38
39 39
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 }; 292 };
293 293
294 294
295 Scavenger::Scavenger(Heap* heap, intptr_t max_capacity, uword object_alignment) 295 Scavenger::Scavenger(Heap* heap, intptr_t max_capacity, uword object_alignment)
296 : heap_(heap), 296 : heap_(heap),
297 object_alignment_(object_alignment), 297 object_alignment_(object_alignment),
298 scavenging_(false) { 298 scavenging_(false) {
299 // Verify assumptions about the first word in objects which the scavenger is 299 // Verify assumptions about the first word in objects which the scavenger is
300 // going to use for forwarding pointers. 300 // going to use for forwarding pointers.
301 ASSERT(Object::tags_offset() == 0); 301 ASSERT(Object::tags_offset() == 0);
302 ASSERT(kForwardingMask == (1 << RawObject::kFreeBit));
303 302
304 // Allocate the virtual memory for this scavenge heap. 303 // Allocate the virtual memory for this scavenge heap.
305 space_ = VirtualMemory::Reserve(max_capacity); 304 space_ = VirtualMemory::Reserve(max_capacity);
306 if (space_ == NULL) { 305 if (space_ == NULL) {
307 FATAL("Out of memory.\n"); 306 FATAL("Out of memory.\n");
308 } 307 }
309 308
310 // Allocate the entire space at the beginning. 309 // Allocate the entire space at the beginning.
311 space_->Commit(false); 310 space_->Commit(false);
312 311
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 PeerTable::iterator it = peer_table_.find(raw_obj); 673 PeerTable::iterator it = peer_table_.find(raw_obj);
675 return (it == peer_table_.end()) ? NULL : it->second; 674 return (it == peer_table_.end()) ? NULL : it->second;
676 } 675 }
677 676
678 677
679 int64_t Scavenger::PeerCount() const { 678 int64_t Scavenger::PeerCount() const {
680 return static_cast<int64_t>(peer_table_.size()); 679 return static_cast<int64_t>(peer_table_.size());
681 } 680 }
682 681
683 } // namespace dart 682 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | runtime/vm/snapshot.cc » ('j') | runtime/vm/snapshot.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698