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 // 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 // Set after an instruction is killed. | 611 // Set after an instruction is killed. |
| 612 kIsDead, | 612 kIsDead, |
| 613 // Instructions that are allowed to produce full range unsigned integer | 613 // Instructions that are allowed to produce full range unsigned integer |
| 614 // values are marked with kUint32 flag. If arithmetic shift or a load from | 614 // values are marked with kUint32 flag. If arithmetic shift or a load from |
| 615 // EXTERNAL_UINT32_ELEMENTS array is not marked with this flag | 615 // EXTERNAL_UINT32_ELEMENTS array is not marked with this flag |
| 616 // it will deoptimize if result does not fit into signed integer range. | 616 // it will deoptimize if result does not fit into signed integer range. |
| 617 // HGraph::ComputeSafeUint32Operations is responsible for setting this | 617 // HGraph::ComputeSafeUint32Operations is responsible for setting this |
| 618 // flag. | 618 // flag. |
| 619 kUint32, | 619 kUint32, |
| 620 kHasNoObservableSideEffects, | 620 kHasNoObservableSideEffects, |
| 621 // Indicates an instruction shouldn't be replaced by optimization. | |
|
mvstanton
2014/05/09 13:16:49
Or alternatively, instead of commenting the usage
danno
2014/05/09 15:51:25
Done.
| |
| 622 kCantBeReplaced, | |
| 621 // Indicates the instruction is live during dead code elimination. | 623 // Indicates the instruction is live during dead code elimination. |
| 622 kIsLive, | 624 kIsLive, |
| 623 | 625 |
| 624 // HEnvironmentMarkers are deleted before dead code | 626 // HEnvironmentMarkers are deleted before dead code |
| 625 // elimination takes place, so they can repurpose the kIsLive flag: | 627 // elimination takes place, so they can repurpose the kIsLive flag: |
| 626 kEndsLiveRange = kIsLive, | 628 kEndsLiveRange = kIsLive, |
| 627 | 629 |
| 628 // TODO(everyone): Don't forget to update this! | 630 // TODO(everyone): Don't forget to update this! |
| 629 kLastFlag = kIsLive | 631 kLastFlag = kIsLive |
| 630 }; | 632 }; |
| (...skipping 5607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6238 if (index == 0 && access().IsExternalMemory()) { | 6240 if (index == 0 && access().IsExternalMemory()) { |
| 6239 // object must be external in case of external memory access | 6241 // object must be external in case of external memory access |
| 6240 return Representation::External(); | 6242 return Representation::External(); |
| 6241 } | 6243 } |
| 6242 return Representation::Tagged(); | 6244 return Representation::Tagged(); |
| 6243 } | 6245 } |
| 6244 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | 6246 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; |
| 6245 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6247 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6246 | 6248 |
| 6247 bool CanBeReplacedWith(HValue* other) const { | 6249 bool CanBeReplacedWith(HValue* other) const { |
| 6250 if (!CheckFlag(HValue::kCantBeReplaced)) return false; | |
| 6248 if (!type().Equals(other->type())) return false; | 6251 if (!type().Equals(other->type())) return false; |
| 6249 if (!representation().Equals(other->representation())) return false; | 6252 if (!representation().Equals(other->representation())) return false; |
| 6250 if (!other->IsLoadNamedField()) return true; | 6253 if (!other->IsLoadNamedField()) return true; |
| 6251 HLoadNamedField* that = HLoadNamedField::cast(other); | 6254 HLoadNamedField* that = HLoadNamedField::cast(other); |
| 6252 if (this->maps_ == that->maps_) return true; | 6255 if (this->maps_ == that->maps_) return true; |
| 6253 if (this->maps_ == NULL || that->maps_ == NULL) return false; | 6256 if (this->maps_ == NULL || that->maps_ == NULL) return false; |
| 6254 return this->maps_->IsSubset(that->maps_); | 6257 return this->maps_->IsSubset(that->maps_); |
| 6255 } | 6258 } |
| 6256 | 6259 |
| 6257 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 6260 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6301 set_representation(Representation::Tagged()); | 6304 set_representation(Representation::Tagged()); |
| 6302 } | 6305 } |
| 6303 access.SetGVNFlags(this, LOAD); | 6306 access.SetGVNFlags(this, LOAD); |
| 6304 } | 6307 } |
| 6305 | 6308 |
| 6306 HLoadNamedField(HValue* object, | 6309 HLoadNamedField(HValue* object, |
| 6307 HValue* dependency, | 6310 HValue* dependency, |
| 6308 HObjectAccess access, | 6311 HObjectAccess access, |
| 6309 const UniqueSet<Map>* maps, | 6312 const UniqueSet<Map>* maps, |
| 6310 HType type) | 6313 HType type) |
| 6311 : HTemplateInstruction<2>(type), access_(access), maps_(maps) { | 6314 : HTemplateInstruction<2>(type), |
| 6315 access_(access), | |
| 6316 maps_(maps) { | |
| 6312 ASSERT_NOT_NULL(maps); | 6317 ASSERT_NOT_NULL(maps); |
| 6313 ASSERT_NE(0, maps->size()); | 6318 ASSERT_NE(0, maps->size()); |
| 6314 | 6319 |
| 6315 ASSERT_NOT_NULL(object); | 6320 ASSERT_NOT_NULL(object); |
| 6316 SetOperandAt(0, object); | 6321 SetOperandAt(0, object); |
| 6317 SetOperandAt(1, dependency ? dependency : object); | 6322 SetOperandAt(1, dependency ? dependency : object); |
| 6318 | 6323 |
| 6319 ASSERT(access.representation().IsHeapObject()); | 6324 ASSERT(access.representation().IsHeapObject()); |
| 6320 // TODO(bmeurer): This is probably broken. What we actually want to to | 6325 // TODO(bmeurer): This is probably broken. What we actually want to to |
| 6321 // instead is set_representation(Representation::HeapObject()). | 6326 // instead is set_representation(Representation::HeapObject()). |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7651 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7656 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7652 }; | 7657 }; |
| 7653 | 7658 |
| 7654 | 7659 |
| 7655 #undef DECLARE_INSTRUCTION | 7660 #undef DECLARE_INSTRUCTION |
| 7656 #undef DECLARE_CONCRETE_INSTRUCTION | 7661 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7657 | 7662 |
| 7658 } } // namespace v8::internal | 7663 } } // namespace v8::internal |
| 7659 | 7664 |
| 7660 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7665 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |