| 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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 // Sets up the semispace using the given chunk. | 990 // Sets up the semispace using the given chunk. |
| 991 bool Setup(Address start, int initial_capacity, int maximum_capacity); | 991 bool Setup(Address start, int initial_capacity, int maximum_capacity); |
| 992 | 992 |
| 993 // Tear down the space. Heap memory was not allocated by the space, so it | 993 // Tear down the space. Heap memory was not allocated by the space, so it |
| 994 // is not deallocated here. | 994 // is not deallocated here. |
| 995 void TearDown(); | 995 void TearDown(); |
| 996 | 996 |
| 997 // True if the space has been set up but not torn down. | 997 // True if the space has been set up but not torn down. |
| 998 bool HasBeenSetup() { return start_ != NULL; } | 998 bool HasBeenSetup() { return start_ != NULL; } |
| 999 | 999 |
| 1000 // Double the size of the semispace by committing extra virtual memory. | 1000 // Grow the size of the semispace by committing extra virtual memory. |
| 1001 // Assumes that the caller has checked that the semispace has not reached | 1001 // Assumes that the caller has checked that the semispace has not reached |
| 1002 // its maximum capacity (and thus there is space available in the reserved | 1002 // its maximum capacity (and thus there is space available in the reserved |
| 1003 // address range to grow). | 1003 // address range to grow). |
| 1004 bool Double(); | 1004 bool Grow(); |
| 1005 | 1005 |
| 1006 // Returns the start address of the space. | 1006 // Returns the start address of the space. |
| 1007 Address low() { return start_; } | 1007 Address low() { return start_; } |
| 1008 // Returns one past the end address of the space. | 1008 // Returns one past the end address of the space. |
| 1009 Address high() { return low() + capacity_; } | 1009 Address high() { return low() + capacity_; } |
| 1010 | 1010 |
| 1011 // Age mark accessors. | 1011 // Age mark accessors. |
| 1012 Address age_mark() { return age_mark_; } | 1012 Address age_mark() { return age_mark_; } |
| 1013 void set_age_mark(Address mark) { age_mark_ = mark; } | 1013 void set_age_mark(Address mark) { age_mark_ = mark; } |
| 1014 | 1014 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1033 virtual int Size() { | 1033 virtual int Size() { |
| 1034 UNREACHABLE(); | 1034 UNREACHABLE(); |
| 1035 return 0; | 1035 return 0; |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 #ifdef DEBUG | 1038 #ifdef DEBUG |
| 1039 virtual void Print(); | 1039 virtual void Print(); |
| 1040 virtual void Verify(); | 1040 virtual void Verify(); |
| 1041 #endif | 1041 #endif |
| 1042 | 1042 |
| 1043 // Returns the current capacity of the semi space. |
| 1044 int Capacity() { return capacity_; } |
| 1045 |
| 1043 private: | 1046 private: |
| 1044 // The current and maximum capacity of the space. | 1047 // The current and maximum capacity of the space. |
| 1045 int capacity_; | 1048 int capacity_; |
| 1046 int maximum_capacity_; | 1049 int maximum_capacity_; |
| 1047 | 1050 |
| 1048 // The start address of the space. | 1051 // The start address of the space. |
| 1049 Address start_; | 1052 Address start_; |
| 1050 // Used to govern object promotion during mark-compact collection. | 1053 // Used to govern object promotion during mark-compact collection. |
| 1051 Address age_mark_; | 1054 Address age_mark_; |
| 1052 | 1055 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 void TearDown(); | 1127 void TearDown(); |
| 1125 | 1128 |
| 1126 // True if the space has been set up but not torn down. | 1129 // True if the space has been set up but not torn down. |
| 1127 bool HasBeenSetup() { | 1130 bool HasBeenSetup() { |
| 1128 return to_space_.HasBeenSetup() && from_space_.HasBeenSetup(); | 1131 return to_space_.HasBeenSetup() && from_space_.HasBeenSetup(); |
| 1129 } | 1132 } |
| 1130 | 1133 |
| 1131 // Flip the pair of spaces. | 1134 // Flip the pair of spaces. |
| 1132 void Flip(); | 1135 void Flip(); |
| 1133 | 1136 |
| 1134 // Doubles the capacity of the semispaces. Assumes that they are not at | 1137 // Grow the capacity of the semispaces. Assumes that they are not at |
| 1135 // their maximum capacity. Returns a flag indicating success or failure. | 1138 // their maximum capacity. Returns a flag indicating success or failure. |
| 1136 bool Double(); | 1139 bool Grow(); |
| 1137 | 1140 |
| 1138 // True if the address or object lies in the address range of either | 1141 // True if the address or object lies in the address range of either |
| 1139 // semispace (not necessarily below the allocation pointer). | 1142 // semispace (not necessarily below the allocation pointer). |
| 1140 bool Contains(Address a) { | 1143 bool Contains(Address a) { |
| 1141 return (reinterpret_cast<uintptr_t>(a) & address_mask_) | 1144 return (reinterpret_cast<uintptr_t>(a) & address_mask_) |
| 1142 == reinterpret_cast<uintptr_t>(start_); | 1145 == reinterpret_cast<uintptr_t>(start_); |
| 1143 } | 1146 } |
| 1144 bool Contains(Object* o) { | 1147 bool Contains(Object* o) { |
| 1145 return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_; | 1148 return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_; |
| 1146 } | 1149 } |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 | 1812 |
| 1810 private: | 1813 private: |
| 1811 LargeObjectChunk* current_; | 1814 LargeObjectChunk* current_; |
| 1812 HeapObjectCallback size_func_; | 1815 HeapObjectCallback size_func_; |
| 1813 }; | 1816 }; |
| 1814 | 1817 |
| 1815 | 1818 |
| 1816 } } // namespace v8::internal | 1819 } } // namespace v8::internal |
| 1817 | 1820 |
| 1818 #endif // V8_SPACES_H_ | 1821 #endif // V8_SPACES_H_ |
| OLD | NEW |