| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "liveobjectlist-inl.h" | 30 #include "liveobjectlist-inl.h" |
| 31 #include "macro-assembler.h" | 31 #include "macro-assembler.h" |
| 32 #include "mark-compact.h" | 32 #include "mark-compact.h" |
| 33 #include "platform.h" | 33 #include "platform.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 // For contiguous spaces, top should be in the space (or at the end) and limit | |
| 39 // should be the end of the space. | |
| 40 #define ASSERT_SEMISPACE_ALLOCATION_INFO(info, space) \ | |
| 41 ASSERT((space).low() <= (info).top \ | |
| 42 && (info).top <= (space).high() \ | |
| 43 && (info).limit == (space).high()) | |
| 44 | |
| 45 // ---------------------------------------------------------------------------- | 38 // ---------------------------------------------------------------------------- |
| 46 // HeapObjectIterator | 39 // HeapObjectIterator |
| 47 | 40 |
| 48 HeapObjectIterator::HeapObjectIterator(PagedSpace* space) { | 41 HeapObjectIterator::HeapObjectIterator(PagedSpace* space) { |
| 49 // You can't actually iterate over the anchor page. It is not a real page, | 42 // You can't actually iterate over the anchor page. It is not a real page, |
| 50 // just an anchor for the double linked page list. Initialize as if we have | 43 // just an anchor for the double linked page list. Initialize as if we have |
| 51 // reached the end of the anchor page, then the first iteration will move on | 44 // reached the end of the anchor page, then the first iteration will move on |
| 52 // to the first page. | 45 // to the first page. |
| 53 Initialize(space, | 46 Initialize(space, |
| 54 NULL, | 47 NULL, |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 initial_semispace_capacity, | 834 initial_semispace_capacity, |
| 842 maximum_semispace_capacity)) { | 835 maximum_semispace_capacity)) { |
| 843 return false; | 836 return false; |
| 844 } | 837 } |
| 845 | 838 |
| 846 start_ = chunk_base_; | 839 start_ = chunk_base_; |
| 847 address_mask_ = ~(2 * maximum_semispace_capacity - 1); | 840 address_mask_ = ~(2 * maximum_semispace_capacity - 1); |
| 848 object_mask_ = address_mask_ | kHeapObjectTagMask; | 841 object_mask_ = address_mask_ | kHeapObjectTagMask; |
| 849 object_expected_ = reinterpret_cast<uintptr_t>(start_) | kHeapObjectTag; | 842 object_expected_ = reinterpret_cast<uintptr_t>(start_) | kHeapObjectTag; |
| 850 | 843 |
| 851 allocation_info_.top = to_space_.low(); | 844 ResetAllocationInfo(); |
| 852 allocation_info_.limit = to_space_.high(); | |
| 853 | 845 |
| 854 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); | |
| 855 return true; | 846 return true; |
| 856 } | 847 } |
| 857 | 848 |
| 858 | 849 |
| 859 void NewSpace::TearDown() { | 850 void NewSpace::TearDown() { |
| 860 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 851 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
| 861 if (allocated_histogram_) { | 852 if (allocated_histogram_) { |
| 862 DeleteArray(allocated_histogram_); | 853 DeleteArray(allocated_histogram_); |
| 863 allocated_histogram_ = NULL; | 854 allocated_histogram_ = NULL; |
| 864 } | 855 } |
| (...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { | 2130 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { |
| 2140 if (obj->IsCode()) { | 2131 if (obj->IsCode()) { |
| 2141 Code* code = Code::cast(obj); | 2132 Code* code = Code::cast(obj); |
| 2142 code_kind_statistics[code->kind()] += code->Size(); | 2133 code_kind_statistics[code->kind()] += code->Size(); |
| 2143 } | 2134 } |
| 2144 } | 2135 } |
| 2145 } | 2136 } |
| 2146 #endif // DEBUG | 2137 #endif // DEBUG |
| 2147 | 2138 |
| 2148 } } // namespace v8::internal | 2139 } } // namespace v8::internal |
| OLD | NEW |