| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 OneOperandInstruction(Location* loc, Value* value) | 408 OneOperandInstruction(Location* loc, Value* value) |
| 409 : Instruction(loc), value_(value) { | 409 : Instruction(loc), value_(value) { |
| 410 } | 410 } |
| 411 | 411 |
| 412 Value* value_; | 412 Value* value_; |
| 413 }; | 413 }; |
| 414 | 414 |
| 415 | 415 |
| 416 // Base class of instructions that have two input operands. | 416 // Base class of instructions that have two input operands. |
| 417 class TwoOperandInstruction : public Instruction { | 417 class TwoOperandInstruction : public Instruction { |
| 418 protected: | 418 public: |
| 419 // Support for fast-compilation mode: | 419 // Support for fast-compilation mode: |
| 420 virtual void Compile(MacroAssembler* masm) = 0; | 420 virtual void Compile(MacroAssembler* masm) = 0; |
| 421 void FastAllocate(TempLocation* temp); | 421 void FastAllocate(TempLocation* temp); |
| 422 | 422 |
| 423 #ifdef DEBUG | 423 #ifdef DEBUG |
| 424 // Printing support: print the operands. | 424 // Printing support: print the operands. |
| 425 virtual void Print(); | 425 virtual void Print(); |
| 426 #endif | 426 #endif |
| 427 | 427 |
| 428 protected: | 428 protected: |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 | 761 |
| 762 // Make this the empty set. | 762 // Make this the empty set. |
| 763 void Empty() { | 763 void Empty() { |
| 764 parameters_ = locals_ = 0; | 764 parameters_ = locals_ = 0; |
| 765 } | 765 } |
| 766 | 766 |
| 767 // Insert an element. | 767 // Insert an element. |
| 768 void AddElement(SlotLocation* location) { | 768 void AddElement(SlotLocation* location) { |
| 769 if (location->type() == Slot::PARAMETER) { | 769 if (location->type() == Slot::PARAMETER) { |
| 770 // Parameter indexes begin with -1 ('this'). | 770 // Parameter indexes begin with -1 ('this'). |
| 771 ASSERT(location->index() < kPointerSize - 1); | 771 ASSERT(location->index() < kBitsPerPointer - 1); |
| 772 parameters_ |= (1 << (location->index() + 1)); | 772 parameters_ |= (1 << (location->index() + 1)); |
| 773 } else { | 773 } else { |
| 774 ASSERT(location->type() == Slot::LOCAL); | 774 ASSERT(location->type() == Slot::LOCAL); |
| 775 ASSERT(location->index() < kPointerSize); | 775 ASSERT(location->index() < kBitsPerPointer); |
| 776 locals_ |= (1 << location->index()); | 776 locals_ |= (1 << location->index()); |
| 777 } | 777 } |
| 778 } | 778 } |
| 779 | 779 |
| 780 // (Destructively) compute the union with another set. | 780 // (Destructively) compute the union with another set. |
| 781 void Union(LocationSet* other) { | 781 void Union(LocationSet* other) { |
| 782 parameters_ |= other->parameters(); | 782 parameters_ |= other->parameters(); |
| 783 locals_ |= other->locals(); | 783 locals_ |= other->locals(); |
| 784 } | 784 } |
| 785 | 785 |
| 786 bool Contains(SlotLocation* location) { | 786 bool Contains(SlotLocation* location) { |
| 787 if (location->type() == Slot::PARAMETER) { | 787 if (location->type() == Slot::PARAMETER) { |
| 788 ASSERT(location->index() < kPointerSize - 1); | 788 ASSERT(location->index() < kBitsPerPointer - 1); |
| 789 return (parameters_ & (1 << (location->index() + 1))); | 789 return (parameters_ & (1 << (location->index() + 1))); |
| 790 } else { | 790 } else { |
| 791 ASSERT(location->type() == Slot::LOCAL); | 791 ASSERT(location->type() == Slot::LOCAL); |
| 792 ASSERT(location->index() < kPointerSize); | 792 ASSERT(location->index() < kBitsPerPointer); |
| 793 return (locals_ & (1 << location->index())); | 793 return (locals_ & (1 << location->index())); |
| 794 } | 794 } |
| 795 } | 795 } |
| 796 | 796 |
| 797 private: | 797 private: |
| 798 uintptr_t parameters_; | 798 uintptr_t parameters_; |
| 799 uintptr_t locals_; | 799 uintptr_t locals_; |
| 800 }; | 800 }; |
| 801 | 801 |
| 802 | 802 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 827 destination_ = destination; | 827 destination_ = destination; |
| 828 Visit(expr); | 828 Visit(expr); |
| 829 } | 829 } |
| 830 | 830 |
| 831 // AST node visitors. | 831 // AST node visitors. |
| 832 #define DECLARE_VISIT(type) void Visit##type(type* node); | 832 #define DECLARE_VISIT(type) void Visit##type(type* node); |
| 833 AST_NODE_LIST(DECLARE_VISIT) | 833 AST_NODE_LIST(DECLARE_VISIT) |
| 834 #undef DECLARE_VISIT | 834 #undef DECLARE_VISIT |
| 835 | 835 |
| 836 private: | 836 private: |
| 837 // State for the visitor. Input parameters: | 837 // State for the visitor. Input parameter: |
| 838 Location* destination_; | 838 Location* destination_; |
| 839 | 839 |
| 840 // Output parameters: | 840 // Output parameters: |
| 841 Value* value_; | 841 Value* value_; |
| 842 Cfg* graph_; | 842 Cfg* graph_; |
| 843 LocationSet assigned_vars_; | 843 LocationSet assigned_vars_; |
| 844 }; | 844 }; |
| 845 | 845 |
| 846 | 846 |
| 847 // A StatementCfgBuilder maintains a CFG fragment accumulator. When it | 847 // A StatementCfgBuilder maintains a CFG fragment accumulator. When it |
| (...skipping 14 matching lines...) Expand all Loading... |
| 862 | 862 |
| 863 private: | 863 private: |
| 864 // State for the visitor. Input/output parameter: | 864 // State for the visitor. Input/output parameter: |
| 865 Cfg* graph_; | 865 Cfg* graph_; |
| 866 }; | 866 }; |
| 867 | 867 |
| 868 | 868 |
| 869 } } // namespace v8::internal | 869 } } // namespace v8::internal |
| 870 | 870 |
| 871 #endif // V8_CFG_H_ | 871 #endif // V8_CFG_H_ |
| OLD | NEW |