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

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

Issue 2645403002: [Compiler] Enable use of seperate zones for parsing and compiling. (Closed)
Patch Set: Add back header Created 3 years, 10 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
« no previous file with comments | « src/zone/zone.h ('k') | test/cctest/compiler/function-tester.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, kAlignmentInBytes); 69 size = RoundUp(size, kAlignmentInBytes);
67 70
68 // Check if the requested size is available without expanding. 71 // Check if the requested size is available without expanding.
69 Address result = position_; 72 Address result = position_;
70 73
71 const size_t size_with_redzone = size + kASanRedzoneBytes; 74 const size_t size_with_redzone = size + kASanRedzoneBytes;
72 const uintptr_t limit = reinterpret_cast<uintptr_t>(limit_); 75 const uintptr_t limit = reinterpret_cast<uintptr_t>(limit_);
73 const uintptr_t position = reinterpret_cast<uintptr_t>(position_); 76 const uintptr_t position = reinterpret_cast<uintptr_t>(position_);
74 // position_ > limit_ can be true after the alignment correction above. 77 // position_ > limit_ can be true after the alignment correction above.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // size bytes + header and alignment padding) 175 // size bytes + header and alignment padding)
173 DCHECK(reinterpret_cast<uintptr_t>(position_) >= 176 DCHECK(reinterpret_cast<uintptr_t>(position_) >=
174 reinterpret_cast<uintptr_t>(result)); 177 reinterpret_cast<uintptr_t>(result));
175 limit_ = segment->end(); 178 limit_ = segment->end();
176 DCHECK(position_ <= limit_); 179 DCHECK(position_ <= limit_);
177 return result; 180 return result;
178 } 181 }
179 182
180 } // namespace internal 183 } // namespace internal
181 } // namespace v8 184 } // namespace v8
OLDNEW
« no previous file with comments | « src/zone/zone.h ('k') | test/cctest/compiler/function-tester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698