| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 kDeoptimizeOnUndefined, | 506 kDeoptimizeOnUndefined, |
| 507 kIsArguments, | 507 kIsArguments, |
| 508 kTruncatingToInt32, | 508 kTruncatingToInt32, |
| 509 kLastFlag = kTruncatingToInt32 | 509 kLastFlag = kTruncatingToInt32 |
| 510 }; | 510 }; |
| 511 | 511 |
| 512 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 512 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
| 513 | 513 |
| 514 static const int kChangesToDependsFlagsLeftShift = 1; | 514 static const int kChangesToDependsFlagsLeftShift = 1; |
| 515 | 515 |
| 516 static int ChangesFlagsMask() { | |
| 517 int result = 0; | |
| 518 // Create changes mask. | |
| 519 #define DECLARE_DO(type) result |= (1 << kChanges##type); | |
| 520 GVN_FLAG_LIST(DECLARE_DO) | |
| 521 #undef DECLARE_DO | |
| 522 return result; | |
| 523 } | |
| 524 | |
| 525 static int DependsFlagsMask() { | |
| 526 return ConvertChangesToDependsFlags(ChangesFlagsMask()); | |
| 527 } | |
| 528 | |
| 529 static int ConvertChangesToDependsFlags(int flags) { | 516 static int ConvertChangesToDependsFlags(int flags) { |
| 530 return flags << kChangesToDependsFlagsLeftShift; | 517 return flags << kChangesToDependsFlagsLeftShift; |
| 531 } | 518 } |
| 532 | 519 |
| 533 static HValue* cast(HValue* value) { return value; } | 520 static HValue* cast(HValue* value) { return value; } |
| 534 | 521 |
| 535 enum Opcode { | 522 enum Opcode { |
| 536 // Declare a unique enum value for each hydrogen instruction. | 523 // Declare a unique enum value for each hydrogen instruction. |
| 537 #define DECLARE_OPCODE(type) k##type, | 524 #define DECLARE_OPCODE(type) k##type, |
| 538 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) | 525 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 609 |
| 623 int flags() const { return flags_; } | 610 int flags() const { return flags_; } |
| 624 void SetFlag(Flag f) { flags_ |= (1 << f); } | 611 void SetFlag(Flag f) { flags_ |= (1 << f); } |
| 625 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } | 612 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } |
| 626 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } | 613 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } |
| 627 | 614 |
| 628 void SetAllSideEffects() { flags_ |= AllSideEffects(); } | 615 void SetAllSideEffects() { flags_ |= AllSideEffects(); } |
| 629 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } | 616 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } |
| 630 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } | 617 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } |
| 631 | 618 |
| 619 int ChangesFlags() const { return flags_ & ChangesFlagsMask(); } |
| 620 |
| 632 Range* range() const { return range_; } | 621 Range* range() const { return range_; } |
| 633 bool HasRange() const { return range_ != NULL; } | 622 bool HasRange() const { return range_ != NULL; } |
| 634 void AddNewRange(Range* r); | 623 void AddNewRange(Range* r); |
| 635 void RemoveLastAddedRange(); | 624 void RemoveLastAddedRange(); |
| 636 void ComputeInitialRange(); | 625 void ComputeInitialRange(); |
| 637 | 626 |
| 638 // Representation helpers. | 627 // Representation helpers. |
| 639 virtual Representation RequiredInputRepresentation(int index) const = 0; | 628 virtual Representation RequiredInputRepresentation(int index) const = 0; |
| 640 | 629 |
| 641 virtual Representation InferredRepresentation() { | 630 virtual Representation InferredRepresentation() { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 block_ = NULL; | 675 block_ = NULL; |
| 687 } | 676 } |
| 688 | 677 |
| 689 void set_representation(Representation r) { | 678 void set_representation(Representation r) { |
| 690 // Representation is set-once. | 679 // Representation is set-once. |
| 691 ASSERT(representation_.IsNone() && !r.IsNone()); | 680 ASSERT(representation_.IsNone() && !r.IsNone()); |
| 692 representation_ = r; | 681 representation_ = r; |
| 693 } | 682 } |
| 694 | 683 |
| 695 private: | 684 private: |
| 685 static int ChangesFlagsMask() { |
| 686 int result = 0; |
| 687 // Create changes mask. |
| 688 #define ADD_FLAG(type) result |= (1 << kChanges##type); |
| 689 GVN_FLAG_LIST(ADD_FLAG) |
| 690 #undef ADD_FLAG |
| 691 return result; |
| 692 } |
| 693 |
| 696 // A flag mask to mark an instruction as having arbitrary side effects. | 694 // A flag mask to mark an instruction as having arbitrary side effects. |
| 697 static int AllSideEffects() { | 695 static int AllSideEffects() { |
| 698 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries); | 696 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries); |
| 699 } | 697 } |
| 700 | 698 |
| 701 // Remove the matching use from the use list if present. Returns the | 699 // Remove the matching use from the use list if present. Returns the |
| 702 // removed list node or NULL. | 700 // removed list node or NULL. |
| 703 HUseListNode* RemoveUse(HValue* value, int index); | 701 HUseListNode* RemoveUse(HValue* value, int index); |
| 704 | 702 |
| 705 void RegisterUse(int index, HValue* new_value); | 703 void RegisterUse(int index, HValue* new_value); |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 set_representation(Representation::Tagged()); | 1687 set_representation(Representation::Tagged()); |
| 1690 SetFlag(kUseGVN); | 1688 SetFlag(kUseGVN); |
| 1691 SetFlag(kDependsOnArrayLengths); | 1689 SetFlag(kDependsOnArrayLengths); |
| 1692 SetFlag(kDependsOnMaps); | 1690 SetFlag(kDependsOnMaps); |
| 1693 } | 1691 } |
| 1694 | 1692 |
| 1695 virtual Representation RequiredInputRepresentation(int index) const { | 1693 virtual Representation RequiredInputRepresentation(int index) const { |
| 1696 return Representation::Tagged(); | 1694 return Representation::Tagged(); |
| 1697 } | 1695 } |
| 1698 | 1696 |
| 1697 virtual void PrintDataTo(StringStream* stream); |
| 1698 |
| 1699 HValue* value() { return OperandAt(0); } | 1699 HValue* value() { return OperandAt(0); } |
| 1700 HValue* typecheck() { return OperandAt(1); } |
| 1700 | 1701 |
| 1701 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) | 1702 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) |
| 1702 | 1703 |
| 1703 protected: | 1704 protected: |
| 1704 virtual bool DataEquals(HValue* other) { return true; } | 1705 virtual bool DataEquals(HValue* other) { return true; } |
| 1705 }; | 1706 }; |
| 1706 | 1707 |
| 1707 | 1708 |
| 1708 class HFixedArrayBaseLength: public HUnaryOperation { | 1709 class HFixedArrayBaseLength: public HUnaryOperation { |
| 1709 public: | 1710 public: |
| (...skipping 2496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4206 | 4207 |
| 4207 DECLARE_CONCRETE_INSTRUCTION(In) | 4208 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4208 }; | 4209 }; |
| 4209 | 4210 |
| 4210 #undef DECLARE_INSTRUCTION | 4211 #undef DECLARE_INSTRUCTION |
| 4211 #undef DECLARE_CONCRETE_INSTRUCTION | 4212 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4212 | 4213 |
| 4213 } } // namespace v8::internal | 4214 } } // namespace v8::internal |
| 4214 | 4215 |
| 4215 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4216 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |