| OLD | NEW |
| 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 #ifndef VM_PAGES_H_ | 5 #ifndef VM_PAGES_H_ |
| 6 #define VM_PAGES_H_ | 6 #define VM_PAGES_H_ |
| 7 | 7 |
| 8 #include "vm/freelist.h" | 8 #include "vm/freelist.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 | 291 |
| 292 void IncrementCollections() { | 292 void IncrementCollections() { |
| 293 collections_++; | 293 collections_++; |
| 294 } | 294 } |
| 295 | 295 |
| 296 intptr_t collections() const { | 296 intptr_t collections() const { |
| 297 return collections_; | 297 return collections_; |
| 298 } | 298 } |
| 299 | 299 |
| 300 void PrintToJSONObject(JSONObject* object); | 300 void PrintToJSONObject(JSONObject* object) const; |
| 301 void PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream); | 301 void PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) const; |
| 302 | 302 |
| 303 void AllocateExternal(intptr_t size); | 303 void AllocateExternal(intptr_t size); |
| 304 void FreeExternal(intptr_t size); | 304 void FreeExternal(intptr_t size); |
| 305 | 305 |
| 306 // Bulk data allocation. | 306 // Bulk data allocation. |
| 307 void AcquireDataLock(); | 307 void AcquireDataLock(); |
| 308 void ReleaseDataLock(); | 308 void ReleaseDataLock(); |
| 309 | 309 |
| 310 uword TryAllocateDataLocked(intptr_t size, GrowthPolicy growth_policy) { | 310 uword TryAllocateDataLocked(intptr_t size, GrowthPolicy growth_policy) { |
| 311 bool is_protected = false; | 311 bool is_protected = false; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 330 uword TryAllocatePromoLocked(intptr_t size, GrowthPolicy growth_policy); | 330 uword TryAllocatePromoLocked(intptr_t size, GrowthPolicy growth_policy); |
| 331 // Allocates memory where every word is guaranteed to be a Smi. Calling this | 331 // Allocates memory where every word is guaranteed to be a Smi. Calling this |
| 332 // method after the first garbage collection is inefficient in release mode | 332 // method after the first garbage collection is inefficient in release mode |
| 333 // and illegal in debug mode. | 333 // and illegal in debug mode. |
| 334 uword TryAllocateSmiInitializedLocked(intptr_t size, | 334 uword TryAllocateSmiInitializedLocked(intptr_t size, |
| 335 GrowthPolicy growth_policy); | 335 GrowthPolicy growth_policy); |
| 336 | 336 |
| 337 // Bump block allocation from generated code. | 337 // Bump block allocation from generated code. |
| 338 uword* TopAddress() { return &bump_top_; } | 338 uword* TopAddress() { return &bump_top_; } |
| 339 uword* EndAddress() { return &bump_end_; } | 339 uword* EndAddress() { return &bump_end_; } |
| 340 static intptr_t top_offset() { return OFFSET_OF(PageSpace, bump_top_); } |
| 341 static intptr_t end_offset() { return OFFSET_OF(PageSpace, bump_end_); } |
| 340 | 342 |
| 341 private: | 343 private: |
| 342 // Ids for time and data records in Heap::GCStats. | 344 // Ids for time and data records in Heap::GCStats. |
| 343 enum { | 345 enum { |
| 344 // Time | 346 // Time |
| 345 kMarkObjects = 0, | 347 kMarkObjects = 0, |
| 346 kResetFreeLists = 1, | 348 kResetFreeLists = 1, |
| 347 kSweepPages = 2, | 349 kSweepPages = 2, |
| 348 kSweepLargePages = 3, | 350 kSweepLargePages = 3, |
| 349 // Data | 351 // Data |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 friend class HeapIterationScope; | 440 friend class HeapIterationScope; |
| 439 friend class PageSpaceController; | 441 friend class PageSpaceController; |
| 440 friend class SweeperTask; | 442 friend class SweeperTask; |
| 441 | 443 |
| 442 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 444 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 443 }; | 445 }; |
| 444 | 446 |
| 445 } // namespace dart | 447 } // namespace dart |
| 446 | 448 |
| 447 #endif // VM_PAGES_H_ | 449 #endif // VM_PAGES_H_ |
| OLD | NEW |