| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 void RemoveLastAddedRange(); | 713 void RemoveLastAddedRange(); |
| 714 void ComputeInitialRange(Zone* zone); | 714 void ComputeInitialRange(Zone* zone); |
| 715 | 715 |
| 716 // Representation helpers. | 716 // Representation helpers. |
| 717 virtual Representation RequiredInputRepresentation(int index) = 0; | 717 virtual Representation RequiredInputRepresentation(int index) = 0; |
| 718 | 718 |
| 719 virtual Representation InferredRepresentation() { | 719 virtual Representation InferredRepresentation() { |
| 720 return representation(); | 720 return representation(); |
| 721 } | 721 } |
| 722 | 722 |
| 723 // Type feedback access. |
| 724 virtual Representation ObservedInputRepresentation(int index) { |
| 725 return RequiredInputRepresentation(index); |
| 726 } |
| 727 |
| 723 // This gives the instruction an opportunity to replace itself with an | 728 // This gives the instruction an opportunity to replace itself with an |
| 724 // instruction that does the same in some better way. To replace an | 729 // instruction that does the same in some better way. To replace an |
| 725 // instruction with a new one, first add the new instruction to the graph, | 730 // instruction with a new one, first add the new instruction to the graph, |
| 726 // then return it. Return NULL to have the instruction deleted. | 731 // then return it. Return NULL to have the instruction deleted. |
| 727 virtual HValue* Canonicalize() { return this; } | 732 virtual HValue* Canonicalize() { return this; } |
| 728 | 733 |
| 729 bool Equals(HValue* other); | 734 bool Equals(HValue* other); |
| 730 virtual intptr_t Hashcode(); | 735 virtual intptr_t Hashcode(); |
| 731 | 736 |
| 732 // Printing support. | 737 // Printing support. |
| (...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2391 return reinterpret_cast<HPhi*>(value); | 2396 return reinterpret_cast<HPhi*>(value); |
| 2392 } | 2397 } |
| 2393 virtual Opcode opcode() const { return HValue::kPhi; } | 2398 virtual Opcode opcode() const { return HValue::kPhi; } |
| 2394 | 2399 |
| 2395 virtual bool IsConvertibleToInteger() const { | 2400 virtual bool IsConvertibleToInteger() const { |
| 2396 return is_convertible_to_integer_; | 2401 return is_convertible_to_integer_; |
| 2397 } | 2402 } |
| 2398 | 2403 |
| 2399 void set_is_convertible_to_integer(bool b) { | 2404 void set_is_convertible_to_integer(bool b) { |
| 2400 is_convertible_to_integer_ = b; | 2405 is_convertible_to_integer_ = b; |
| 2406 if (!is_convertible_to_integer_) { |
| 2407 non_phi_uses_[Representation::kInteger32] = 0; |
| 2408 indirect_uses_[Representation::kInteger32] = 0; |
| 2409 } |
| 2401 } | 2410 } |
| 2402 | 2411 |
| 2403 bool AllOperandsConvertibleToInteger() { | 2412 bool AllOperandsConvertibleToInteger() { |
| 2404 for (int i = 0; i < OperandCount(); ++i) { | 2413 for (int i = 0; i < OperandCount(); ++i) { |
| 2405 if (!OperandAt(i)->IsConvertibleToInteger()) return false; | 2414 if (!OperandAt(i)->IsConvertibleToInteger()) { |
| 2415 return false; |
| 2416 } |
| 2406 } | 2417 } |
| 2407 return true; | 2418 return true; |
| 2408 } | 2419 } |
| 2409 | 2420 |
| 2410 protected: | 2421 protected: |
| 2411 virtual void DeleteFromGraph(); | 2422 virtual void DeleteFromGraph(); |
| 2412 virtual void InternalSetOperandAt(int index, HValue* value) { | 2423 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 2413 inputs_[index] = value; | 2424 inputs_[index] = value; |
| 2414 } | 2425 } |
| 2415 | 2426 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 HValue* context() { return OperandAt(0); } | 2560 HValue* context() { return OperandAt(0); } |
| 2550 HValue* left() { return OperandAt(1); } | 2561 HValue* left() { return OperandAt(1); } |
| 2551 HValue* right() { return OperandAt(2); } | 2562 HValue* right() { return OperandAt(2); } |
| 2552 | 2563 |
| 2553 // TODO(kasperl): Move these helpers to the IA-32 Lithium | 2564 // TODO(kasperl): Move these helpers to the IA-32 Lithium |
| 2554 // instruction sequence builder. | 2565 // instruction sequence builder. |
| 2555 HValue* LeastConstantOperand() { | 2566 HValue* LeastConstantOperand() { |
| 2556 if (IsCommutative() && left()->IsConstant()) return right(); | 2567 if (IsCommutative() && left()->IsConstant()) return right(); |
| 2557 return left(); | 2568 return left(); |
| 2558 } | 2569 } |
| 2570 |
| 2559 HValue* MostConstantOperand() { | 2571 HValue* MostConstantOperand() { |
| 2560 if (IsCommutative() && left()->IsConstant()) return left(); | 2572 if (IsCommutative() && left()->IsConstant()) return left(); |
| 2561 return right(); | 2573 return right(); |
| 2562 } | 2574 } |
| 2563 | 2575 |
| 2564 virtual bool IsCommutative() const { return false; } | 2576 virtual bool IsCommutative() const { return false; } |
| 2565 | 2577 |
| 2566 virtual void PrintDataTo(StringStream* stream); | 2578 virtual void PrintDataTo(StringStream* stream); |
| 2567 }; | 2579 }; |
| 2568 | 2580 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2714 }; | 2726 }; |
| 2715 | 2727 |
| 2716 | 2728 |
| 2717 class HBitwiseBinaryOperation: public HBinaryOperation { | 2729 class HBitwiseBinaryOperation: public HBinaryOperation { |
| 2718 public: | 2730 public: |
| 2719 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) | 2731 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) |
| 2720 : HBinaryOperation(context, left, right) { | 2732 : HBinaryOperation(context, left, right) { |
| 2721 set_representation(Representation::Tagged()); | 2733 set_representation(Representation::Tagged()); |
| 2722 SetFlag(kFlexibleRepresentation); | 2734 SetFlag(kFlexibleRepresentation); |
| 2723 SetAllSideEffects(); | 2735 SetAllSideEffects(); |
| 2736 observed_input_representation_[0] = Representation::Tagged(); |
| 2737 observed_input_representation_[1] = Representation::None(); |
| 2738 observed_input_representation_[2] = Representation::None(); |
| 2724 } | 2739 } |
| 2725 | 2740 |
| 2726 virtual Representation RequiredInputRepresentation(int index) { | 2741 virtual Representation RequiredInputRepresentation(int index) { |
| 2727 return index == 0 | 2742 return index == 0 |
| 2728 ? Representation::Tagged() | 2743 ? Representation::Tagged() |
| 2729 : representation(); | 2744 : representation(); |
| 2730 } | 2745 } |
| 2731 | 2746 |
| 2732 virtual void RepresentationChanged(Representation to) { | 2747 virtual void RepresentationChanged(Representation to) { |
| 2733 if (!to.IsTagged()) { | 2748 if (!to.IsTagged()) { |
| 2734 ASSERT(to.IsInteger32()); | 2749 ASSERT(to.IsInteger32()); |
| 2735 ClearAllSideEffects(); | 2750 ClearAllSideEffects(); |
| 2736 SetFlag(kTruncatingToInt32); | 2751 SetFlag(kTruncatingToInt32); |
| 2737 SetFlag(kUseGVN); | 2752 SetFlag(kUseGVN); |
| 2738 } | 2753 } |
| 2739 } | 2754 } |
| 2740 | 2755 |
| 2741 virtual HType CalculateInferredType(); | 2756 virtual HType CalculateInferredType(); |
| 2742 | 2757 |
| 2758 virtual Representation ObservedInputRepresentation(int index) { |
| 2759 return observed_input_representation_[index]; |
| 2760 } |
| 2761 |
| 2762 void InitializeObservedInputRepresentation(Representation r) { |
| 2763 observed_input_representation_[1] = r; |
| 2764 observed_input_representation_[2] = r; |
| 2765 } |
| 2766 |
| 2743 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) | 2767 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
| 2768 private: |
| 2769 Representation observed_input_representation_[3]; |
| 2744 }; | 2770 }; |
| 2745 | 2771 |
| 2746 | 2772 |
| 2747 class HMathFloorOfDiv: public HBinaryOperation { | 2773 class HMathFloorOfDiv: public HBinaryOperation { |
| 2748 public: | 2774 public: |
| 2749 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 2775 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
| 2750 : HBinaryOperation(context, left, right) { | 2776 : HBinaryOperation(context, left, right) { |
| 2751 set_representation(Representation::Integer32()); | 2777 set_representation(Representation::Integer32()); |
| 2752 SetFlag(kUseGVN); | 2778 SetFlag(kUseGVN); |
| 2753 } | 2779 } |
| (...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5057 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 5083 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
| 5058 }; | 5084 }; |
| 5059 | 5085 |
| 5060 | 5086 |
| 5061 #undef DECLARE_INSTRUCTION | 5087 #undef DECLARE_INSTRUCTION |
| 5062 #undef DECLARE_CONCRETE_INSTRUCTION | 5088 #undef DECLARE_CONCRETE_INSTRUCTION |
| 5063 | 5089 |
| 5064 } } // namespace v8::internal | 5090 } } // namespace v8::internal |
| 5065 | 5091 |
| 5066 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5092 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |