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

Side by Side Diff: src/compiler/register-allocator.h

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/compiler/register-allocator.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #ifndef V8_REGISTER_ALLOCATOR_H_ 5 #ifndef V8_REGISTER_ALLOCATOR_H_
6 #define V8_REGISTER_ALLOCATOR_H_ 6 #define V8_REGISTER_ALLOCATOR_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/compiler/instruction.h" 9 #include "src/compiler/instruction.h"
10 #include "src/compiler/zone-pool.h"
10 #include "src/macro-assembler.h" 11 #include "src/macro-assembler.h"
11 #include "src/zone.h" 12 #include "src/zone.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 16
16 // Forward declarations. 17 // Forward declarations.
17 class BitVector; 18 class BitVector;
18 class InstructionOperand; 19 class InstructionOperand;
19 class UnallocatedOperand; 20 class UnallocatedOperand;
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 InstructionOperand* spill_operand_; 312 InstructionOperand* spill_operand_;
312 int spill_start_index_; 313 int spill_start_index_;
313 314
314 friend class RegisterAllocator; // Assigns to kind_. 315 friend class RegisterAllocator; // Assigns to kind_.
315 }; 316 };
316 317
317 318
318 class RegisterAllocator BASE_EMBEDDED { 319 class RegisterAllocator BASE_EMBEDDED {
319 public: 320 public:
320 // TODO(dcarney): remove info 321 // TODO(dcarney): remove info
321 explicit RegisterAllocator(Frame* frame, CompilationInfo* info, 322 explicit RegisterAllocator(Zone* local_zone, Frame* frame,
322 InstructionSequence* code); 323 CompilationInfo* info, InstructionSequence* code);
323 324
324 static void TraceAlloc(const char* msg, ...); 325 static void TraceAlloc(const char* msg, ...);
325 326
326 // Checks whether the value of a given virtual register is a reference. 327 // Checks whether the value of a given virtual register is a reference.
327 // TODO(titzer): rename this to IsReference. 328 // TODO(titzer): rename this to IsReference.
328 bool HasTaggedValue(int virtual_register) const; 329 bool HasTaggedValue(int virtual_register) const;
329 330
330 // Returns the register kind required by the given virtual register. 331 // Returns the register kind required by the given virtual register.
331 RegisterKind RequiredRegisterKind(int virtual_register) const; 332 RegisterKind RequiredRegisterKind(int virtual_register) const;
332 333
333 bool Allocate(); 334 // TODO(dcarney): fix compilation phase stats to not require this.
335 bool Allocate(ZonePool* zone_pool = NULL);
334 336
335 const ZoneList<LiveRange*>* live_ranges() const { return &live_ranges_; } 337 const ZoneList<LiveRange*>* live_ranges() const { return &live_ranges_; }
336 const Vector<LiveRange*>* fixed_live_ranges() const { 338 const Vector<LiveRange*>* fixed_live_ranges() const {
337 return &fixed_live_ranges_; 339 return &fixed_live_ranges_;
338 } 340 }
339 const Vector<LiveRange*>* fixed_double_live_ranges() const { 341 const Vector<LiveRange*>* fixed_double_live_ranges() const {
340 return &fixed_double_live_ranges_; 342 return &fixed_double_live_ranges_;
341 } 343 }
342 344
343 CompilationInfo* info() const { return info_; } 345 CompilationInfo* info() const { return info_; }
344 inline InstructionSequence* code() const { return code_; } 346 inline InstructionSequence* code() const { return code_; }
347 ZonePool* zone_pool() const { return zone_pool_; }
345 348
346 // This zone is for datastructures only needed during register allocation. 349 // This zone is for datastructures only needed during register allocation.
347 inline Zone* zone() { return &zone_; } 350 inline Zone* zone() const { return zone_; }
348 351
349 // This zone is for InstructionOperands and moves that live beyond register 352 // This zone is for InstructionOperands and moves that live beyond register
350 // allocation. 353 // allocation.
351 inline Zone* code_zone() { return code()->zone(); } 354 inline Zone* code_zone() const { return code()->zone(); }
352 355
353 int GetVirtualRegister() { 356 int GetVirtualRegister() {
354 int vreg = code()->NextVirtualRegister(); 357 int vreg = code()->NextVirtualRegister();
355 if (vreg >= UnallocatedOperand::kMaxVirtualRegisters) { 358 if (vreg >= UnallocatedOperand::kMaxVirtualRegisters) {
356 allocation_ok_ = false; 359 allocation_ok_ = false;
357 // Maintain the invariant that we return something below the maximum. 360 // Maintain the invariant that we return something below the maximum.
358 return 0; 361 return 0;
359 } 362 }
360 return vreg; 363 return vreg;
361 } 364 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 GapInstruction* GetLastGap(const InstructionBlock* block); 493 GapInstruction* GetLastGap(const InstructionBlock* block);
491 494
492 const char* RegisterName(int allocation_index); 495 const char* RegisterName(int allocation_index);
493 496
494 inline Instruction* InstructionAt(int index) { 497 inline Instruction* InstructionAt(int index) {
495 return code()->InstructionAt(index); 498 return code()->InstructionAt(index);
496 } 499 }
497 500
498 Frame* frame() const { return frame_; } 501 Frame* frame() const { return frame_; }
499 502
500 Zone zone_; 503 Zone* const zone_;
504 // TODO(dcarney): remove this.
505 ZonePool* zone_pool_;
501 Frame* const frame_; 506 Frame* const frame_;
502 CompilationInfo* const info_; 507 CompilationInfo* const info_;
503 InstructionSequence* const code_; 508 InstructionSequence* const code_;
504 509
505 // During liveness analysis keep a mapping from block id to live_in sets 510 // During liveness analysis keep a mapping from block id to live_in sets
506 // for blocks already analyzed. 511 // for blocks already analyzed.
507 ZoneList<BitVector*> live_in_sets_; 512 ZoneList<BitVector*> live_in_sets_;
508 513
509 // Liveness analysis results. 514 // Liveness analysis results.
510 ZoneList<LiveRange*> live_ranges_; 515 ZoneList<LiveRange*> live_ranges_;
(...skipping 17 matching lines...) Expand all
528 // Indicates success or failure during register allocation. 533 // Indicates success or failure during register allocation.
529 bool allocation_ok_; 534 bool allocation_ok_;
530 535
531 #ifdef DEBUG 536 #ifdef DEBUG
532 LifetimePosition allocation_finger_; 537 LifetimePosition allocation_finger_;
533 #endif 538 #endif
534 539
535 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); 540 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator);
536 }; 541 };
537 542
538
539 class RegisterAllocatorPhase : public CompilationPhase {
540 public:
541 RegisterAllocatorPhase(const char* name, RegisterAllocator* allocator);
542 ~RegisterAllocatorPhase();
543
544 private:
545 RegisterAllocator* allocator_;
546 unsigned allocator_zone_start_allocation_size_;
547
548 DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorPhase);
549 };
550 } 543 }
551 } 544 }
552 } // namespace v8::internal::compiler 545 } // namespace v8::internal::compiler
553 546
554 #endif // V8_REGISTER_ALLOCATOR_H_ 547 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698