Chromium Code Reviews| 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 4737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4748 | 4748 |
| 4749 class HAdd V8_FINAL : public HArithmeticBinaryOperation { | 4749 class HAdd V8_FINAL : public HArithmeticBinaryOperation { |
| 4750 public: | 4750 public: |
| 4751 static HInstruction* New(Zone* zone, | 4751 static HInstruction* New(Zone* zone, |
| 4752 HValue* context, | 4752 HValue* context, |
| 4753 HValue* left, | 4753 HValue* left, |
| 4754 HValue* right); | 4754 HValue* right); |
| 4755 | 4755 |
| 4756 // Add is only commutative if two integer values are added and not if two | 4756 // 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). | 4757 // tagged values are added (because it might be a String concatenation). |
| 4758 // We also do not commute (pointer + offset). | |
| 4758 virtual bool IsCommutative() const V8_OVERRIDE { | 4759 virtual bool IsCommutative() const V8_OVERRIDE { |
| 4759 return !representation().IsTagged(); | 4760 return !representation().IsTagged() && !representation().IsExternal(); |
| 4760 } | 4761 } |
| 4761 | 4762 |
| 4762 virtual HValue* EnsureAndPropagateNotMinusZero( | 4763 virtual HValue* EnsureAndPropagateNotMinusZero( |
| 4763 BitVector* visited) V8_OVERRIDE; | 4764 BitVector* visited) V8_OVERRIDE; |
| 4764 | 4765 |
| 4765 virtual HValue* Canonicalize() V8_OVERRIDE; | 4766 virtual HValue* Canonicalize() V8_OVERRIDE; |
| 4766 | 4767 |
| 4767 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { | 4768 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { |
| 4768 if (left()->IsInteger32Constant()) { | 4769 if (left()->IsInteger32Constant()) { |
| 4769 decomposition->Apply(right(), left()->GetInteger32Constant()); | 4770 decomposition->Apply(right(), left()->GetInteger32Constant()); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 4785 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || | 4786 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
| 4786 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { | 4787 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { |
| 4787 SetAllSideEffects(); | 4788 SetAllSideEffects(); |
| 4788 ClearFlag(kUseGVN); | 4789 ClearFlag(kUseGVN); |
| 4789 } else { | 4790 } else { |
| 4790 ClearAllSideEffects(); | 4791 ClearAllSideEffects(); |
| 4791 SetFlag(kUseGVN); | 4792 SetFlag(kUseGVN); |
| 4792 } | 4793 } |
| 4793 } | 4794 } |
| 4794 | 4795 |
| 4796 virtual Representation RepresentationFromInputs() V8_OVERRIDE; | |
| 4797 | |
| 4798 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE; | |
| 4799 | |
| 4795 DECLARE_CONCRETE_INSTRUCTION(Add) | 4800 DECLARE_CONCRETE_INSTRUCTION(Add) |
| 4796 | 4801 |
| 4797 protected: | 4802 protected: |
| 4798 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4803 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 4799 | 4804 |
| 4800 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 4805 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
| 4801 | 4806 |
| 4802 private: | 4807 private: |
| 4803 HAdd(HValue* context, HValue* left, HValue* right) | 4808 HAdd(HValue* context, HValue* left, HValue* right) |
| 4804 : HArithmeticBinaryOperation(context, left, right) { | 4809 : HArithmeticBinaryOperation(context, left, right) { |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6078 static HObjectAccess ForBackingStoreOffset(int offset, | 6083 static HObjectAccess ForBackingStoreOffset(int offset, |
| 6079 Representation representation = Representation::Tagged()); | 6084 Representation representation = Representation::Tagged()); |
| 6080 | 6085 |
| 6081 // Create an access to a resolved field (in-object or backing store). | 6086 // Create an access to a resolved field (in-object or backing store). |
| 6082 static HObjectAccess ForField(Handle<Map> map, | 6087 static HObjectAccess ForField(Handle<Map> map, |
| 6083 LookupResult *lookup, Handle<String> name = Handle<String>::null()); | 6088 LookupResult *lookup, Handle<String> name = Handle<String>::null()); |
| 6084 | 6089 |
| 6085 // Create an access for the payload of a Cell or JSGlobalPropertyCell. | 6090 // Create an access for the payload of a Cell or JSGlobalPropertyCell. |
| 6086 static HObjectAccess ForCellPayload(Isolate* isolate); | 6091 static HObjectAccess ForCellPayload(Isolate* isolate); |
| 6087 | 6092 |
| 6093 static HObjectAccess ForJSTypedArrayLength() { | |
| 6094 return HObjectAccess::ForJSObjectOffset(JSTypedArray::kLengthOffset); | |
| 6095 } | |
| 6096 | |
| 6097 static HObjectAccess ForJSArrayBufferBackingStore() { | |
| 6098 return HObjectAccess::ForJSObjectOffset( | |
| 6099 JSArrayBuffer::kBackingStoreOffset, Representation::External()); | |
| 6100 } | |
| 6101 | |
| 6102 static HObjectAccess ForExternalArrayExternalPointer() { | |
| 6103 return HObjectAccess::ForJSObjectOffset( | |
| 6104 ExternalArray::kExternalPointerOffset, Representation::External()); | |
| 6105 } | |
| 6106 | |
| 6107 | |
|
danno
2013/11/25 11:44:13
nit: perhaps only one line between functions
| |
| 6108 static HObjectAccess ForJSArrayBufferViewWeakNext() { | |
| 6109 return HObjectAccess::ForJSObjectOffset(JSArrayBufferView::kWeakNextOffset); | |
| 6110 } | |
| 6111 | |
| 6112 static HObjectAccess ForJSArrayBufferWeakFirstView() { | |
| 6113 return HObjectAccess::ForJSObjectOffset( | |
| 6114 JSArrayBuffer::kWeakFirstViewOffset); | |
| 6115 } | |
| 6116 | |
| 6117 static HObjectAccess ForJSArrayBufferViewBuffer() { | |
| 6118 return HObjectAccess::ForJSObjectOffset(JSArrayBufferView::kBufferOffset); | |
| 6119 } | |
| 6120 | |
| 6121 static HObjectAccess ForJSArrayBufferViewByteOffset() { | |
| 6122 return HObjectAccess::ForJSObjectOffset( | |
| 6123 JSArrayBufferView::kByteOffsetOffset); | |
| 6124 } | |
| 6125 | |
| 6126 static HObjectAccess ForJSArrayBufferViewByteLength() { | |
| 6127 return HObjectAccess::ForJSObjectOffset( | |
| 6128 JSArrayBufferView::kByteLengthOffset); | |
| 6129 } | |
| 6088 void PrintTo(StringStream* stream); | 6130 void PrintTo(StringStream* stream); |
|
danno
2013/11/25 11:44:13
nit: perhaps one line above?
| |
| 6089 | 6131 |
| 6090 inline bool Equals(HObjectAccess that) const { | 6132 inline bool Equals(HObjectAccess that) const { |
| 6091 return value_ == that.value_; // portion and offset must match | 6133 return value_ == that.value_; // portion and offset must match |
| 6092 } | 6134 } |
| 6093 | 6135 |
| 6094 protected: | 6136 protected: |
| 6095 void SetGVNFlags(HValue *instr, bool is_store); | 6137 void SetGVNFlags(HValue *instr, bool is_store); |
| 6096 | 6138 |
| 6097 private: | 6139 private: |
| 6098 // internal use only; different parts of an object or array | 6140 // internal use only; different parts of an object or array |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6494 } else if (index == 1) { | 6536 } else if (index == 1) { |
| 6495 if (field_representation().IsInteger8() || | 6537 if (field_representation().IsInteger8() || |
| 6496 field_representation().IsUInteger8() || | 6538 field_representation().IsUInteger8() || |
| 6497 field_representation().IsInteger16() || | 6539 field_representation().IsInteger16() || |
| 6498 field_representation().IsUInteger16() || | 6540 field_representation().IsUInteger16() || |
| 6499 field_representation().IsInteger32()) { | 6541 field_representation().IsInteger32()) { |
| 6500 return Representation::Integer32(); | 6542 return Representation::Integer32(); |
| 6501 } else if (field_representation().IsDouble() || | 6543 } else if (field_representation().IsDouble() || |
| 6502 field_representation().IsSmi()) { | 6544 field_representation().IsSmi()) { |
| 6503 return field_representation(); | 6545 return field_representation(); |
| 6546 } else if (field_representation().IsExternal()) { | |
| 6547 return Representation::External(); | |
| 6504 } | 6548 } |
| 6505 } | 6549 } |
| 6506 return Representation::Tagged(); | 6550 return Representation::Tagged(); |
| 6507 } | 6551 } |
| 6508 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6552 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
| 6509 HValue* dominator) V8_OVERRIDE { | 6553 HValue* dominator) V8_OVERRIDE { |
| 6510 ASSERT(side_effect == kChangesNewSpacePromotion); | 6554 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 6511 new_space_dominator_ = dominator; | 6555 new_space_dominator_ = dominator; |
| 6512 } | 6556 } |
| 6513 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6557 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; } | 7494 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7451 }; | 7495 }; |
| 7452 | 7496 |
| 7453 | 7497 |
| 7454 #undef DECLARE_INSTRUCTION | 7498 #undef DECLARE_INSTRUCTION |
| 7455 #undef DECLARE_CONCRETE_INSTRUCTION | 7499 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7456 | 7500 |
| 7457 } } // namespace v8::internal | 7501 } } // namespace v8::internal |
| 7458 | 7502 |
| 7459 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7503 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |