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

Side by Side Diff: src/zone.h

Issue 16858018: Make Zone::allocation_size work with parallel zones. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « src/hydrogen.cc ('k') | src/zone.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 // Deletes the last small segment kept around by DeleteAll(). 80 // Deletes the last small segment kept around by DeleteAll().
81 void DeleteKeptSegment(); 81 void DeleteKeptSegment();
82 82
83 // Returns true if more memory has been allocated in zones than 83 // Returns true if more memory has been allocated in zones than
84 // the limit allows. 84 // the limit allows.
85 inline bool excess_allocation(); 85 inline bool excess_allocation();
86 86
87 inline void adjust_segment_bytes_allocated(int delta); 87 inline void adjust_segment_bytes_allocated(int delta);
88 88
89 inline unsigned allocation_size() { return allocation_size_; }
90
89 inline Isolate* isolate() { return isolate_; } 91 inline Isolate* isolate() { return isolate_; }
90 92
91 static unsigned allocation_size_;
92
93 private: 93 private:
94 friend class Isolate; 94 friend class Isolate;
95 friend class ZoneScope; 95 friend class ZoneScope;
96 96
97 // All pointers returned from New() have this alignment. In addition, if the 97 // All pointers returned from New() have this alignment. In addition, if the
98 // object being allocated has a size that is divisible by 8 then its alignment 98 // object being allocated has a size that is divisible by 8 then its alignment
99 // will be 8. 99 // will be 8.
100 static const int kAlignment = kPointerSize; 100 static const int kAlignment = kPointerSize;
101 101
102 // Never allocate segments smaller than this size in bytes. 102 // Never allocate segments smaller than this size in bytes.
103 static const int kMinimumSegmentSize = 8 * KB; 103 static const int kMinimumSegmentSize = 8 * KB;
104 104
105 // Never allocate segments larger than this size in bytes. 105 // Never allocate segments larger than this size in bytes.
106 static const int kMaximumSegmentSize = 1 * MB; 106 static const int kMaximumSegmentSize = 1 * MB;
107 107
108 // Never keep segments larger than this size in bytes around. 108 // Never keep segments larger than this size in bytes around.
109 static const int kMaximumKeptSegmentSize = 64 * KB; 109 static const int kMaximumKeptSegmentSize = 64 * KB;
110 110
111 // Report zone excess when allocation exceeds this limit. 111 // Report zone excess when allocation exceeds this limit.
112 int zone_excess_limit_; 112 int zone_excess_limit_;
113 113
114 // The number of bytes allocated in this zone so far.
115 unsigned allocation_size_;
116
114 // The number of bytes allocated in segments. Note that this number 117 // The number of bytes allocated in segments. Note that this number
115 // includes memory allocated from the OS but not yet allocated from 118 // includes memory allocated from the OS but not yet allocated from
116 // the zone. 119 // the zone.
117 int segment_bytes_allocated_; 120 int segment_bytes_allocated_;
118 121
119 // Expand the Zone to hold at least 'size' more bytes and allocate 122 // Expand the Zone to hold at least 'size' more bytes and allocate
120 // the bytes. Returns the address of the newly allocated chunk of 123 // the bytes. Returns the address of the newly allocated chunk of
121 // memory in the Zone. Should only be called if there isn't enough 124 // memory in the Zone. Should only be called if there isn't enough
122 // room in the Zone already. 125 // room in the Zone already.
123 Address NewExpand(int size); 126 Address NewExpand(int size);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 : SplayTree<Config, ZoneAllocationPolicy>(ZoneAllocationPolicy(zone)) {} 267 : SplayTree<Config, ZoneAllocationPolicy>(ZoneAllocationPolicy(zone)) {}
265 ~ZoneSplayTree(); 268 ~ZoneSplayTree();
266 }; 269 };
267 270
268 271
269 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; 272 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap;
270 273
271 } } // namespace v8::internal 274 } } // namespace v8::internal
272 275
273 #endif // V8_ZONE_H_ 276 #endif // V8_ZONE_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698