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

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

Issue 810403003: [turbofan] remove checks for virtual register overflow (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« 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/compiler/instruction.h" 8 #include "src/compiler/instruction.h"
9 #include "src/zone-containers.h" 9 #include "src/zone-containers.h"
10 10
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 }; 370 };
371 371
372 372
373 class RegisterAllocator FINAL : public ZoneObject { 373 class RegisterAllocator FINAL : public ZoneObject {
374 public: 374 public:
375 explicit RegisterAllocator(const RegisterConfiguration* config, 375 explicit RegisterAllocator(const RegisterConfiguration* config,
376 Zone* local_zone, Frame* frame, 376 Zone* local_zone, Frame* frame,
377 InstructionSequence* code, 377 InstructionSequence* code,
378 const char* debug_name = nullptr); 378 const char* debug_name = nullptr);
379 379
380 bool AllocationOk() { return allocation_ok_; }
381
382 const ZoneVector<LiveRange*>& live_ranges() const { return live_ranges_; } 380 const ZoneVector<LiveRange*>& live_ranges() const { return live_ranges_; }
383 const ZoneVector<LiveRange*>& fixed_live_ranges() const { 381 const ZoneVector<LiveRange*>& fixed_live_ranges() const {
384 return fixed_live_ranges_; 382 return fixed_live_ranges_;
385 } 383 }
386 const ZoneVector<LiveRange*>& fixed_double_live_ranges() const { 384 const ZoneVector<LiveRange*>& fixed_double_live_ranges() const {
387 return fixed_double_live_ranges_; 385 return fixed_double_live_ranges_;
388 } 386 }
389 InstructionSequence* code() const { return code_; } 387 InstructionSequence* code() const { return code_; }
390 // This zone is for datastructures only needed during register allocation. 388 // This zone is for datastructures only needed during register allocation.
391 Zone* local_zone() const { return local_zone_; } 389 Zone* local_zone() const { return local_zone_; }
(...skipping 22 matching lines...) Expand all
414 // Phase 7: compute values for pointer maps. 412 // Phase 7: compute values for pointer maps.
415 void PopulatePointerMaps(); // TODO(titzer): rename to PopulateReferenceMaps. 413 void PopulatePointerMaps(); // TODO(titzer): rename to PopulateReferenceMaps.
416 414
417 // Phase 8: reconnect split ranges with moves. 415 // Phase 8: reconnect split ranges with moves.
418 void ConnectRanges(); 416 void ConnectRanges();
419 417
420 // Phase 9: insert moves to connect ranges across basic blocks. 418 // Phase 9: insert moves to connect ranges across basic blocks.
421 void ResolveControlFlow(); 419 void ResolveControlFlow();
422 420
423 private: 421 private:
424 int GetVirtualRegister() { 422 int GetVirtualRegister() { return code()->NextVirtualRegister(); }
425 int vreg = code()->NextVirtualRegister();
426 if (vreg >= UnallocatedOperand::kMaxVirtualRegisters) {
427 allocation_ok_ = false;
428 // Maintain the invariant that we return something below the maximum.
429 return 0;
430 }
431 return vreg;
432 }
433 423
434 // Checks whether the value of a given virtual register is a reference. 424 // Checks whether the value of a given virtual register is a reference.
435 // TODO(titzer): rename this to IsReference. 425 // TODO(titzer): rename this to IsReference.
436 bool HasTaggedValue(int virtual_register) const; 426 bool HasTaggedValue(int virtual_register) const;
437 427
438 // Returns the register kind required by the given virtual register. 428 // Returns the register kind required by the given virtual register.
439 RegisterKind RequiredRegisterKind(int virtual_register) const; 429 RegisterKind RequiredRegisterKind(int virtual_register) const;
440 430
441 // This zone is for InstructionOperands and moves that live beyond register 431 // This zone is for InstructionOperands and moves that live beyond register
442 // allocation. 432 // allocation.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 ZoneVector<LiveRange*> inactive_live_ranges_; 608 ZoneVector<LiveRange*> inactive_live_ranges_;
619 ZoneVector<LiveRange*> reusable_slots_; 609 ZoneVector<LiveRange*> reusable_slots_;
620 ZoneVector<SpillRange*> spill_ranges_; 610 ZoneVector<SpillRange*> spill_ranges_;
621 611
622 RegisterKind mode_; 612 RegisterKind mode_;
623 int num_registers_; 613 int num_registers_;
624 614
625 BitVector* assigned_registers_; 615 BitVector* assigned_registers_;
626 BitVector* assigned_double_registers_; 616 BitVector* assigned_double_registers_;
627 617
628 // Indicates success or failure during register allocation.
629 bool allocation_ok_;
630
631 #ifdef DEBUG 618 #ifdef DEBUG
632 LifetimePosition allocation_finger_; 619 LifetimePosition allocation_finger_;
633 #endif 620 #endif
634 621
635 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); 622 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator);
636 }; 623 };
637 624
638 } // namespace compiler 625 } // namespace compiler
639 } // namespace internal 626 } // namespace internal
640 } // namespace v8 627 } // namespace v8
641 628
642 #endif // V8_REGISTER_ALLOCATOR_H_ 629 #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