OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 #include "src/zone-inl.h" | 8 #include "src/zone-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Un-poison so we can re-use the segment later. | 143 // Un-poison so we can re-use the segment later. |
144 ASAN_UNPOISON_MEMORY_REGION(start, keep->capacity()); | 144 ASAN_UNPOISON_MEMORY_REGION(start, keep->capacity()); |
145 #ifdef DEBUG | 145 #ifdef DEBUG |
146 // Zap the contents of the kept segment (but not the header). | 146 // Zap the contents of the kept segment (but not the header). |
147 memset(start, kZapDeadByte, keep->capacity()); | 147 memset(start, kZapDeadByte, keep->capacity()); |
148 #endif | 148 #endif |
149 } else { | 149 } else { |
150 position_ = limit_ = 0; | 150 position_ = limit_ = 0; |
151 } | 151 } |
152 | 152 |
| 153 allocation_size_ = 0; |
153 // Update the head segment to be the kept segment (if any). | 154 // Update the head segment to be the kept segment (if any). |
154 segment_head_ = keep; | 155 segment_head_ = keep; |
155 } | 156 } |
156 | 157 |
157 | 158 |
158 void Zone::DeleteKeptSegment() { | 159 void Zone::DeleteKeptSegment() { |
159 #ifdef DEBUG | 160 #ifdef DEBUG |
160 // Constant byte value used for zapping dead memory in debug mode. | 161 // Constant byte value used for zapping dead memory in debug mode. |
161 static const unsigned char kZapDeadByte = 0xcd; | 162 static const unsigned char kZapDeadByte = 0xcd; |
162 #endif | 163 #endif |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 V8::FatalProcessOutOfMemory("Zone"); | 251 V8::FatalProcessOutOfMemory("Zone"); |
251 return NULL; | 252 return NULL; |
252 } | 253 } |
253 limit_ = segment->end(); | 254 limit_ = segment->end(); |
254 DCHECK(position_ <= limit_); | 255 DCHECK(position_ <= limit_); |
255 return result; | 256 return result; |
256 } | 257 } |
257 | 258 |
258 | 259 |
259 } } // namespace v8::internal | 260 } } // namespace v8::internal |
OLD | NEW |