Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: src/zone/zone.cc

Issue 2645403002: [Compiler] Enable use of seperate zones for parsing and compiling. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "src/zone/zone.h" 5 #include "src/zone/zone.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "src/utils.h" 9 #include "src/utils.h"
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 } // namespace 43 } // namespace
44 44
45 Zone::Zone(AccountingAllocator* allocator, const char* name) 45 Zone::Zone(AccountingAllocator* allocator, const char* name)
46 : allocation_size_(0), 46 : allocation_size_(0),
47 segment_bytes_allocated_(0), 47 segment_bytes_allocated_(0),
48 position_(0), 48 position_(0),
49 limit_(0), 49 limit_(0),
50 allocator_(allocator), 50 allocator_(allocator),
51 segment_head_(nullptr), 51 segment_head_(nullptr),
52 name_(name) { 52 name_(name),
53 sealed_(false) {
53 allocator_->ZoneCreation(this); 54 allocator_->ZoneCreation(this);
54 } 55 }
55 56
56 Zone::~Zone() { 57 Zone::~Zone() {
57 allocator_->ZoneDestruction(this); 58 allocator_->ZoneDestruction(this);
58 59
59 DeleteAll(); 60 DeleteAll();
60 61
61 DCHECK(segment_bytes_allocated_ == 0); 62 DCHECK(segment_bytes_allocated_ == 0);
62 } 63 }
63 64
64 void* Zone::New(size_t size) { 65 void* Zone::New(size_t size) {
66 CHECK(!sealed_);
67
65 // Round up the requested size to fit the alignment. 68 // Round up the requested size to fit the alignment.
66 size = RoundUp(size, kAlignment); 69 size = RoundUp(size, kAlignment);
67 70
68 // If the allocation size is divisible by 8 then we return an 8-byte aligned 71 // If the allocation size is divisible by 8 then we return an 8-byte aligned
69 // address. 72 // address.
70 if (kPointerSize == 4 && kAlignment == 4) { 73 if (kPointerSize == 4 && kAlignment == 4) {
71 position_ += ((~size) & 4) & (reinterpret_cast<intptr_t>(position_) & 4); 74 position_ += ((~size) & 4) & (reinterpret_cast<intptr_t>(position_) & 4);
72 } else { 75 } else {
73 DCHECK(kAlignment >= kPointerSize); 76 DCHECK(kAlignment >= kPointerSize);
74 } 77 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // size bytes + header and alignment padding) 183 // size bytes + header and alignment padding)
181 DCHECK(reinterpret_cast<uintptr_t>(position_) >= 184 DCHECK(reinterpret_cast<uintptr_t>(position_) >=
182 reinterpret_cast<uintptr_t>(result)); 185 reinterpret_cast<uintptr_t>(result));
183 limit_ = segment->end(); 186 limit_ = segment->end();
184 DCHECK(position_ <= limit_); 187 DCHECK(position_ <= limit_);
185 return result; 188 return result;
186 } 189 }
187 190
188 } // namespace internal 191 } // namespace internal
189 } // namespace v8 192 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698