| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 return Address(this) + n; | 62 return Address(this) + n; |
| 63 } | 63 } |
| 64 | 64 |
| 65 Segment* next_; | 65 Segment* next_; |
| 66 int size_; | 66 int size_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 | 69 |
| 70 Zone::Zone(Isolate* isolate) | 70 Zone::Zone(Isolate* isolate) |
| 71 : zone_excess_limit_(256 * MB), | 71 : zone_excess_limit_(256 * MB), |
| 72 allocation_size_(0), |
| 72 segment_bytes_allocated_(0), | 73 segment_bytes_allocated_(0), |
| 73 position_(0), | 74 position_(0), |
| 74 limit_(0), | 75 limit_(0), |
| 75 scope_nesting_(0), | 76 scope_nesting_(0), |
| 76 segment_head_(NULL), | 77 segment_head_(NULL), |
| 77 isolate_(isolate) { | 78 isolate_(isolate) { |
| 78 } | 79 } |
| 79 unsigned Zone::allocation_size_ = 0; | 80 |
| 80 | 81 |
| 81 ZoneScope::~ZoneScope() { | 82 ZoneScope::~ZoneScope() { |
| 82 if (ShouldDeleteOnExit()) zone_->DeleteAll(); | 83 if (ShouldDeleteOnExit()) zone_->DeleteAll(); |
| 83 zone_->scope_nesting_--; | 84 zone_->scope_nesting_--; |
| 84 } | 85 } |
| 85 | 86 |
| 86 | 87 |
| 87 // Creates a new segment, sets it size, and pushes it to the front | 88 // Creates a new segment, sets it size, and pushes it to the front |
| 88 // of the segment chain. Returns the new segment. | 89 // of the segment chain. Returns the new segment. |
| 89 Segment* Zone::NewSegment(int size) { | 90 Segment* Zone::NewSegment(int size) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 V8::FatalProcessOutOfMemory("Zone"); | 208 V8::FatalProcessOutOfMemory("Zone"); |
| 208 return NULL; | 209 return NULL; |
| 209 } | 210 } |
| 210 limit_ = segment->end(); | 211 limit_ = segment->end(); |
| 211 ASSERT(position_ <= limit_); | 212 ASSERT(position_ <= limit_); |
| 212 return result; | 213 return result; |
| 213 } | 214 } |
| 214 | 215 |
| 215 | 216 |
| 216 } } // namespace v8::internal | 217 } } // namespace v8::internal |
| OLD | NEW |