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

Unified Diff: src/compiler/register-allocator.cc

Issue 663333003: [turbofan] use ZonePool in most places in the compiler pipeline a temp zone is used. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/register-allocator.h ('k') | test/cctest/compiler/test-codegen-deopt.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/register-allocator.cc
diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc
index 8f024527503a761409b58046c64999c4d76cf3b4..34e3bda606af56c9f0a4e1e8ae3447b9c50bf3ec 100644
--- a/src/compiler/register-allocator.cc
+++ b/src/compiler/register-allocator.cc
@@ -499,9 +499,11 @@ LifetimePosition LiveRange::FirstIntersection(LiveRange* other) {
}
-RegisterAllocator::RegisterAllocator(Frame* frame, CompilationInfo* info,
+RegisterAllocator::RegisterAllocator(Zone* local_zone, Frame* frame,
+ CompilationInfo* info,
InstructionSequence* code)
- : zone_(code->isolate()),
+ : zone_(local_zone),
+ zone_pool_(NULL),
frame_(frame),
info_(info),
code_(code),
@@ -1094,7 +1096,9 @@ void RegisterAllocator::ResolvePhis(const InstructionBlock* block) {
}
-bool RegisterAllocator::Allocate() {
+bool RegisterAllocator::Allocate(ZonePool* zone_pool) {
+ DCHECK_EQ(NULL, zone_pool_);
+ zone_pool_ = zone_pool;
assigned_registers_ = new (code_zone())
BitVector(Register::NumAllocatableRegisters(), code_zone());
assigned_double_registers_ = new (code_zone())
@@ -1116,6 +1120,46 @@ bool RegisterAllocator::Allocate() {
}
+class RegisterAllocatorPhase : public CompilationPhase {
+ public:
+ RegisterAllocatorPhase(const char* name, RegisterAllocator* allocator)
+ : CompilationPhase(name, allocator->info()),
+ allocator_(allocator),
+ allocator_zone_start_allocation_size_(0),
+ stats_(NULL) {
+ if (FLAG_turbo_stats) {
+ allocator_zone_start_allocation_size_ =
+ allocator->info()->zone()->allocation_size();
+ if (allocator->zone_pool() != NULL) {
+ stats_ = new ZonePool::StatsScope(allocator->zone_pool());
+ }
+ }
+ }
+
+ ~RegisterAllocatorPhase() {
+ if (FLAG_turbo_stats) {
+ unsigned size = allocator_->info()->zone()->allocation_size() -
+ allocator_zone_start_allocation_size_;
+ if (stats_ != NULL) {
+ size += static_cast<unsigned>(stats_->GetMaxAllocatedBytes());
+ }
+ isolate()->GetTStatistics()->SaveTiming(name(), base::TimeDelta(), size);
+ }
+ delete stats_;
+#ifdef DEBUG
+ if (allocator_ != NULL) allocator_->Verify();
+#endif
+ }
+
+ private:
+ RegisterAllocator* allocator_;
+ unsigned allocator_zone_start_allocation_size_;
+ ZonePool::StatsScope* stats_;
+
+ DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorPhase);
+};
+
+
void RegisterAllocator::MeetRegisterConstraints() {
RegisterAllocatorPhase phase("L_Register constraints", this);
for (int i = 0; i < code()->InstructionBlockCount(); ++i) {
@@ -2207,27 +2251,6 @@ void RegisterAllocator::SetLiveRangeAssignedRegister(LiveRange* range,
range->set_assigned_register(reg, code_zone());
}
-
-RegisterAllocatorPhase::RegisterAllocatorPhase(const char* name,
- RegisterAllocator* allocator)
- : CompilationPhase(name, allocator->info()), allocator_(allocator) {
- if (FLAG_turbo_stats) {
- allocator_zone_start_allocation_size_ =
- allocator->zone()->allocation_size();
- }
-}
-
-
-RegisterAllocatorPhase::~RegisterAllocatorPhase() {
- if (FLAG_turbo_stats) {
- unsigned size = allocator_->zone()->allocation_size() -
- allocator_zone_start_allocation_size_;
- isolate()->GetTStatistics()->SaveTiming(name(), base::TimeDelta(), size);
- }
-#ifdef DEBUG
- if (allocator_ != NULL) allocator_->Verify();
-#endif
-}
}
}
} // namespace v8::internal::compiler
« no previous file with comments | « src/compiler/register-allocator.h ('k') | test/cctest/compiler/test-codegen-deopt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698