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 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3383 ASSERT(!handle_.is_null()); | 3383 ASSERT(!handle_.is_null()); |
3384 unique_id_ = UniqueValueId(handle_); | 3384 unique_id_ = UniqueValueId(handle_); |
3385 } | 3385 } |
3386 } | 3386 } |
3387 | 3387 |
3388 bool UniqueValueIdsMatch(UniqueValueId other) { | 3388 bool UniqueValueIdsMatch(UniqueValueId other) { |
3389 return !has_double_value_ && !has_external_reference_value_ && | 3389 return !has_double_value_ && !has_external_reference_value_ && |
3390 unique_id_ == other; | 3390 unique_id_ == other; |
3391 } | 3391 } |
3392 | 3392 |
3393 bool SameConstantObject(HConstant* other) { | |
Michael Starzinger
2013/08/16 15:02:20
nit: Let's rename this to just "SameConstant", it
Jakob Kummerow
2013/08/20 08:46:56
This seems to cover a subset of the functionality
danno
2013/10/01 10:43:18
Actually, I use DataEquals now. Makes it even simp
| |
3394 if (HasSmiValue() && other->HasSmiValue()) { | |
Michael Starzinger
2013/08/16 15:02:20
Shouldn't this be HasInteger32Value in these check
danno
2013/10/01 10:43:18
See above.
| |
3395 return int32_value_ == other->int32_value_; | |
3396 } | |
3397 return UniqueValueIdsMatch(other->unique_id_); | |
3398 } | |
3399 | |
3393 #ifdef DEBUG | 3400 #ifdef DEBUG |
3394 virtual void Verify() { } | 3401 virtual void Verify() { } |
3395 #endif | 3402 #endif |
3396 | 3403 |
3397 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3404 DECLARE_CONCRETE_INSTRUCTION(Constant) |
3398 | 3405 |
3399 protected: | 3406 protected: |
3400 virtual Range* InferRange(Zone* zone); | 3407 virtual Range* InferRange(Zone* zone); |
3401 | 3408 |
3402 virtual bool DataEquals(HValue* other) { | 3409 virtual bool DataEquals(HValue* other) { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4004 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) | 4011 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) |
4005 }; | 4012 }; |
4006 | 4013 |
4007 | 4014 |
4008 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { | 4015 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { |
4009 public: | 4016 public: |
4010 // TODO(danno): make this private when the IfBuilder properly constructs | 4017 // TODO(danno): make this private when the IfBuilder properly constructs |
4011 // control flow instructions. | 4018 // control flow instructions. |
4012 HCompareObjectEqAndBranch(HValue* left, | 4019 HCompareObjectEqAndBranch(HValue* left, |
4013 HValue* right) { | 4020 HValue* right) { |
4021 ASSERT(!left->IsConstant() || | |
4022 (!HConstant::cast(left)->HasInteger32Value() || | |
4023 HConstant::cast(left)->HasSmiValue())); | |
4024 ASSERT(!right->IsConstant() || | |
4025 (!HConstant::cast(right)->HasInteger32Value() || | |
4026 HConstant::cast(right)->HasSmiValue())); | |
4014 SetOperandAt(0, left); | 4027 SetOperandAt(0, left); |
4015 SetOperandAt(1, right); | 4028 SetOperandAt(1, right); |
4016 } | 4029 } |
4017 | 4030 |
4018 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); | 4031 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); |
4019 | 4032 |
4020 HValue* left() { return OperandAt(0); } | 4033 HValue* left() { return OperandAt(0); } |
4021 HValue* right() { return OperandAt(1); } | 4034 HValue* right() { return OperandAt(1); } |
4022 | 4035 |
4023 virtual void PrintDataTo(StringStream* stream); | 4036 virtual void PrintDataTo(StringStream* stream); |
(...skipping 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6807 virtual bool IsDeletable() const { return true; } | 6820 virtual bool IsDeletable() const { return true; } |
6808 }; | 6821 }; |
6809 | 6822 |
6810 | 6823 |
6811 #undef DECLARE_INSTRUCTION | 6824 #undef DECLARE_INSTRUCTION |
6812 #undef DECLARE_CONCRETE_INSTRUCTION | 6825 #undef DECLARE_CONCRETE_INSTRUCTION |
6813 | 6826 |
6814 } } // namespace v8::internal | 6827 } } // namespace v8::internal |
6815 | 6828 |
6816 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6829 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |