| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 V(MapEnumLength) \ | 148 V(MapEnumLength) \ |
| 149 V(MathFloorOfDiv) \ | 149 V(MathFloorOfDiv) \ |
| 150 V(MathMinMax) \ | 150 V(MathMinMax) \ |
| 151 V(Mod) \ | 151 V(Mod) \ |
| 152 V(Mul) \ | 152 V(Mul) \ |
| 153 V(OsrEntry) \ | 153 V(OsrEntry) \ |
| 154 V(OuterContext) \ | 154 V(OuterContext) \ |
| 155 V(Parameter) \ | 155 V(Parameter) \ |
| 156 V(Power) \ | 156 V(Power) \ |
| 157 V(PushArgument) \ | 157 V(PushArgument) \ |
| 158 V(Random) \ | |
| 159 V(RegExpLiteral) \ | 158 V(RegExpLiteral) \ |
| 160 V(Return) \ | 159 V(Return) \ |
| 161 V(Ror) \ | 160 V(Ror) \ |
| 162 V(Sar) \ | 161 V(Sar) \ |
| 163 V(SeqStringGetChar) \ | 162 V(SeqStringGetChar) \ |
| 164 V(SeqStringSetChar) \ | 163 V(SeqStringSetChar) \ |
| 165 V(Shl) \ | 164 V(Shl) \ |
| 166 V(Shr) \ | 165 V(Shr) \ |
| 167 V(Simulate) \ | 166 V(Simulate) \ |
| 168 V(StackCheck) \ | 167 V(StackCheck) \ |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 } | 1427 } |
| 1429 | 1428 |
| 1430 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1429 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1431 | 1430 |
| 1432 DECLARE_CONCRETE_INSTRUCTION(Goto) | 1431 DECLARE_CONCRETE_INSTRUCTION(Goto) |
| 1433 }; | 1432 }; |
| 1434 | 1433 |
| 1435 | 1434 |
| 1436 class HDeoptimize V8_FINAL : public HTemplateControlInstruction<1, 0> { | 1435 class HDeoptimize V8_FINAL : public HTemplateControlInstruction<1, 0> { |
| 1437 public: | 1436 public: |
| 1438 static HInstruction* New(Zone* zone, | 1437 static HDeoptimize* New(Zone* zone, |
| 1439 HValue* context, | 1438 HValue* context, |
| 1440 const char* reason, | 1439 const char* reason, |
| 1441 Deoptimizer::BailoutType type, | 1440 Deoptimizer::BailoutType type, |
| 1442 HBasicBlock* unreachable_continuation) { | 1441 HBasicBlock* unreachable_continuation) { |
| 1443 return new(zone) HDeoptimize(reason, type, unreachable_continuation); | 1442 return new(zone) HDeoptimize(reason, type, unreachable_continuation); |
| 1444 } | 1443 } |
| 1445 | 1444 |
| 1446 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { | 1445 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { |
| 1447 *block = NULL; | 1446 *block = NULL; |
| 1448 return true; | 1447 return true; |
| 1449 } | 1448 } |
| 1450 | 1449 |
| 1451 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1450 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1452 return Representation::None(); | 1451 return Representation::None(); |
| (...skipping 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4023 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; } | 4022 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; } |
| 4024 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { | 4023 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { |
| 4025 return skip_check(); | 4024 return skip_check(); |
| 4026 } | 4025 } |
| 4027 | 4026 |
| 4028 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 4027 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
| 4029 | 4028 |
| 4030 protected: | 4029 protected: |
| 4031 friend class HBoundsCheckBaseIndexInformation; | 4030 friend class HBoundsCheckBaseIndexInformation; |
| 4032 | 4031 |
| 4032 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
| 4033 |
| 4033 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4034 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 4034 bool skip_check_; | 4035 bool skip_check_; |
| 4035 HValue* base_; | 4036 HValue* base_; |
| 4036 int offset_; | 4037 int offset_; |
| 4037 int scale_; | 4038 int scale_; |
| 4038 bool allow_equality_; | 4039 bool allow_equality_; |
| 4039 | 4040 |
| 4040 private: | 4041 private: |
| 4041 // Normally HBoundsCheck should be created using the | 4042 // Normally HBoundsCheck should be created using the |
| 4042 // HGraphBuilder::AddBoundsCheck() helper. | 4043 // HGraphBuilder::AddBoundsCheck() helper. |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4717 SetFlag(kUseGVN); | 4718 SetFlag(kUseGVN); |
| 4718 SetGVNFlag(kChangesNewSpacePromotion); | 4719 SetGVNFlag(kChangesNewSpacePromotion); |
| 4719 } | 4720 } |
| 4720 | 4721 |
| 4721 virtual bool IsDeletable() const V8_OVERRIDE { | 4722 virtual bool IsDeletable() const V8_OVERRIDE { |
| 4722 return !right()->representation().IsTagged(); | 4723 return !right()->representation().IsTagged(); |
| 4723 } | 4724 } |
| 4724 }; | 4725 }; |
| 4725 | 4726 |
| 4726 | 4727 |
| 4727 class HRandom V8_FINAL : public HTemplateInstruction<1> { | |
| 4728 public: | |
| 4729 DECLARE_INSTRUCTION_FACTORY_P1(HRandom, HValue*); | |
| 4730 | |
| 4731 HValue* global_object() { return OperandAt(0); } | |
| 4732 | |
| 4733 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
| 4734 return Representation::Tagged(); | |
| 4735 } | |
| 4736 | |
| 4737 DECLARE_CONCRETE_INSTRUCTION(Random) | |
| 4738 | |
| 4739 private: | |
| 4740 explicit HRandom(HValue* global_object) { | |
| 4741 SetOperandAt(0, global_object); | |
| 4742 set_representation(Representation::Double()); | |
| 4743 } | |
| 4744 | |
| 4745 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | |
| 4746 }; | |
| 4747 | |
| 4748 | |
| 4749 class HAdd V8_FINAL : public HArithmeticBinaryOperation { | 4728 class HAdd V8_FINAL : public HArithmeticBinaryOperation { |
| 4750 public: | 4729 public: |
| 4751 static HInstruction* New(Zone* zone, | 4730 static HInstruction* New(Zone* zone, |
| 4752 HValue* context, | 4731 HValue* context, |
| 4753 HValue* left, | 4732 HValue* left, |
| 4754 HValue* right); | 4733 HValue* right); |
| 4755 | 4734 |
| 4756 // Add is only commutative if two integer values are added and not if two | 4735 // Add is only commutative if two integer values are added and not if two |
| 4757 // tagged values are added (because it might be a String concatenation). | 4736 // tagged values are added (because it might be a String concatenation). |
| 4737 // We also do not commute (pointer + offset). |
| 4758 virtual bool IsCommutative() const V8_OVERRIDE { | 4738 virtual bool IsCommutative() const V8_OVERRIDE { |
| 4759 return !representation().IsTagged(); | 4739 return !representation().IsTagged() && !representation().IsExternal(); |
| 4760 } | 4740 } |
| 4761 | 4741 |
| 4762 virtual HValue* EnsureAndPropagateNotMinusZero( | 4742 virtual HValue* EnsureAndPropagateNotMinusZero( |
| 4763 BitVector* visited) V8_OVERRIDE; | 4743 BitVector* visited) V8_OVERRIDE; |
| 4764 | 4744 |
| 4765 virtual HValue* Canonicalize() V8_OVERRIDE; | 4745 virtual HValue* Canonicalize() V8_OVERRIDE; |
| 4766 | 4746 |
| 4767 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4747 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { |
| 4768 if (left()->IsInteger32Constant()) { | 4748 if (left()->IsInteger32Constant()) { |
| 4769 decomposition->Apply(right(), left()->GetInteger32Constant()); | 4749 decomposition->Apply(right(), left()->GetInteger32Constant()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4785 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || | 4765 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
| 4786 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { | 4766 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { |
| 4787 SetAllSideEffects(); | 4767 SetAllSideEffects(); |
| 4788 ClearFlag(kUseGVN); | 4768 ClearFlag(kUseGVN); |
| 4789 } else { | 4769 } else { |
| 4790 ClearAllSideEffects(); | 4770 ClearAllSideEffects(); |
| 4791 SetFlag(kUseGVN); | 4771 SetFlag(kUseGVN); |
| 4792 } | 4772 } |
| 4793 } | 4773 } |
| 4794 | 4774 |
| 4775 virtual Representation RepresentationFromInputs() V8_OVERRIDE; |
| 4776 |
| 4777 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE; |
| 4778 |
| 4795 DECLARE_CONCRETE_INSTRUCTION(Add) | 4779 DECLARE_CONCRETE_INSTRUCTION(Add) |
| 4796 | 4780 |
| 4797 protected: | 4781 protected: |
| 4798 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4782 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 4799 | 4783 |
| 4800 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4784 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
| 4801 | 4785 |
| 4802 private: | 4786 private: |
| 4803 HAdd(HValue* context, HValue* left, HValue* right) | 4787 HAdd(HValue* context, HValue* left, HValue* right) |
| 4804 : HArithmeticBinaryOperation(context, left, right) { | 4788 : HArithmeticBinaryOperation(context, left, right) { |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6078 static HObjectAccess ForBackingStoreOffset(int offset, | 6062 static HObjectAccess ForBackingStoreOffset(int offset, |
| 6079 Representation representation = Representation::Tagged()); | 6063 Representation representation = Representation::Tagged()); |
| 6080 | 6064 |
| 6081 // Create an access to a resolved field (in-object or backing store). | 6065 // Create an access to a resolved field (in-object or backing store). |
| 6082 static HObjectAccess ForField(Handle<Map> map, | 6066 static HObjectAccess ForField(Handle<Map> map, |
| 6083 LookupResult *lookup, Handle<String> name = Handle<String>::null()); | 6067 LookupResult *lookup, Handle<String> name = Handle<String>::null()); |
| 6084 | 6068 |
| 6085 // Create an access for the payload of a Cell or JSGlobalPropertyCell. | 6069 // Create an access for the payload of a Cell or JSGlobalPropertyCell. |
| 6086 static HObjectAccess ForCellPayload(Isolate* isolate); | 6070 static HObjectAccess ForCellPayload(Isolate* isolate); |
| 6087 | 6071 |
| 6072 static HObjectAccess ForJSTypedArrayLength() { |
| 6073 return HObjectAccess::ForJSObjectOffset(JSTypedArray::kLengthOffset); |
| 6074 } |
| 6075 |
| 6076 static HObjectAccess ForJSArrayBufferBackingStore() { |
| 6077 return HObjectAccess::ForJSObjectOffset( |
| 6078 JSArrayBuffer::kBackingStoreOffset, Representation::External()); |
| 6079 } |
| 6080 |
| 6081 static HObjectAccess ForExternalArrayExternalPointer() { |
| 6082 return HObjectAccess::ForJSObjectOffset( |
| 6083 ExternalArray::kExternalPointerOffset, Representation::External()); |
| 6084 } |
| 6085 |
| 6086 static HObjectAccess ForJSArrayBufferViewWeakNext() { |
| 6087 return HObjectAccess::ForJSObjectOffset(JSArrayBufferView::kWeakNextOffset); |
| 6088 } |
| 6089 |
| 6090 static HObjectAccess ForJSArrayBufferWeakFirstView() { |
| 6091 return HObjectAccess::ForJSObjectOffset( |
| 6092 JSArrayBuffer::kWeakFirstViewOffset); |
| 6093 } |
| 6094 |
| 6095 static HObjectAccess ForJSArrayBufferViewBuffer() { |
| 6096 return HObjectAccess::ForJSObjectOffset(JSArrayBufferView::kBufferOffset); |
| 6097 } |
| 6098 |
| 6099 static HObjectAccess ForJSArrayBufferViewByteOffset() { |
| 6100 return HObjectAccess::ForJSObjectOffset( |
| 6101 JSArrayBufferView::kByteOffsetOffset); |
| 6102 } |
| 6103 |
| 6104 static HObjectAccess ForJSArrayBufferViewByteLength() { |
| 6105 return HObjectAccess::ForJSObjectOffset( |
| 6106 JSArrayBufferView::kByteLengthOffset); |
| 6107 } |
| 6108 |
| 6088 void PrintTo(StringStream* stream); | 6109 void PrintTo(StringStream* stream); |
| 6089 | 6110 |
| 6090 inline bool Equals(HObjectAccess that) const { | 6111 inline bool Equals(HObjectAccess that) const { |
| 6091 return value_ == that.value_; // portion and offset must match | 6112 return value_ == that.value_; // portion and offset must match |
| 6092 } | 6113 } |
| 6093 | 6114 |
| 6094 protected: | 6115 protected: |
| 6095 void SetGVNFlags(HValue *instr, bool is_store); | 6116 void SetGVNFlags(HValue *instr, bool is_store); |
| 6096 | 6117 |
| 6097 private: | 6118 private: |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6494 } else if (index == 1) { | 6515 } else if (index == 1) { |
| 6495 if (field_representation().IsInteger8() || | 6516 if (field_representation().IsInteger8() || |
| 6496 field_representation().IsUInteger8() || | 6517 field_representation().IsUInteger8() || |
| 6497 field_representation().IsInteger16() || | 6518 field_representation().IsInteger16() || |
| 6498 field_representation().IsUInteger16() || | 6519 field_representation().IsUInteger16() || |
| 6499 field_representation().IsInteger32()) { | 6520 field_representation().IsInteger32()) { |
| 6500 return Representation::Integer32(); | 6521 return Representation::Integer32(); |
| 6501 } else if (field_representation().IsDouble() || | 6522 } else if (field_representation().IsDouble() || |
| 6502 field_representation().IsSmi()) { | 6523 field_representation().IsSmi()) { |
| 6503 return field_representation(); | 6524 return field_representation(); |
| 6525 } else if (field_representation().IsExternal()) { |
| 6526 return Representation::External(); |
| 6504 } | 6527 } |
| 6505 } | 6528 } |
| 6506 return Representation::Tagged(); | 6529 return Representation::Tagged(); |
| 6507 } | 6530 } |
| 6508 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6531 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
| 6509 HValue* dominator) V8_OVERRIDE { | 6532 HValue* dominator) V8_OVERRIDE { |
| 6510 ASSERT(side_effect == kChangesNewSpacePromotion); | 6533 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 6511 new_space_dominator_ = dominator; | 6534 new_space_dominator_ = dominator; |
| 6512 } | 6535 } |
| 6513 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6536 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7450 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7473 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7451 }; | 7474 }; |
| 7452 | 7475 |
| 7453 | 7476 |
| 7454 #undef DECLARE_INSTRUCTION | 7477 #undef DECLARE_INSTRUCTION |
| 7455 #undef DECLARE_CONCRETE_INSTRUCTION | 7478 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7456 | 7479 |
| 7457 } } // namespace v8::internal | 7480 } } // namespace v8::internal |
| 7458 | 7481 |
| 7459 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7482 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |