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 26 matching lines...) Expand all Loading... |
37 // Computes the address of the nth byte in this segment. | 37 // Computes the address of the nth byte in this segment. |
38 Address address(int n) const { | 38 Address address(int n) const { |
39 return Address(this) + n; | 39 return Address(this) + n; |
40 } | 40 } |
41 | 41 |
42 Segment* next_; | 42 Segment* next_; |
43 int size_; | 43 int size_; |
44 }; | 44 }; |
45 | 45 |
46 | 46 |
47 Zone::Zone(Isolate* isolate) | 47 Zone::Zone() |
48 : allocation_size_(0), | 48 : allocation_size_(0), |
49 segment_bytes_allocated_(0), | 49 segment_bytes_allocated_(0), |
50 position_(0), | 50 position_(0), |
51 limit_(0), | 51 limit_(0), |
52 segment_head_(NULL), | 52 segment_head_(NULL) {} |
53 isolate_(isolate) { | |
54 } | |
55 | 53 |
56 | 54 |
57 Zone::~Zone() { | 55 Zone::~Zone() { |
58 DeleteAll(); | 56 DeleteAll(); |
59 DeleteKeptSegment(); | 57 DeleteKeptSegment(); |
60 | 58 |
61 DCHECK(segment_bytes_allocated_ == 0); | 59 DCHECK(segment_bytes_allocated_ == 0); |
62 } | 60 } |
63 | 61 |
64 | 62 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 V8::FatalProcessOutOfMemory("Zone"); | 249 V8::FatalProcessOutOfMemory("Zone"); |
252 return NULL; | 250 return NULL; |
253 } | 251 } |
254 limit_ = segment->end(); | 252 limit_ = segment->end(); |
255 DCHECK(position_ <= limit_); | 253 DCHECK(position_ <= limit_); |
256 return result; | 254 return result; |
257 } | 255 } |
258 | 256 |
259 | 257 |
260 } } // namespace v8::internal | 258 } } // namespace v8::internal |
OLD | NEW |