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 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 NewSpacePage* page = reinterpret_cast<NewSpacePage*>(page_start); | 2054 NewSpacePage* page = reinterpret_cast<NewSpacePage*>(page_start); |
2055 return page; | 2055 return page; |
2056 } | 2056 } |
2057 | 2057 |
2058 // Find the page for a limit address. A limit address is either an address | 2058 // Find the page for a limit address. A limit address is either an address |
2059 // inside a page, or the address right after the last byte of a page. | 2059 // inside a page, or the address right after the last byte of a page. |
2060 static inline NewSpacePage* FromLimit(Address address_limit) { | 2060 static inline NewSpacePage* FromLimit(Address address_limit) { |
2061 return NewSpacePage::FromAddress(address_limit - 1); | 2061 return NewSpacePage::FromAddress(address_limit - 1); |
2062 } | 2062 } |
2063 | 2063 |
| 2064 // Checks if address1 and address2 are on the same new space page. |
| 2065 static inline bool OnSamePage(Address address1, Address address2) { |
| 2066 return NewSpacePage::FromAddress(address1) == |
| 2067 NewSpacePage::FromAddress(address2); |
| 2068 } |
| 2069 |
2064 private: | 2070 private: |
2065 // Create a NewSpacePage object that is only used as anchor | 2071 // Create a NewSpacePage object that is only used as anchor |
2066 // for the doubly-linked list of real pages. | 2072 // for the doubly-linked list of real pages. |
2067 explicit NewSpacePage(SemiSpace* owner) { | 2073 explicit NewSpacePage(SemiSpace* owner) { |
2068 InitializeAsAnchor(owner); | 2074 InitializeAsAnchor(owner); |
2069 } | 2075 } |
2070 | 2076 |
2071 static NewSpacePage* Initialize(Heap* heap, | 2077 static NewSpacePage* Initialize(Heap* heap, |
2072 Address start, | 2078 Address start, |
2073 SemiSpace* semi_space); | 2079 SemiSpace* semi_space); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 Address top() { | 2454 Address top() { |
2449 ASSERT(to_space_.current_page()->ContainsLimit(allocation_info_.top())); | 2455 ASSERT(to_space_.current_page()->ContainsLimit(allocation_info_.top())); |
2450 return allocation_info_.top(); | 2456 return allocation_info_.top(); |
2451 } | 2457 } |
2452 | 2458 |
2453 void set_top(Address top) { | 2459 void set_top(Address top) { |
2454 ASSERT(to_space_.current_page()->ContainsLimit(top)); | 2460 ASSERT(to_space_.current_page()->ContainsLimit(top)); |
2455 allocation_info_.set_top(top); | 2461 allocation_info_.set_top(top); |
2456 } | 2462 } |
2457 | 2463 |
| 2464 // Return the address of the allocation pointer limit in the active semispace. |
| 2465 Address limit() { |
| 2466 ASSERT(to_space_.current_page()->ContainsLimit(allocation_info_.limit())); |
| 2467 return allocation_info_.limit(); |
| 2468 } |
| 2469 |
2458 // Return the address of the first object in the active semispace. | 2470 // Return the address of the first object in the active semispace. |
2459 Address bottom() { return to_space_.space_start(); } | 2471 Address bottom() { return to_space_.space_start(); } |
2460 | 2472 |
2461 // Get the age mark of the inactive semispace. | 2473 // Get the age mark of the inactive semispace. |
2462 Address age_mark() { return from_space_.age_mark(); } | 2474 Address age_mark() { return from_space_.age_mark(); } |
2463 // Set the age mark in the active semispace. | 2475 // Set the age mark in the active semispace. |
2464 void set_age_mark(Address mark) { to_space_.set_age_mark(mark); } | 2476 void set_age_mark(Address mark) { to_space_.set_age_mark(mark); } |
2465 | 2477 |
2466 // The start address of the space and a bit mask. Anding an address in the | 2478 // The start address of the space and a bit mask. Anding an address in the |
2467 // new space with the mask will result in the start address. | 2479 // new space with the mask will result in the start address. |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2930 } | 2942 } |
2931 // Must be small, since an iteration is used for lookup. | 2943 // Must be small, since an iteration is used for lookup. |
2932 static const int kMaxComments = 64; | 2944 static const int kMaxComments = 64; |
2933 }; | 2945 }; |
2934 #endif | 2946 #endif |
2935 | 2947 |
2936 | 2948 |
2937 } } // namespace v8::internal | 2949 } } // namespace v8::internal |
2938 | 2950 |
2939 #endif // V8_SPACES_H_ | 2951 #endif // V8_SPACES_H_ |
OLD | NEW |