OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) == | 2006 return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) == |
2007 kObjectStartOffset; | 2007 kObjectStartOffset; |
2008 } | 2008 } |
2009 | 2009 |
2010 static bool IsAtEnd(Address addr) { | 2010 static bool IsAtEnd(Address addr) { |
2011 return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) == 0; | 2011 return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) == 0; |
2012 } | 2012 } |
2013 | 2013 |
2014 Address address() { return reinterpret_cast<Address>(this); } | 2014 Address address() { return reinterpret_cast<Address>(this); } |
2015 | 2015 |
2016 // Finds the NewSpacePage containg the given address. | 2016 // Finds the NewSpacePage containing the given address. |
2017 static inline NewSpacePage* FromAddress(Address address_in_page) { | 2017 static inline NewSpacePage* FromAddress(Address address_in_page) { |
2018 Address page_start = | 2018 Address page_start = |
2019 reinterpret_cast<Address>(reinterpret_cast<uintptr_t>(address_in_page) & | 2019 reinterpret_cast<Address>(reinterpret_cast<uintptr_t>(address_in_page) & |
2020 ~Page::kPageAlignmentMask); | 2020 ~Page::kPageAlignmentMask); |
2021 NewSpacePage* page = reinterpret_cast<NewSpacePage*>(page_start); | 2021 NewSpacePage* page = reinterpret_cast<NewSpacePage*>(page_start); |
2022 return page; | 2022 return page; |
2023 } | 2023 } |
2024 | 2024 |
2025 // Find the page for a limit address. A limit address is either an address | 2025 // Find the page for a limit address. A limit address is either an address |
2026 // inside a page, or the address right after the last byte of a page. | 2026 // inside a page, or the address right after the last byte of a page. |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2873 count = 0; | 2873 count = 0; |
2874 } | 2874 } |
2875 // Must be small, since an iteration is used for lookup. | 2875 // Must be small, since an iteration is used for lookup. |
2876 static const int kMaxComments = 64; | 2876 static const int kMaxComments = 64; |
2877 }; | 2877 }; |
2878 #endif | 2878 #endif |
2879 } | 2879 } |
2880 } // namespace v8::internal | 2880 } // namespace v8::internal |
2881 | 2881 |
2882 #endif // V8_HEAP_SPACES_H_ | 2882 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |