Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: src/hydrogen-instructions.h

Issue 23503058: Hydrogen binop improvements (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix a comment Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 1200
1201 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1201 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1202 1202
1203 HBasicBlock* FirstSuccessor() { 1203 HBasicBlock* FirstSuccessor() {
1204 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; 1204 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL;
1205 } 1205 }
1206 HBasicBlock* SecondSuccessor() { 1206 HBasicBlock* SecondSuccessor() {
1207 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; 1207 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL;
1208 } 1208 }
1209 1209
1210 void Not() {
1211 HBasicBlock* swap = SuccessorAt(0);
1212 SetSuccessorAt(0, SuccessorAt(1));
1213 SetSuccessorAt(1, swap);
1214 }
1215
1210 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) 1216 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction)
1211 }; 1217 };
1212 1218
1213 1219
1214 class HSuccessorIterator V8_FINAL BASE_EMBEDDED { 1220 class HSuccessorIterator V8_FINAL BASE_EMBEDDED {
1215 public: 1221 public:
1216 explicit HSuccessorIterator(HControlInstruction* instr) 1222 explicit HSuccessorIterator(HControlInstruction* instr)
1217 : instr_(instr), current_(0) { } 1223 : instr_(instr), current_(0) { }
1218 1224
1219 bool Done() { return current_ >= instr_->SuccessorCount(); } 1225 bool Done() { return current_ >= instr_->SuccessorCount(); }
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after
3900 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, 3906 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right,
3901 HType type = HType::Tagged()) 3907 HType type = HType::Tagged())
3902 : HBinaryOperation(context, left, right, type) { 3908 : HBinaryOperation(context, left, right, type) {
3903 SetFlag(kFlexibleRepresentation); 3909 SetFlag(kFlexibleRepresentation);
3904 SetFlag(kTruncatingToInt32); 3910 SetFlag(kTruncatingToInt32);
3905 SetFlag(kAllowUndefinedAsNaN); 3911 SetFlag(kAllowUndefinedAsNaN);
3906 SetAllSideEffects(); 3912 SetAllSideEffects();
3907 } 3913 }
3908 3914
3909 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 3915 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
3910 if (!to.IsTagged()) { 3916 if (to.IsTagged()) {
3917 SetAllSideEffects();
3918 ClearFlag(kUseGVN);
3919 } else {
3911 ASSERT(to.IsSmiOrInteger32()); 3920 ASSERT(to.IsSmiOrInteger32());
3912 ClearAllSideEffects(); 3921 ClearAllSideEffects();
3913 SetFlag(kUseGVN); 3922 SetFlag(kUseGVN);
3914 } else {
3915 SetAllSideEffects();
3916 ClearFlag(kUseGVN);
3917 } 3923 }
3918 } 3924 }
3919 3925
3920 virtual void UpdateRepresentation(Representation new_rep, 3926 virtual void UpdateRepresentation(Representation new_rep,
3921 HInferRepresentationPhase* h_infer, 3927 HInferRepresentationPhase* h_infer,
3922 const char* reason) V8_OVERRIDE { 3928 const char* reason) V8_OVERRIDE {
3923 // We only generate either int32 or generic tagged bitwise operations. 3929 // We only generate either int32 or generic tagged bitwise operations.
3924 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); 3930 if (new_rep.IsDouble()) new_rep = Representation::Integer32();
3925 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 3931 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
3926 } 3932 }
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
4584 4590
4585 4591
4586 class HMul V8_FINAL : public HArithmeticBinaryOperation { 4592 class HMul V8_FINAL : public HArithmeticBinaryOperation {
4587 public: 4593 public:
4588 static HInstruction* New(Zone* zone, 4594 static HInstruction* New(Zone* zone,
4589 HValue* context, 4595 HValue* context,
4590 HValue* left, 4596 HValue* left,
4591 HValue* right); 4597 HValue* right);
4592 4598
4593 static HInstruction* NewImul(Zone* zone, 4599 static HInstruction* NewImul(Zone* zone,
4594 HValue* context, 4600 HValue* context,
4595 HValue* left, 4601 HValue* left,
4596 HValue* right) { 4602 HValue* right) {
4597 HMul* mul = new(zone) HMul(context, left, right); 4603 HInstruction* instr = HMul::New(zone, context, left, right);
4604 if (!instr->IsMul()) return instr;
4605 HMul* mul = HMul::cast(instr);
4598 // TODO(mstarzinger): Prevent bailout on minus zero for imul. 4606 // TODO(mstarzinger): Prevent bailout on minus zero for imul.
4599 mul->AssumeRepresentation(Representation::Integer32()); 4607 mul->AssumeRepresentation(Representation::Integer32());
4600 mul->ClearFlag(HValue::kCanOverflow); 4608 mul->ClearFlag(HValue::kCanOverflow);
4601 return mul; 4609 return mul;
4602 } 4610 }
4603 4611
4604 virtual HValue* EnsureAndPropagateNotMinusZero( 4612 virtual HValue* EnsureAndPropagateNotMinusZero(
4605 BitVector* visited) V8_OVERRIDE; 4613 BitVector* visited) V8_OVERRIDE;
4606 4614
4607 virtual HValue* Canonicalize() V8_OVERRIDE; 4615 virtual HValue* Canonicalize() V8_OVERRIDE;
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
6565 6573
6566 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 6574 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
6567 6575
6568 protected: 6576 protected:
6569 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 6577 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
6570 6578
6571 private: 6579 private:
6572 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags) 6580 HStringAdd(HValue* context, HValue* left, HValue* right, StringAddFlags flags)
6573 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) { 6581 : HBinaryOperation(context, left, right, HType::String()), flags_(flags) {
6574 set_representation(Representation::Tagged()); 6582 set_representation(Representation::Tagged());
6575 SetFlag(kUseGVN); 6583 if (flags_ == STRING_ADD_CHECK_NONE) {
6576 SetGVNFlag(kDependsOnMaps); 6584 SetFlag(kUseGVN);
6577 SetGVNFlag(kChangesNewSpacePromotion); 6585 SetGVNFlag(kDependsOnMaps);
6586 SetGVNFlag(kChangesNewSpacePromotion);
6587 } else {
6588 SetAllSideEffects();
6589 }
6578 } 6590 }
6579 6591
6580 // No side-effects except possible allocation. 6592 // No side-effects except possible allocation:
6581 // NOTE: this instruction _does not_ call ToString() on its inputs. 6593 // NOTE: this instruction does not call ToString() on its inputs, when flags_
6582 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6594 // is set to STRING_ADD_CHECK_NONE.
6595 virtual bool IsDeletable() const V8_OVERRIDE {
6596 return flags_ == STRING_ADD_CHECK_NONE;
6597 }
6583 6598
6584 const StringAddFlags flags_; 6599 const StringAddFlags flags_;
6585 }; 6600 };
6586 6601
6587 6602
6588 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> { 6603 class HStringCharCodeAt V8_FINAL : public HTemplateInstruction<3> {
6589 public: 6604 public:
6590 static HStringCharCodeAt* New(Zone* zone, 6605 static HStringCharCodeAt* New(Zone* zone,
6591 HValue* context, 6606 HValue* context,
6592 HValue* string, 6607 HValue* string,
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
7048 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7063 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7049 }; 7064 };
7050 7065
7051 7066
7052 #undef DECLARE_INSTRUCTION 7067 #undef DECLARE_INSTRUCTION
7053 #undef DECLARE_CONCRETE_INSTRUCTION 7068 #undef DECLARE_CONCRETE_INSTRUCTION
7054 7069
7055 } } // namespace v8::internal 7070 } } // namespace v8::internal
7056 7071
7057 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7072 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698