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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 // Sets up the semispace using the given chunk. | 997 // Sets up the semispace using the given chunk. |
998 bool Setup(Address start, int initial_capacity, int maximum_capacity); | 998 bool Setup(Address start, int initial_capacity, int maximum_capacity); |
999 | 999 |
1000 // Tear down the space. Heap memory was not allocated by the space, so it | 1000 // Tear down the space. Heap memory was not allocated by the space, so it |
1001 // is not deallocated here. | 1001 // is not deallocated here. |
1002 void TearDown(); | 1002 void TearDown(); |
1003 | 1003 |
1004 // True if the space has been set up but not torn down. | 1004 // True if the space has been set up but not torn down. |
1005 bool HasBeenSetup() { return start_ != NULL; } | 1005 bool HasBeenSetup() { return start_ != NULL; } |
1006 | 1006 |
1007 // Grow the size of the semispace by committing extra virtual memory. | 1007 // Double the size of the semispace by committing extra virtual memory. |
1008 // Assumes that the caller has checked that the semispace has not reached | 1008 // Assumes that the caller has checked that the semispace has not reached |
1009 // its maximum capacity (and thus there is space available in the reserved | 1009 // its maximum capacity (and thus there is space available in the reserved |
1010 // address range to grow). | 1010 // address range to grow). |
1011 bool Grow(); | 1011 bool Double(); |
1012 | 1012 |
1013 // Returns the start address of the space. | 1013 // Returns the start address of the space. |
1014 Address low() { return start_; } | 1014 Address low() { return start_; } |
1015 // Returns one past the end address of the space. | 1015 // Returns one past the end address of the space. |
1016 Address high() { return low() + capacity_; } | 1016 Address high() { return low() + capacity_; } |
1017 | 1017 |
1018 // Age mark accessors. | 1018 // Age mark accessors. |
1019 Address age_mark() { return age_mark_; } | 1019 Address age_mark() { return age_mark_; } |
1020 void set_age_mark(Address mark) { age_mark_ = mark; } | 1020 void set_age_mark(Address mark) { age_mark_ = mark; } |
1021 | 1021 |
(...skipping 22 matching lines...) Expand all Loading... |
1044 | 1044 |
1045 bool is_committed() { return committed_; } | 1045 bool is_committed() { return committed_; } |
1046 bool Commit(); | 1046 bool Commit(); |
1047 bool Uncommit(); | 1047 bool Uncommit(); |
1048 | 1048 |
1049 #ifdef DEBUG | 1049 #ifdef DEBUG |
1050 virtual void Print(); | 1050 virtual void Print(); |
1051 virtual void Verify(); | 1051 virtual void Verify(); |
1052 #endif | 1052 #endif |
1053 | 1053 |
1054 // Returns the current capacity of the semi space. | |
1055 int Capacity() { return capacity_; } | |
1056 | |
1057 private: | 1054 private: |
1058 // The current and maximum capacity of the space. | 1055 // The current and maximum capacity of the space. |
1059 int capacity_; | 1056 int capacity_; |
1060 int maximum_capacity_; | 1057 int maximum_capacity_; |
1061 | 1058 |
1062 // The start address of the space. | 1059 // The start address of the space. |
1063 Address start_; | 1060 Address start_; |
1064 // Used to govern object promotion during mark-compact collection. | 1061 // Used to govern object promotion during mark-compact collection. |
1065 Address age_mark_; | 1062 Address age_mark_; |
1066 | 1063 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 void TearDown(); | 1137 void TearDown(); |
1141 | 1138 |
1142 // True if the space has been set up but not torn down. | 1139 // True if the space has been set up but not torn down. |
1143 bool HasBeenSetup() { | 1140 bool HasBeenSetup() { |
1144 return to_space_.HasBeenSetup() && from_space_.HasBeenSetup(); | 1141 return to_space_.HasBeenSetup() && from_space_.HasBeenSetup(); |
1145 } | 1142 } |
1146 | 1143 |
1147 // Flip the pair of spaces. | 1144 // Flip the pair of spaces. |
1148 void Flip(); | 1145 void Flip(); |
1149 | 1146 |
1150 // Grow the capacity of the semispaces. Assumes that they are not at | 1147 // Doubles the capacity of the semispaces. Assumes that they are not at |
1151 // their maximum capacity. Returns a flag indicating success or failure. | 1148 // their maximum capacity. Returns a flag indicating success or failure. |
1152 bool Grow(); | 1149 bool Double(); |
1153 | 1150 |
1154 // True if the address or object lies in the address range of either | 1151 // True if the address or object lies in the address range of either |
1155 // semispace (not necessarily below the allocation pointer). | 1152 // semispace (not necessarily below the allocation pointer). |
1156 bool Contains(Address a) { | 1153 bool Contains(Address a) { |
1157 return (reinterpret_cast<uintptr_t>(a) & address_mask_) | 1154 return (reinterpret_cast<uintptr_t>(a) & address_mask_) |
1158 == reinterpret_cast<uintptr_t>(start_); | 1155 == reinterpret_cast<uintptr_t>(start_); |
1159 } | 1156 } |
1160 bool Contains(Object* o) { | 1157 bool Contains(Object* o) { |
1161 return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_; | 1158 return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_; |
1162 } | 1159 } |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 | 1833 |
1837 private: | 1834 private: |
1838 LargeObjectChunk* current_; | 1835 LargeObjectChunk* current_; |
1839 HeapObjectCallback size_func_; | 1836 HeapObjectCallback size_func_; |
1840 }; | 1837 }; |
1841 | 1838 |
1842 | 1839 |
1843 } } // namespace v8::internal | 1840 } } // namespace v8::internal |
1844 | 1841 |
1845 #endif // V8_SPACES_H_ | 1842 #endif // V8_SPACES_H_ |
OLD | NEW |