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

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

Issue 1584443002: VM: Precompiled rodata snapshot. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: compute string hash if necessary Created 4 years, 10 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/pages.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) 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 13 matching lines...) Expand all
24 class Heap; 24 class Heap;
25 class JSONObject; 25 class JSONObject;
26 class ObjectPointerVisitor; 26 class ObjectPointerVisitor;
27 27
28 // A page containing old generation objects. 28 // A page containing old generation objects.
29 class HeapPage { 29 class HeapPage {
30 public: 30 public:
31 enum PageType { 31 enum PageType {
32 kData = 0, 32 kData = 0,
33 kExecutable, 33 kExecutable,
34 kReadOnlyData,
34 kNumPageTypes 35 kNumPageTypes
35 }; 36 };
36 37
37 HeapPage* next() const { return next_; } 38 HeapPage* next() const { return next_; }
38 void set_next(HeapPage* next) { next_ = next; } 39 void set_next(HeapPage* next) { next_ = next; }
39 40
40 bool Contains(uword addr) { 41 bool Contains(uword addr) {
41 return memory_->Contains(addr); 42 return memory_->Contains(addr);
42 } 43 }
43 44
44 uword object_start() const { 45 uword object_start() const {
45 return memory_->start() + ObjectStartOffset(); 46 return memory_->start() + ObjectStartOffset();
46 } 47 }
47 uword object_end() const { 48 uword object_end() const {
48 return object_end_; 49 return object_end_;
49 } 50 }
50 51
51 PageType type() const { 52 PageType type() const {
52 return executable_ ? kExecutable : kData; 53 return type_;
53 } 54 }
54 55
55 void VisitObjects(ObjectVisitor* visitor) const; 56 void VisitObjects(ObjectVisitor* visitor) const;
56 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; 57 void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
57 58
58 RawObject* FindObject(FindObjectVisitor* visitor) const; 59 RawObject* FindObject(FindObjectVisitor* visitor) const;
59 60
60 void WriteProtect(bool read_only); 61 void WriteProtect(bool read_only);
61 62
62 static intptr_t ObjectStartOffset() { 63 static intptr_t ObjectStartOffset() {
(...skipping 10 matching lines...) Expand all
73 static HeapPage* Initialize(VirtualMemory* memory, PageType type); 74 static HeapPage* Initialize(VirtualMemory* memory, PageType type);
74 static HeapPage* Allocate(intptr_t size_in_words, PageType type); 75 static HeapPage* Allocate(intptr_t size_in_words, PageType type);
75 76
76 // Deallocate the virtual memory backing this page. The page pointer to this 77 // Deallocate the virtual memory backing this page. The page pointer to this
77 // page becomes immediately inaccessible. 78 // page becomes immediately inaccessible.
78 void Deallocate(); 79 void Deallocate();
79 80
80 VirtualMemory* memory_; 81 VirtualMemory* memory_;
81 HeapPage* next_; 82 HeapPage* next_;
82 uword object_end_; 83 uword object_end_;
83 bool executable_; 84 PageType type_;
84 85
85 friend class PageSpace; 86 friend class PageSpace;
86 87
87 DISALLOW_ALLOCATION(); 88 DISALLOW_ALLOCATION();
88 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapPage); 89 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapPage);
89 }; 90 };
90 91
91 92
92 // The history holds the timing information of the last garbage collection 93 // The history holds the timing information of the last garbage collection
93 // runs. 94 // runs.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // and illegal in debug mode. 340 // and illegal in debug mode.
340 uword TryAllocateSmiInitializedLocked(intptr_t size, 341 uword TryAllocateSmiInitializedLocked(intptr_t size,
341 GrowthPolicy growth_policy); 342 GrowthPolicy growth_policy);
342 343
343 // Bump block allocation from generated code. 344 // Bump block allocation from generated code.
344 uword* TopAddress() { return &bump_top_; } 345 uword* TopAddress() { return &bump_top_; }
345 uword* EndAddress() { return &bump_end_; } 346 uword* EndAddress() { return &bump_end_; }
346 static intptr_t top_offset() { return OFFSET_OF(PageSpace, bump_top_); } 347 static intptr_t top_offset() { return OFFSET_OF(PageSpace, bump_top_); }
347 static intptr_t end_offset() { return OFFSET_OF(PageSpace, bump_end_); } 348 static intptr_t end_offset() { return OFFSET_OF(PageSpace, bump_end_); }
348 349
349 void SetupInstructionsSnapshotPage(void* pointer, uword size); 350 void SetupExternalPage(void* pointer, uword size, bool is_executable);
350 351
351 private: 352 private:
352 // Ids for time and data records in Heap::GCStats. 353 // Ids for time and data records in Heap::GCStats.
353 enum { 354 enum {
354 // Time 355 // Time
355 kMarkObjects = 0, 356 kMarkObjects = 0,
356 kResetFreeLists = 1, 357 kResetFreeLists = 1,
357 kSweepPages = 2, 358 kSweepPages = 2,
358 kSweepLargePages = 3, 359 kSweepLargePages = 3,
359 // Data 360 // Data
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 friend class HeapIterationScope; 449 friend class HeapIterationScope;
449 friend class PageSpaceController; 450 friend class PageSpaceController;
450 friend class SweeperTask; 451 friend class SweeperTask;
451 452
452 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); 453 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
453 }; 454 };
454 455
455 } // namespace dart 456 } // namespace dart
456 457
457 #endif // VM_PAGES_H_ 458 #endif // VM_PAGES_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698