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

Side by Side Diff: src/spaces.h

Issue 7104107: Incremental mode now works for x64. The only difference (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // pointers. This enables some optimizations when marking. 160 // pointers. This enables some optimizations when marking.
161 // It is expected that this field is inlined and turned into control flow 161 // It is expected that this field is inlined and turned into control flow
162 // at the place where the MarkBit object is created. 162 // at the place where the MarkBit object is created.
163 bool data_only_; 163 bool data_only_;
164 }; 164 };
165 165
166 166
167 // Bitmap is a sequence of cells each containing fixed number of bits. 167 // Bitmap is a sequence of cells each containing fixed number of bits.
168 class Bitmap { 168 class Bitmap {
169 public: 169 public:
170 static const uint32_t kBitsPerCell = 32; 170 static const uint32_t kBitsPerCell = 32;
Lasse Reichstein 2011/06/10 13:55:44 kBitsPerInt ?
Erik Corry 2011/06/10 21:57:29 Not really.
171 static const uint32_t kBitsPerCellLog2 = 5; 171 static const uint32_t kBitsPerCellLog2 = 5;
172 static const uint32_t kBitIndexMask = kBitsPerCell - 1; 172 static const uint32_t kBitIndexMask = kBitsPerCell - 1;
173 static const uint32_t kBytesPerCell = kBitsPerCell / 8;
Lasse Reichstein 2011/06/10 13:55:44 8 -> kBitsPerByte
Erik Corry 2011/06/10 21:57:29 Done.
174 static const uint32_t kBytesPerCellLog2 = kBitsPerCellLog2 - 3;
Lasse Reichstein 2011/06/10 13:55:44 3 -> kBitesPerByteLog2
Erik Corry 2011/06/10 21:57:29 Done.
173 175
174 static const size_t kLength = 176 static const size_t kLength =
175 (1 << kPageSizeBits) >> (kPointerSizeLog2); 177 (1 << kPageSizeBits) >> (kPointerSizeLog2);
176 178
177 static const size_t kSize = 179 static const size_t kSize =
178 (1 << kPageSizeBits) >> (kPointerSizeLog2 + kBitsPerByteLog2); 180 (1 << kPageSizeBits) >> (kPointerSizeLog2 + kBitsPerByteLog2);
179 181
180 182
181 static int CellsForLength(int length) { 183 static int CellsForLength(int length) {
182 return (length + kBitsPerCell - 1) >> kBitsPerCellLog2; 184 return (length + kBitsPerCell - 1) >> kBitsPerCellLog2;
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 // Identity used in error reporting. 648 // Identity used in error reporting.
647 AllocationSpace identity() { return id_; } 649 AllocationSpace identity() { return id_; }
648 650
649 // Returns allocated size. 651 // Returns allocated size.
650 virtual intptr_t Size() = 0; 652 virtual intptr_t Size() = 0;
651 653
652 // Returns size of objects. Can differ from the allocated size 654 // Returns size of objects. Can differ from the allocated size
653 // (e.g. see LargeObjectSpace). 655 // (e.g. see LargeObjectSpace).
654 virtual intptr_t SizeOfObjects() { return Size(); } 656 virtual intptr_t SizeOfObjects() { return Size(); }
655 657
658 virtual int RoundSizeDownToObjectAlignment(int size) {
659 if (id_ == CODE_SPACE) {
660 return RoundDown(size, kCodeAlignment);
661 } else {
662 return RoundDown(size, kPointerSize);
663 }
664 }
665
656 #ifdef ENABLE_HEAP_PROTECTION 666 #ifdef ENABLE_HEAP_PROTECTION
657 // Protect/unprotect the space by marking it read-only/writable. 667 // Protect/unprotect the space by marking it read-only/writable.
658 virtual void Protect() = 0; 668 virtual void Protect() = 0;
659 virtual void Unprotect() = 0; 669 virtual void Unprotect() = 0;
660 #endif 670 #endif
661 671
662 #ifdef DEBUG 672 #ifdef DEBUG
663 virtual void Print() = 0; 673 virtual void Print() = 0;
664 #endif 674 #endif
665 675
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 bool MapPointersEncodable() { 2204 bool MapPointersEncodable() {
2195 return false; 2205 return false;
2196 } 2206 }
2197 2207
2198 // Should be called after forced sweep to find out if map space needs 2208 // Should be called after forced sweep to find out if map space needs
2199 // compaction. 2209 // compaction.
2200 bool NeedsCompaction(int live_maps) { 2210 bool NeedsCompaction(int live_maps) {
2201 return false; // TODO(gc): Bring back map compaction. 2211 return false; // TODO(gc): Bring back map compaction.
2202 } 2212 }
2203 2213
2214 virtual int RoundSizeDownToObjectAlignment(int size) {
2215 if (IsPowerOf2(Map::kSize)) {
2216 return RoundDown(size, Map::kSize);
2217 } else {
2218 return (size / Map::kSize) * Map::kSize;
2219 }
2220 }
2221
2204 protected: 2222 protected:
2205 #ifdef DEBUG 2223 #ifdef DEBUG
2206 virtual void VerifyObject(HeapObject* obj); 2224 virtual void VerifyObject(HeapObject* obj);
2207 #endif 2225 #endif
2208 2226
2209 private: 2227 private:
2210 static const int kMapsPerPage = Page::kObjectAreaSize / Map::kSize; 2228 static const int kMapsPerPage = Page::kObjectAreaSize / Map::kSize;
2211 2229
2212 // Do map space compaction if there is a page gap. 2230 // Do map space compaction if there is a page gap.
2213 int CompactionThreshold() { 2231 int CompactionThreshold() {
(...skipping 10 matching lines...) Expand all
2224 // ----------------------------------------------------------------------------- 2242 // -----------------------------------------------------------------------------
2225 // Old space for all global object property cell objects 2243 // Old space for all global object property cell objects
2226 2244
2227 class CellSpace : public FixedSpace { 2245 class CellSpace : public FixedSpace {
2228 public: 2246 public:
2229 // Creates a property cell space object with a maximum capacity. 2247 // Creates a property cell space object with a maximum capacity.
2230 CellSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id) 2248 CellSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id)
2231 : FixedSpace(heap, max_capacity, id, JSGlobalPropertyCell::kSize, "cell") 2249 : FixedSpace(heap, max_capacity, id, JSGlobalPropertyCell::kSize, "cell")
2232 {} 2250 {}
2233 2251
2252 virtual int RoundSizeDownToObjectAlignment(int size) {
2253 if (IsPowerOf2(JSGlobalPropertyCell::kSize)) {
2254 return RoundDown(size, JSGlobalPropertyCell::kSize);
2255 } else {
2256 return (size / JSGlobalPropertyCell::kSize) * JSGlobalPropertyCell::kSize;
2257 }
2258 }
2259
2234 protected: 2260 protected:
2235 #ifdef DEBUG 2261 #ifdef DEBUG
2236 virtual void VerifyObject(HeapObject* obj); 2262 virtual void VerifyObject(HeapObject* obj);
2237 #endif 2263 #endif
2238 2264
2239 public: 2265 public:
2240 TRACK_MEMORY("CellSpace") 2266 TRACK_MEMORY("CellSpace")
2241 }; 2267 };
2242 2268
2243 2269
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 } 2464 }
2439 // Must be small, since an iteration is used for lookup. 2465 // Must be small, since an iteration is used for lookup.
2440 static const int kMaxComments = 64; 2466 static const int kMaxComments = 64;
2441 }; 2467 };
2442 #endif 2468 #endif
2443 2469
2444 2470
2445 } } // namespace v8::internal 2471 } } // namespace v8::internal
2446 2472
2447 #endif // V8_SPACES_H_ 2473 #endif // V8_SPACES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698