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

Side by Side Diff: src/spaces.h

Issue 7350014: Remove the ability to compile without logging and profiling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 years, 5 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/serialize.cc ('k') | src/spaces.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 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 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 #endif 1240 #endif
1241 private: 1241 private:
1242 1242
1243 // Returns a pointer to the page of the relocation pointer. 1243 // Returns a pointer to the page of the relocation pointer.
1244 Page* MCRelocationTopPage() { return TopPageOf(mc_forwarding_info_); } 1244 Page* MCRelocationTopPage() { return TopPageOf(mc_forwarding_info_); }
1245 1245
1246 friend class PageIterator; 1246 friend class PageIterator;
1247 }; 1247 };
1248 1248
1249 1249
1250 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
1251 class NumberAndSizeInfo BASE_EMBEDDED { 1250 class NumberAndSizeInfo BASE_EMBEDDED {
1252 public: 1251 public:
1253 NumberAndSizeInfo() : number_(0), bytes_(0) {} 1252 NumberAndSizeInfo() : number_(0), bytes_(0) {}
1254 1253
1255 int number() const { return number_; } 1254 int number() const { return number_; }
1256 void increment_number(int num) { number_ += num; } 1255 void increment_number(int num) { number_ += num; }
1257 1256
1258 int bytes() const { return bytes_; } 1257 int bytes() const { return bytes_; }
1259 void increment_bytes(int size) { bytes_ += size; } 1258 void increment_bytes(int size) { bytes_ += size; }
1260 1259
1261 void clear() { 1260 void clear() {
1262 number_ = 0; 1261 number_ = 0;
1263 bytes_ = 0; 1262 bytes_ = 0;
1264 } 1263 }
1265 1264
1266 private: 1265 private:
1267 int number_; 1266 int number_;
1268 int bytes_; 1267 int bytes_;
1269 }; 1268 };
1270 1269
1271 1270
1272 // HistogramInfo class for recording a single "bar" of a histogram. This 1271 // HistogramInfo class for recording a single "bar" of a histogram. This
1273 // class is used for collecting statistics to print to stdout (when compiled 1272 // class is used for collecting statistics to print to the log file.
1274 // with DEBUG) or to the log file (when compiled with
1275 // ENABLE_LOGGING_AND_PROFILING).
1276 class HistogramInfo: public NumberAndSizeInfo { 1273 class HistogramInfo: public NumberAndSizeInfo {
1277 public: 1274 public:
1278 HistogramInfo() : NumberAndSizeInfo() {} 1275 HistogramInfo() : NumberAndSizeInfo() {}
1279 1276
1280 const char* name() { return name_; } 1277 const char* name() { return name_; }
1281 void set_name(const char* name) { name_ = name; } 1278 void set_name(const char* name) { name_ = name; }
1282 1279
1283 private: 1280 private:
1284 const char* name_; 1281 const char* name_;
1285 }; 1282 };
1286 #endif
1287 1283
1288 1284
1289 // ----------------------------------------------------------------------------- 1285 // -----------------------------------------------------------------------------
1290 // SemiSpace in young generation 1286 // SemiSpace in young generation
1291 // 1287 //
1292 // A semispace is a contiguous chunk of memory. The mark-compact collector 1288 // A semispace is a contiguous chunk of memory. The mark-compact collector
1293 // uses the memory in the from space as a marking stack when tracing live 1289 // uses the memory in the from space as a marking stack when tracing live
1294 // objects. 1290 // objects.
1295 1291
1296 class SemiSpace : public Space { 1292 class SemiSpace : public Space {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 template <typename StringType> 1595 template <typename StringType>
1600 inline void ShrinkStringAtAllocationBoundary(String* string, int len); 1596 inline void ShrinkStringAtAllocationBoundary(String* string, int len);
1601 1597
1602 #ifdef DEBUG 1598 #ifdef DEBUG
1603 // Verify the active semispace. 1599 // Verify the active semispace.
1604 virtual void Verify(); 1600 virtual void Verify();
1605 // Print the active semispace. 1601 // Print the active semispace.
1606 virtual void Print() { to_space_.Print(); } 1602 virtual void Print() { to_space_.Print(); }
1607 #endif 1603 #endif
1608 1604
1609 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
1610 // Iterates the active semispace to collect statistics. 1605 // Iterates the active semispace to collect statistics.
1611 void CollectStatistics(); 1606 void CollectStatistics();
1612 // Reports previously collected statistics of the active semispace. 1607 // Reports previously collected statistics of the active semispace.
1613 void ReportStatistics(); 1608 void ReportStatistics();
1614 // Clears previously collected statistics. 1609 // Clears previously collected statistics.
1615 void ClearHistograms(); 1610 void ClearHistograms();
1616 1611
1617 // Record the allocation or promotion of a heap object. Note that we don't 1612 // Record the allocation or promotion of a heap object. Note that we don't
1618 // record every single allocation, but only those that happen in the 1613 // record every single allocation, but only those that happen in the
1619 // to space during a scavenge GC. 1614 // to space during a scavenge GC.
1620 void RecordAllocation(HeapObject* obj); 1615 void RecordAllocation(HeapObject* obj);
1621 void RecordPromotion(HeapObject* obj); 1616 void RecordPromotion(HeapObject* obj);
1622 #endif
1623 1617
1624 // Return whether the operation succeded. 1618 // Return whether the operation succeded.
1625 bool CommitFromSpaceIfNeeded() { 1619 bool CommitFromSpaceIfNeeded() {
1626 if (from_space_.is_committed()) return true; 1620 if (from_space_.is_committed()) return true;
1627 return from_space_.Commit(); 1621 return from_space_.Commit();
1628 } 1622 }
1629 1623
1630 bool UncommitFromSpace() { 1624 bool UncommitFromSpace() {
1631 if (!from_space_.is_committed()) return true; 1625 if (!from_space_.is_committed()) return true;
1632 return from_space_.Uncommit(); 1626 return from_space_.Uncommit();
1633 } 1627 }
1634 1628
1635 private: 1629 private:
1636 // The semispaces. 1630 // The semispaces.
1637 SemiSpace to_space_; 1631 SemiSpace to_space_;
1638 SemiSpace from_space_; 1632 SemiSpace from_space_;
1639 1633
1640 // Start address and bit mask for containment testing. 1634 // Start address and bit mask for containment testing.
1641 Address start_; 1635 Address start_;
1642 uintptr_t address_mask_; 1636 uintptr_t address_mask_;
1643 uintptr_t object_mask_; 1637 uintptr_t object_mask_;
1644 uintptr_t object_expected_; 1638 uintptr_t object_expected_;
1645 1639
1646 // Allocation pointer and limit for normal allocation and allocation during 1640 // Allocation pointer and limit for normal allocation and allocation during
1647 // mark-compact collection. 1641 // mark-compact collection.
1648 AllocationInfo allocation_info_; 1642 AllocationInfo allocation_info_;
1649 AllocationInfo mc_forwarding_info_; 1643 AllocationInfo mc_forwarding_info_;
1650 1644
1651 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
1652 HistogramInfo* allocated_histogram_; 1645 HistogramInfo* allocated_histogram_;
1653 HistogramInfo* promoted_histogram_; 1646 HistogramInfo* promoted_histogram_;
1654 #endif
1655 1647
1656 // Implementation of AllocateRaw and MCAllocateRaw. 1648 // Implementation of AllocateRaw and MCAllocateRaw.
1657 MUST_USE_RESULT inline MaybeObject* AllocateRawInternal( 1649 MUST_USE_RESULT inline MaybeObject* AllocateRawInternal(
1658 int size_in_bytes, 1650 int size_in_bytes,
1659 AllocationInfo* alloc_info); 1651 AllocationInfo* alloc_info);
1660 1652
1661 friend class SemiSpaceIterator; 1653 friend class SemiSpaceIterator;
1662 1654
1663 public: 1655 public:
1664 TRACK_MEMORY("NewSpace") 1656 TRACK_MEMORY("NewSpace")
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 } 2311 }
2320 // Must be small, since an iteration is used for lookup. 2312 // Must be small, since an iteration is used for lookup.
2321 static const int kMaxComments = 64; 2313 static const int kMaxComments = 64;
2322 }; 2314 };
2323 #endif 2315 #endif
2324 2316
2325 2317
2326 } } // namespace v8::internal 2318 } } // namespace v8::internal
2327 2319
2328 #endif // V8_SPACES_H_ 2320 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/serialize.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698