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

Side by Side Diff: src/spaces.h

Issue 5745005: Provide baseline GC version. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 2056
2057 // ----------------------------------------------------------------------------- 2057 // -----------------------------------------------------------------------------
2058 // Old space for all map objects 2058 // Old space for all map objects
2059 2059
2060 class MapSpace : public FixedSpace { 2060 class MapSpace : public FixedSpace {
2061 public: 2061 public:
2062 // Creates a map space object with a maximum capacity. 2062 // Creates a map space object with a maximum capacity.
2063 MapSpace(intptr_t max_capacity, int max_map_space_pages, AllocationSpace id) 2063 MapSpace(intptr_t max_capacity, int max_map_space_pages, AllocationSpace id)
2064 : FixedSpace(max_capacity, id, Map::kSize, "map"), 2064 : FixedSpace(max_capacity, id, Map::kSize, "map"),
2065 max_map_space_pages_(max_map_space_pages) { 2065 max_map_space_pages_(max_map_space_pages) {
2066 #ifndef BASELINE_GC
2066 ASSERT(max_map_space_pages < kMaxMapPageIndex); 2067 ASSERT(max_map_space_pages < kMaxMapPageIndex);
2068 #endif
2067 } 2069 }
2068 2070
2069 // Prepares for a mark-compact GC. 2071 // Prepares for a mark-compact GC.
2070 virtual void PrepareForMarkCompact(bool will_compact); 2072 virtual void PrepareForMarkCompact(bool will_compact);
2071 2073
2072 // Given an index, returns the page address. 2074 // Given an index, returns the page address.
2075 #ifndef BASELINE_GC
2073 Address PageAddress(int page_index) { return page_addresses_[page_index]; } 2076 Address PageAddress(int page_index) { return page_addresses_[page_index]; }
2074 2077
2075 static const int kMaxMapPageIndex = 1 << MapWord::kMapPageIndexBits; 2078 static const int kMaxMapPageIndex = 1 << MapWord::kMapPageIndexBits;
2079 #else
2080 static const int kMaxMapPageIndex = 1 << 16;
2081 #endif
2076 2082
2077 // Are map pointers encodable into map word? 2083 // Are map pointers encodable into map word?
2078 bool MapPointersEncodable() { 2084 bool MapPointersEncodable() {
2085 #ifndef BASELINE_GC
2079 if (!FLAG_use_big_map_space) { 2086 if (!FLAG_use_big_map_space) {
2080 ASSERT(CountPagesToTop() <= kMaxMapPageIndex); 2087 ASSERT(CountPagesToTop() <= kMaxMapPageIndex);
2081 return true; 2088 return true;
2082 } 2089 }
2083 return CountPagesToTop() <= max_map_space_pages_; 2090 return CountPagesToTop() <= max_map_space_pages_;
2091 #else
2092 return false;
2093 #endif
2084 } 2094 }
2085 2095
2086 // Should be called after forced sweep to find out if map space needs 2096 // Should be called after forced sweep to find out if map space needs
2087 // compaction. 2097 // compaction.
2088 bool NeedsCompaction(int live_maps) { 2098 bool NeedsCompaction(int live_maps) {
2089 return !MapPointersEncodable() && live_maps <= CompactionThreshold(); 2099 return !MapPointersEncodable() && live_maps <= CompactionThreshold();
2090 } 2100 }
2091 2101
2092 Address TopAfterCompaction(int live_maps) { 2102 Address TopAfterCompaction(int live_maps) {
2093 ASSERT(NeedsCompaction(live_maps)); 2103 ASSERT(NeedsCompaction(live_maps));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 private: 2154 private:
2145 static const int kMapsPerPage = Page::kObjectAreaSize / Map::kSize; 2155 static const int kMapsPerPage = Page::kObjectAreaSize / Map::kSize;
2146 2156
2147 // Do map space compaction if there is a page gap. 2157 // Do map space compaction if there is a page gap.
2148 int CompactionThreshold() { 2158 int CompactionThreshold() {
2149 return kMapsPerPage * (max_map_space_pages_ - 1); 2159 return kMapsPerPage * (max_map_space_pages_ - 1);
2150 } 2160 }
2151 2161
2152 const int max_map_space_pages_; 2162 const int max_map_space_pages_;
2153 2163
2164 #ifndef BASELINE_GC
2154 // An array of page start address in a map space. 2165 // An array of page start address in a map space.
2155 Address page_addresses_[kMaxMapPageIndex]; 2166 Address page_addresses_[kMaxMapPageIndex];
2167 #endif
2156 2168
2157 public: 2169 public:
2158 TRACK_MEMORY("MapSpace") 2170 TRACK_MEMORY("MapSpace")
2159 }; 2171 };
2160 2172
2161 2173
2162 // ----------------------------------------------------------------------------- 2174 // -----------------------------------------------------------------------------
2163 // Old space for all global object property cell objects 2175 // Old space for all global object property cell objects
2164 2176
2165 class CellSpace : public FixedSpace { 2177 class CellSpace : public FixedSpace {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 2360
2349 private: 2361 private:
2350 LargeObjectChunk* current_; 2362 LargeObjectChunk* current_;
2351 HeapObjectCallback size_func_; 2363 HeapObjectCallback size_func_;
2352 }; 2364 };
2353 2365
2354 2366
2355 } } // namespace v8::internal 2367 } } // namespace v8::internal
2356 2368
2357 #endif // V8_SPACES_H_ 2369 #endif // V8_SPACES_H_
OLDNEW
« src/ia32/codegen-ia32.cc ('K') | « src/objects-inl.h ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698