| OLD | NEW |
| 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 Loading... |
| 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 ASSERT(max_map_space_pages < kMaxMapPageIndex); | 2066 if (!FLAG_new_gc) { |
| 2067 ASSERT(max_map_space_pages < kMaxMapPageIndex); |
| 2068 } |
| 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. |
| 2073 Address PageAddress(int page_index) { return page_addresses_[page_index]; } | 2075 Address PageAddress(int page_index) { return page_addresses_[page_index]; } |
| 2074 | 2076 |
| 2075 static const int kMaxMapPageIndex = 1 << MapWord::kMapPageIndexBits; | 2077 static const int kMaxMapPageIndex = 1 << MapWord::kMapPageIndexBits; |
| 2076 | 2078 |
| 2077 // Are map pointers encodable into map word? | 2079 // Are map pointers encodable into map word? |
| 2078 bool MapPointersEncodable() { | 2080 bool MapPointersEncodable() { |
| 2081 if (FLAG_new_gc) return false; |
| 2082 |
| 2079 if (!FLAG_use_big_map_space) { | 2083 if (!FLAG_use_big_map_space) { |
| 2080 ASSERT(CountPagesToTop() <= kMaxMapPageIndex); | 2084 ASSERT(CountPagesToTop() <= kMaxMapPageIndex); |
| 2081 return true; | 2085 return true; |
| 2082 } | 2086 } |
| 2083 return CountPagesToTop() <= max_map_space_pages_; | 2087 return CountPagesToTop() <= max_map_space_pages_; |
| 2084 } | 2088 } |
| 2085 | 2089 |
| 2086 // Should be called after forced sweep to find out if map space needs | 2090 // Should be called after forced sweep to find out if map space needs |
| 2087 // compaction. | 2091 // compaction. |
| 2088 bool NeedsCompaction(int live_maps) { | 2092 bool NeedsCompaction(int live_maps) { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2348 | 2352 |
| 2349 private: | 2353 private: |
| 2350 LargeObjectChunk* current_; | 2354 LargeObjectChunk* current_; |
| 2351 HeapObjectCallback size_func_; | 2355 HeapObjectCallback size_func_; |
| 2352 }; | 2356 }; |
| 2353 | 2357 |
| 2354 | 2358 |
| 2355 } } // namespace v8::internal | 2359 } } // namespace v8::internal |
| 2356 | 2360 |
| 2357 #endif // V8_SPACES_H_ | 2361 #endif // V8_SPACES_H_ |
| OLD | NEW |