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

Side by Side Diff: runtime/vm/pages.h

Issue 511963007: Pretenure some strings into bump-allocated block (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
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 #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/ring_buffer.h" 10 #include "vm/ring_buffer.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 is_protected, is_locked); 296 is_protected, is_locked);
297 } 297 }
298 298
299 Monitor* tasks_lock() const { return tasks_lock_; } 299 Monitor* tasks_lock() const { return tasks_lock_; }
300 intptr_t tasks() const { return tasks_; } 300 intptr_t tasks() const { return tasks_; }
301 void set_tasks(intptr_t val) { 301 void set_tasks(intptr_t val) {
302 ASSERT(val >= 0); 302 ASSERT(val >= 0);
303 tasks_ = val; 303 tasks_ = val;
304 } 304 }
305 305
306 // Attempt to allocate from bump block rather than normal freelist.
307 uword TryAllocateDataBump(intptr_t size, GrowthPolicy growth_policy);
308
306 private: 309 private:
307 // Ids for time and data records in Heap::GCStats. 310 // Ids for time and data records in Heap::GCStats.
308 enum { 311 enum {
309 // Time 312 // Time
310 kMarkObjects = 0, 313 kMarkObjects = 0,
311 kResetFreeLists = 1, 314 kResetFreeLists = 1,
312 kSweepPages = 2, 315 kSweepPages = 2,
313 kSweepLargePages = 3, 316 kSweepLargePages = 3,
314 // Data 317 // Data
315 kGarbageRatio = 0, 318 kGarbageRatio = 0,
316 kGCTimeFraction = 1, 319 kGCTimeFraction = 1,
317 kPageGrowth = 2, 320 kPageGrowth = 2,
318 kAllowedGrowth = 3 321 kAllowedGrowth = 3
319 }; 322 };
320 323
321 static const intptr_t kAllocatablePageSize = 64 * KB; 324 static const intptr_t kAllocatablePageSize = 64 * KB;
322 325
323 uword TryAllocateInternal(intptr_t size, 326 uword TryAllocateInternal(intptr_t size,
324 HeapPage::PageType type, 327 HeapPage::PageType type,
325 GrowthPolicy growth_policy, 328 GrowthPolicy growth_policy,
326 bool is_protected, 329 bool is_protected,
327 bool is_locked); 330 bool is_locked);
331 uword TryAllocateInNewPage(intptr_t size,
332 HeapPage::PageType type,
333 GrowthPolicy growth_policy,
334 bool is_locked);
328 HeapPage* AllocatePage(HeapPage::PageType type); 335 HeapPage* AllocatePage(HeapPage::PageType type);
329 void FreePage(HeapPage* page, HeapPage* previous_page); 336 void FreePage(HeapPage* page, HeapPage* previous_page);
330 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type); 337 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type);
331 void TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes); 338 void TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes);
332 void FreeLargePage(HeapPage* page, HeapPage* previous_page); 339 void FreeLargePage(HeapPage* page, HeapPage* previous_page);
333 void FreePages(HeapPage* pages); 340 void FreePages(HeapPage* pages);
334 HeapPage* NextPageAnySize(HeapPage* page) const { 341 HeapPage* NextPageAnySize(HeapPage* page) const {
335 ASSERT((pages_tail_ == NULL) || (pages_tail_->next() == NULL)); 342 ASSERT((pages_tail_ == NULL) || (pages_tail_->next() == NULL));
336 ASSERT((exec_pages_tail_ == NULL) || (exec_pages_tail_->next() == NULL)); 343 ASSERT((exec_pages_tail_ == NULL) || (exec_pages_tail_->next() == NULL));
337 if (page == pages_tail_) { 344 if (page == pages_tail_) {
(...skipping 13 matching lines...) Expand all
351 358
352 Heap* heap_; 359 Heap* heap_;
353 360
354 Mutex* pages_lock_; 361 Mutex* pages_lock_;
355 HeapPage* pages_; 362 HeapPage* pages_;
356 HeapPage* pages_tail_; 363 HeapPage* pages_tail_;
357 HeapPage* exec_pages_; 364 HeapPage* exec_pages_;
358 HeapPage* exec_pages_tail_; 365 HeapPage* exec_pages_tail_;
359 HeapPage* large_pages_; 366 HeapPage* large_pages_;
360 367
368 // A block of memory in a data page, managed by bump allocation. The remainder
369 // is kept formatted as a FreeListElement, but is not in any freelist.
370 uword bump_top_;
371 uword bump_end_;
372
361 // Various sizes being tracked for this generation. 373 // Various sizes being tracked for this generation.
362 intptr_t max_capacity_in_words_; 374 intptr_t max_capacity_in_words_;
363 SpaceUsage usage_; 375 SpaceUsage usage_;
364 376
365 // Keep track of running MarkSweep tasks. 377 // Keep track of running MarkSweep tasks.
366 Monitor* tasks_lock_; 378 Monitor* tasks_lock_;
367 intptr_t tasks_; 379 intptr_t tasks_;
368 380
369 PageSpaceController page_space_controller_; 381 PageSpaceController page_space_controller_;
370 382
371 int64_t gc_time_micros_; 383 int64_t gc_time_micros_;
372 intptr_t collections_; 384 intptr_t collections_;
373 385
374 friend class PageSpaceController; 386 friend class PageSpaceController;
375 friend class SweeperTask; 387 friend class SweeperTask;
376 388
377 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); 389 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
378 }; 390 };
379 391
380 } // namespace dart 392 } // namespace dart
381 393
382 #endif // VM_PAGES_H_ 394 #endif // VM_PAGES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698