OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "allocation.h" | 10 #include "allocation.h" |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 // Set after an instruction is killed. | 612 // Set after an instruction is killed. |
613 kIsDead, | 613 kIsDead, |
614 // Instructions that are allowed to produce full range unsigned integer | 614 // Instructions that are allowed to produce full range unsigned integer |
615 // values are marked with kUint32 flag. If arithmetic shift or a load from | 615 // values are marked with kUint32 flag. If arithmetic shift or a load from |
616 // EXTERNAL_UINT32_ELEMENTS array is not marked with this flag | 616 // EXTERNAL_UINT32_ELEMENTS array is not marked with this flag |
617 // it will deoptimize if result does not fit into signed integer range. | 617 // it will deoptimize if result does not fit into signed integer range. |
618 // HGraph::ComputeSafeUint32Operations is responsible for setting this | 618 // HGraph::ComputeSafeUint32Operations is responsible for setting this |
619 // flag. | 619 // flag. |
620 kUint32, | 620 kUint32, |
621 kHasNoObservableSideEffects, | 621 kHasNoObservableSideEffects, |
| 622 // Indicates an instruction shouldn't be replaced by optimization, this flag |
| 623 // is useful to set in cases where recomputing a value is cheaper than |
| 624 // extending the value's live range and spilling it. |
| 625 kCantBeReplaced, |
622 // Indicates the instruction is live during dead code elimination. | 626 // Indicates the instruction is live during dead code elimination. |
623 kIsLive, | 627 kIsLive, |
624 | 628 |
625 // HEnvironmentMarkers are deleted before dead code | 629 // HEnvironmentMarkers are deleted before dead code |
626 // elimination takes place, so they can repurpose the kIsLive flag: | 630 // elimination takes place, so they can repurpose the kIsLive flag: |
627 kEndsLiveRange = kIsLive, | 631 kEndsLiveRange = kIsLive, |
628 | 632 |
629 // TODO(everyone): Don't forget to update this! | 633 // TODO(everyone): Don't forget to update this! |
630 kLastFlag = kIsLive | 634 kLastFlag = kIsLive |
631 }; | 635 }; |
(...skipping 5618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6250 if (index == 0 && access().IsExternalMemory()) { | 6254 if (index == 0 && access().IsExternalMemory()) { |
6251 // object must be external in case of external memory access | 6255 // object must be external in case of external memory access |
6252 return Representation::External(); | 6256 return Representation::External(); |
6253 } | 6257 } |
6254 return Representation::Tagged(); | 6258 return Representation::Tagged(); |
6255 } | 6259 } |
6256 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 6260 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
6257 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6261 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
6258 | 6262 |
6259 bool CanBeReplacedWith(HValue* other) const { | 6263 bool CanBeReplacedWith(HValue* other) const { |
| 6264 if (!CheckFlag(HValue::kCantBeReplaced)) return false; |
6260 if (!type().Equals(other->type())) return false; | 6265 if (!type().Equals(other->type())) return false; |
6261 if (!representation().Equals(other->representation())) return false; | 6266 if (!representation().Equals(other->representation())) return false; |
6262 if (!other->IsLoadNamedField()) return true; | 6267 if (!other->IsLoadNamedField()) return true; |
6263 HLoadNamedField* that = HLoadNamedField::cast(other); | 6268 HLoadNamedField* that = HLoadNamedField::cast(other); |
6264 if (this->maps_ == that->maps_) return true; | 6269 if (this->maps_ == that->maps_) return true; |
6265 if (this->maps_ == NULL || that->maps_ == NULL) return false; | 6270 if (this->maps_ == NULL || that->maps_ == NULL) return false; |
6266 return this->maps_->IsSubset(that->maps_); | 6271 return this->maps_->IsSubset(that->maps_); |
6267 } | 6272 } |
6268 | 6273 |
6269 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 6274 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7708 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7713 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7709 }; | 7714 }; |
7710 | 7715 |
7711 | 7716 |
7712 #undef DECLARE_INSTRUCTION | 7717 #undef DECLARE_INSTRUCTION |
7713 #undef DECLARE_CONCRETE_INSTRUCTION | 7718 #undef DECLARE_CONCRETE_INSTRUCTION |
7714 | 7719 |
7715 } } // namespace v8::internal | 7720 } } // namespace v8::internal |
7716 | 7721 |
7717 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7722 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |