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

Side by Side Diff: src/lithium-allocator.h

Issue 5990005: Optimize instanceof further... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 12 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 LDoubleRegister() : LOperand() { } 475 LDoubleRegister() : LOperand() { }
476 explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { } 476 explicit LDoubleRegister(int index) : LOperand(DOUBLE_REGISTER, index) { }
477 }; 477 };
478 478
479 479
480 // A register-allocator view of a Lithium instruction. It contains the id of 480 // A register-allocator view of a Lithium instruction. It contains the id of
481 // the output operand and a list of input operand uses. 481 // the output operand and a list of input operand uses.
482 class InstructionSummary: public ZoneObject { 482 class InstructionSummary: public ZoneObject {
483 public: 483 public:
484 InstructionSummary() 484 InstructionSummary()
485 : output_operand_(NULL), input_count_(0), operands_(4), is_call_(false) {} 485 : output_operand_(NULL),
486 input_count_(0),
487 operands_(4),
488 is_call_(false),
489 is_save_doubles_(false) {}
486 490
487 // Output operands. 491 // Output operands.
488 LOperand* Output() const { return output_operand_; } 492 LOperand* Output() const { return output_operand_; }
489 void SetOutput(LOperand* output) { 493 void SetOutput(LOperand* output) {
490 ASSERT(output_operand_ == NULL); 494 ASSERT(output_operand_ == NULL);
491 output_operand_ = output; 495 output_operand_ = output;
492 } 496 }
493 497
494 // Input operands. 498 // Input operands.
495 int InputCount() const { return input_count_; } 499 int InputCount() const { return input_count_; }
496 LOperand* InputAt(int i) const { 500 LOperand* InputAt(int i) const {
497 ASSERT(i < input_count_); 501 ASSERT(i < input_count_);
498 return operands_[i]; 502 return operands_[i];
499 } 503 }
500 void AddInput(LOperand* input) { 504 void AddInput(LOperand* input) {
501 operands_.InsertAt(input_count_, input); 505 operands_.InsertAt(input_count_, input);
502 input_count_++; 506 input_count_++;
503 } 507 }
504 508
505 // Temporary operands. 509 // Temporary operands.
506 int TempCount() const { return operands_.length() - input_count_; } 510 int TempCount() const { return operands_.length() - input_count_; }
507 LOperand* TempAt(int i) const { return operands_[i + input_count_]; } 511 LOperand* TempAt(int i) const { return operands_[i + input_count_]; }
508 void AddTemp(LOperand* temp) { operands_.Add(temp); } 512 void AddTemp(LOperand* temp) { operands_.Add(temp); }
509 513
510 void MarkAsCall() { is_call_ = true; } 514 void MarkAsCall() { is_call_ = true; }
511 bool IsCall() const { return is_call_; } 515 bool IsCall() const { return is_call_; }
512 516
517 void MarkAsSaveDoubles() { is_save_doubles_ = true; }
518 bool IsSaveDoubles() const { return is_save_doubles_; }
519
513 private: 520 private:
514 LOperand* output_operand_; 521 LOperand* output_operand_;
515 int input_count_; 522 int input_count_;
516 ZoneList<LOperand*> operands_; 523 ZoneList<LOperand*> operands_;
517 bool is_call_; 524 bool is_call_;
525 bool is_save_doubles_;
518 }; 526 };
519 527
520 // Representation of the non-empty interval [start,end[. 528 // Representation of the non-empty interval [start,end[.
521 class UseInterval: public ZoneObject { 529 class UseInterval: public ZoneObject {
522 public: 530 public:
523 UseInterval(LifetimePosition start, LifetimePosition end) 531 UseInterval(LifetimePosition start, LifetimePosition end)
524 : start_(start), end_(end), next_(NULL) { 532 : start_(start), end_(end), next_(NULL) {
525 ASSERT(start.Value() < end.Value()); 533 ASSERT(start.Value() < end.Value());
526 } 534 }
527 535
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 // Record a use of an input operand in the current instruction. 790 // Record a use of an input operand in the current instruction.
783 void RecordUse(HValue* value, LUnallocated* operand); 791 void RecordUse(HValue* value, LUnallocated* operand);
784 // Record the definition of the output operand. 792 // Record the definition of the output operand.
785 void RecordDefinition(HInstruction* instr, LUnallocated* operand); 793 void RecordDefinition(HInstruction* instr, LUnallocated* operand);
786 // Record a temporary operand. 794 // Record a temporary operand.
787 void RecordTemporary(LUnallocated* operand); 795 void RecordTemporary(LUnallocated* operand);
788 796
789 // Marks the current instruction as a call. 797 // Marks the current instruction as a call.
790 void MarkAsCall(); 798 void MarkAsCall();
791 799
800 // Marks the current instruction as a requiring saving double registers.
Mads Ager (chromium) 2011/01/04 17:25:58 as a -> as
Søren Thygesen Gjesse 2011/01/05 09:28:00 Done.
801 void MarkAsSaveDoubles();
802
792 // Checks whether the value of a given virtual register is tagged. 803 // Checks whether the value of a given virtual register is tagged.
793 bool HasTaggedValue(int virtual_register) const; 804 bool HasTaggedValue(int virtual_register) const;
794 805
795 // Returns the register kind required by the given virtual register. 806 // Returns the register kind required by the given virtual register.
796 RegisterKind RequiredRegisterKind(int virtual_register) const; 807 RegisterKind RequiredRegisterKind(int virtual_register) const;
797 808
798 // Begin a new instruction. 809 // Begin a new instruction.
799 void BeginInstruction(); 810 void BeginInstruction();
800 811
801 // Summarize the current instruction. 812 // Summarize the current instruction.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 991
981 bool has_osr_entry_; 992 bool has_osr_entry_;
982 993
983 DISALLOW_COPY_AND_ASSIGN(LAllocator); 994 DISALLOW_COPY_AND_ASSIGN(LAllocator);
984 }; 995 };
985 996
986 997
987 } } // namespace v8::internal 998 } } // namespace v8::internal
988 999
989 #endif // V8_LITHIUM_ALLOCATOR_H_ 1000 #endif // V8_LITHIUM_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698