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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (new_size < kMinimumSegmentSize) { | 169 if (new_size < kMinimumSegmentSize) { |
170 new_size = kMinimumSegmentSize; | 170 new_size = kMinimumSegmentSize; |
171 } else if (new_size > kMaximumSegmentSize) { | 171 } else if (new_size > kMaximumSegmentSize) { |
172 // Limit the size of new segments to avoid growing the segment size | 172 // Limit the size of new segments to avoid growing the segment size |
173 // exponentially, thus putting pressure on contiguous virtual address space. | 173 // exponentially, thus putting pressure on contiguous virtual address space. |
174 // All the while making sure to allocate a segment large enough to hold the | 174 // All the while making sure to allocate a segment large enough to hold the |
175 // requested size. | 175 // requested size. |
176 new_size = Max(kSegmentOverhead + size, kMaximumSegmentSize); | 176 new_size = Max(kSegmentOverhead + size, kMaximumSegmentSize); |
177 } | 177 } |
178 Segment* segment = Segment::New(new_size); | 178 Segment* segment = Segment::New(new_size); |
179 if (segment == NULL) V8::FatalProcessOutOfMemory("Zone"); | 179 if (segment == NULL) { |
| 180 V8::FatalProcessOutOfMemory("Zone"); |
| 181 return NULL; |
| 182 } |
180 | 183 |
181 // Recompute 'top' and 'limit' based on the new segment. | 184 // Recompute 'top' and 'limit' based on the new segment. |
182 Address result = RoundUp(segment->start(), kAlignment); | 185 Address result = RoundUp(segment->start(), kAlignment); |
183 position_ = result + size; | 186 position_ = result + size; |
184 limit_ = segment->end(); | 187 limit_ = segment->end(); |
185 ASSERT(position_ <= limit_); | 188 ASSERT(position_ <= limit_); |
186 return result; | 189 return result; |
187 } | 190 } |
188 | 191 |
189 | 192 |
190 } } // namespace v8::internal | 193 } } // namespace v8::internal |
OLD | NEW |