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 3863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3874 | 3874 |
3875 class HBitwiseBinaryOperation : public HBinaryOperation { | 3875 class HBitwiseBinaryOperation : public HBinaryOperation { |
3876 public: | 3876 public: |
3877 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, | 3877 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
3878 HType type = HType::Tagged()) | 3878 HType type = HType::Tagged()) |
3879 : HBinaryOperation(context, left, right, type) { | 3879 : HBinaryOperation(context, left, right, type) { |
3880 SetFlag(kFlexibleRepresentation); | 3880 SetFlag(kFlexibleRepresentation); |
3881 SetFlag(kTruncatingToInt32); | 3881 SetFlag(kTruncatingToInt32); |
3882 SetFlag(kAllowUndefinedAsNaN); | 3882 SetFlag(kAllowUndefinedAsNaN); |
3883 SetAllSideEffects(); | 3883 SetAllSideEffects(); |
3884 if (left->IsForceRepresentation()) { | |
Sven Panne
2013/09/16 13:38:09
Why do we propagate back only to HForceRepresentat
oliv
2013/09/16 15:44:43
It is actually even wrong in the general case, sor
| |
3885 left->SetFlag(kTruncatingToInt32); | |
3886 } | |
3887 if (right->IsForceRepresentation()) { | |
3888 right->SetFlag(kTruncatingToInt32); | |
3889 } | |
3884 } | 3890 } |
3885 | 3891 |
3886 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { | 3892 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { |
3887 if (!to.IsTagged()) { | 3893 if (to.IsTagged()) { |
3888 ASSERT(to.IsSmiOrInteger32()); | 3894 SetAllSideEffects(); |
3895 ClearFlag(kUseGVN); | |
3896 } else { | |
3889 ClearAllSideEffects(); | 3897 ClearAllSideEffects(); |
3890 SetFlag(kUseGVN); | 3898 SetFlag(kUseGVN); |
3891 } else { | |
3892 SetAllSideEffects(); | |
3893 ClearFlag(kUseGVN); | |
3894 } | 3899 } |
3895 } | 3900 } |
3896 | 3901 |
3897 virtual void UpdateRepresentation(Representation new_rep, | 3902 virtual void UpdateRepresentation(Representation new_rep, |
3898 HInferRepresentationPhase* h_infer, | 3903 HInferRepresentationPhase* h_infer, |
3899 const char* reason) V8_OVERRIDE { | 3904 const char* reason) V8_OVERRIDE { |
3900 // We only generate either int32 or generic tagged bitwise operations. | 3905 // We only generate either int32 or generic tagged bitwise operations. |
3901 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); | 3906 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); |
3902 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 3907 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
3903 } | 3908 } |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4517 | 4522 |
4518 | 4523 |
4519 class HMul V8_FINAL : public HArithmeticBinaryOperation { | 4524 class HMul V8_FINAL : public HArithmeticBinaryOperation { |
4520 public: | 4525 public: |
4521 static HInstruction* New(Zone* zone, | 4526 static HInstruction* New(Zone* zone, |
4522 HValue* context, | 4527 HValue* context, |
4523 HValue* left, | 4528 HValue* left, |
4524 HValue* right); | 4529 HValue* right); |
4525 | 4530 |
4526 static HInstruction* NewImul(Zone* zone, | 4531 static HInstruction* NewImul(Zone* zone, |
4527 HValue* context, | 4532 HValue* context, |
4528 HValue* left, | 4533 HValue* left, |
4529 HValue* right) { | 4534 HValue* right) { |
4530 HMul* mul = new(zone) HMul(context, left, right); | 4535 HInstruction* instr = HMul::New(zone, context, left, right); |
4536 if (!instr->IsMul()) return instr; | |
4537 HMul* mul = HMul::cast(instr); | |
4531 // TODO(mstarzinger): Prevent bailout on minus zero for imul. | 4538 // TODO(mstarzinger): Prevent bailout on minus zero for imul. |
4532 mul->AssumeRepresentation(Representation::Integer32()); | 4539 mul->AssumeRepresentation(Representation::Integer32()); |
4533 mul->ClearFlag(HValue::kCanOverflow); | 4540 mul->ClearFlag(HValue::kCanOverflow); |
4534 return mul; | 4541 return mul; |
4535 } | 4542 } |
4536 | 4543 |
4537 virtual HValue* EnsureAndPropagateNotMinusZero( | 4544 virtual HValue* EnsureAndPropagateNotMinusZero( |
4538 BitVector* visited) V8_OVERRIDE; | 4545 BitVector* visited) V8_OVERRIDE; |
4539 | 4546 |
4540 virtual HValue* Canonicalize() V8_OVERRIDE; | 4547 virtual HValue* Canonicalize() V8_OVERRIDE; |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6487 | 6494 |
6488 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 6495 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
6489 | 6496 |
6490 protected: | 6497 protected: |
6491 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 6498 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
6492 | 6499 |
6493 private: | 6500 private: |
6494 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) | 6501 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) |
6495 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { | 6502 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { |
6496 set_representation(Representation::Tagged()); | 6503 set_representation(Representation::Tagged()); |
6497 SetFlag(kUseGVN); | 6504 if (flags_ == STRING_ADD_CHECK_NONE) { |
6498 SetGVNFlag(kDependsOnMaps); | 6505 SetFlag(kUseGVN); |
6499 SetGVNFlag(kChangesNewSpacePromotion); | 6506 SetGVNFlag(kDependsOnMaps); |
6507 SetGVNFlag(kChangesNewSpacePromotion); | |
6508 } else { | |
6509 SetAllSideEffects(); | |
6510 } | |
6500 } | 6511 } |
6501 | 6512 |
6502 // No side-effects except possible allocation. | 6513 // No side-effects except possible allocation. |
6503 // NOTE: this instruction _does not_ call ToString() on its inputs. | 6514 // NOTE: this instruction _does not_ call ToString() on its inputs. |
6504 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6515 virtual bool IsDeletable() const V8_OVERRIDE { |
6516 return flags_ == STRING_ADD_CHECK_NONE; | |
6517 } | |
6505 | 6518 |
6506 const StringAddFlags flags_; | 6519 const StringAddFlags flags_; |
6507 }; | 6520 }; |
6508 | 6521 |
6509 | 6522 |
6510 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { | 6523 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { |
6511 public: | 6524 public: |
6512 static HStringCharCodeAt* New(Zone* zone, | 6525 static HStringCharCodeAt* New(Zone* zone, |
6513 HValue* context, | 6526 HValue* context, |
6514 HValue* string, | 6527 HValue* string, |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6971 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6984 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
6972 }; | 6985 }; |
6973 | 6986 |
6974 | 6987 |
6975 #undef DECLARE_INSTRUCTION | 6988 #undef DECLARE_INSTRUCTION |
6976 #undef DECLARE_CONCRETE_INSTRUCTION | 6989 #undef DECLARE_CONCRETE_INSTRUCTION |
6977 | 6990 |
6978 } } // namespace v8::internal | 6991 } } // namespace v8::internal |
6979 | 6992 |
6980 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6993 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |