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 3566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3577 } | 3577 } |
3578 | 3578 |
3579 Unique<Object> GetUnique() const { | 3579 Unique<Object> GetUnique() const { |
3580 return object_; | 3580 return object_; |
3581 } | 3581 } |
3582 | 3582 |
3583 bool EqualsUnique(Unique<Object> other) const { | 3583 bool EqualsUnique(Unique<Object> other) const { |
3584 return object_.IsInitialized() && object_ == other; | 3584 return object_.IsInitialized() && object_ == other; |
3585 } | 3585 } |
3586 | 3586 |
3587 #ifdef DEBUG | |
3588 virtual void Verify() V8_OVERRIDE { } | |
3589 #endif | |
3590 | |
3591 DECLARE_CONCRETE_INSTRUCTION(Constant) | |
3592 | |
3593 protected: | |
3594 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | |
3595 | |
3596 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 3587 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
3597 HConstant* other_constant = HConstant::cast(other); | 3588 HConstant* other_constant = HConstant::cast(other); |
3598 if (has_int32_value_) { | 3589 if (has_int32_value_) { |
3599 return other_constant->has_int32_value_ && | 3590 return other_constant->has_int32_value_ && |
3600 int32_value_ == other_constant->int32_value_; | 3591 int32_value_ == other_constant->int32_value_; |
3601 } else if (has_double_value_) { | 3592 } else if (has_double_value_) { |
3602 return other_constant->has_double_value_ && | 3593 return other_constant->has_double_value_ && |
3603 BitCast<int64_t>(double_value_) == | 3594 BitCast<int64_t>(double_value_) == |
3604 BitCast<int64_t>(other_constant->double_value_); | 3595 BitCast<int64_t>(other_constant->double_value_); |
3605 } else if (has_external_reference_value_) { | 3596 } else if (has_external_reference_value_) { |
3606 return other_constant->has_external_reference_value_ && | 3597 return other_constant->has_external_reference_value_ && |
3607 external_reference_value_ == | 3598 external_reference_value_ == |
3608 other_constant->external_reference_value_; | 3599 other_constant->external_reference_value_; |
3609 } else { | 3600 } else { |
3610 if (other_constant->has_int32_value_ || | 3601 if (other_constant->has_int32_value_ || |
3611 other_constant->has_double_value_ || | 3602 other_constant->has_double_value_ || |
3612 other_constant->has_external_reference_value_) { | 3603 other_constant->has_external_reference_value_) { |
3613 return false; | 3604 return false; |
3614 } | 3605 } |
3615 ASSERT(!object_.handle().is_null()); | 3606 ASSERT(!object_.handle().is_null()); |
3616 return other_constant->object_ == object_; | 3607 return other_constant->object_ == object_; |
3617 } | 3608 } |
3618 } | 3609 } |
3619 | 3610 |
3611 #ifdef DEBUG | |
3612 virtual void Verify() V8_OVERRIDE { } | |
3613 #endif | |
3614 | |
3615 DECLARE_CONCRETE_INSTRUCTION(Constant) | |
3616 | |
3617 protected: | |
3618 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; | |
3619 | |
3620 private: | 3620 private: |
3621 friend class HGraph; | 3621 friend class HGraph; |
3622 HConstant(Handle<Object> handle, Representation r = Representation::None()); | 3622 HConstant(Handle<Object> handle, Representation r = Representation::None()); |
3623 HConstant(int32_t value, | 3623 HConstant(int32_t value, |
3624 Representation r = Representation::None(), | 3624 Representation r = Representation::None(), |
3625 bool is_not_in_new_space = true, | 3625 bool is_not_in_new_space = true, |
3626 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3626 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
3627 HConstant(double value, | 3627 HConstant(double value, |
3628 Representation r = Representation::None(), | 3628 Representation r = Representation::None(), |
3629 bool is_not_in_new_space = true, | 3629 bool is_not_in_new_space = true, |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4273 | 4273 |
4274 private: | 4274 private: |
4275 explicit HCompareMinusZeroAndBranch(HValue* value) | 4275 explicit HCompareMinusZeroAndBranch(HValue* value) |
4276 : HUnaryControlInstruction(value, NULL, NULL) { | 4276 : HUnaryControlInstruction(value, NULL, NULL) { |
4277 } | 4277 } |
4278 }; | 4278 }; |
4279 | 4279 |
4280 | 4280 |
4281 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { | 4281 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { |
4282 public: | 4282 public: |
4283 HCompareObjectEqAndBranch(HValue* left, | |
4284 HValue* right, | |
4285 HBasicBlock* true_target = NULL, | |
4286 HBasicBlock* false_target = NULL) { | |
4287 // TODO(danno): make this private when the IfBuilder properly constructs | |
4288 // control flow instructions. | |
4289 ASSERT(!left->IsConstant() || | |
4290 (!HConstant::cast(left)->HasInteger32Value() || | |
4291 HConstant::cast(left)->HasSmiValue())); | |
4292 ASSERT(!right->IsConstant() || | |
4293 (!HConstant::cast(right)->HasInteger32Value() || | |
4294 HConstant::cast(right)->HasSmiValue())); | |
4295 SetOperandAt(0, left); | |
4296 SetOperandAt(1, right); | |
4297 SetSuccessorAt(0, true_target); | |
4298 SetSuccessorAt(1, false_target); | |
4299 } | |
4300 | |
4301 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); | 4283 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); |
4302 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, | 4284 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, |
4303 HBasicBlock*, HBasicBlock*); | 4285 HBasicBlock*, HBasicBlock*); |
4304 | 4286 |
4305 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; | 4287 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
4306 | 4288 |
4307 HValue* left() { return OperandAt(0); } | 4289 HValue* left() { return OperandAt(0); } |
4308 HValue* right() { return OperandAt(1); } | 4290 HValue* right() { return OperandAt(1); } |
4309 | 4291 |
4310 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4292 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
4311 | 4293 |
4312 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4294 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4313 return Representation::Tagged(); | 4295 return Representation::Tagged(); |
4314 } | 4296 } |
4315 | 4297 |
4316 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 4298 virtual Representation observed_input_representation(int index) V8_OVERRIDE { |
4317 return Representation::Tagged(); | 4299 return Representation::Tagged(); |
4318 } | 4300 } |
4319 | 4301 |
4320 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) | 4302 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) |
4303 | |
4304 private: | |
4305 HCompareObjectEqAndBranch(HValue* left, | |
4306 HValue* right, | |
4307 HBasicBlock* true_target = NULL, | |
4308 HBasicBlock* false_target = NULL) { | |
4309 // TODO(danno): make this private when the IfBuilder properly constructs | |
Jakob Kummerow
2014/03/11 13:30:21
done?
| |
4310 // control flow instructions. | |
4311 ASSERT(!left->IsConstant() || | |
4312 (!HConstant::cast(left)->HasInteger32Value() || | |
4313 HConstant::cast(left)->HasSmiValue())); | |
4314 ASSERT(!right->IsConstant() || | |
4315 (!HConstant::cast(right)->HasInteger32Value() || | |
4316 HConstant::cast(right)->HasSmiValue())); | |
4317 SetOperandAt(0, left); | |
4318 SetOperandAt(1, right); | |
4319 SetSuccessorAt(0, true_target); | |
4320 SetSuccessorAt(1, false_target); | |
4321 } | |
4321 }; | 4322 }; |
4322 | 4323 |
4323 | 4324 |
4324 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { | 4325 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { |
4325 public: | 4326 public: |
4326 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); | 4327 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); |
4327 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, | 4328 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, |
4328 HBasicBlock*, HBasicBlock*); | 4329 HBasicBlock*, HBasicBlock*); |
4329 | 4330 |
4330 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4331 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
(...skipping 3186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7517 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7518 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7518 }; | 7519 }; |
7519 | 7520 |
7520 | 7521 |
7521 #undef DECLARE_INSTRUCTION | 7522 #undef DECLARE_INSTRUCTION |
7522 #undef DECLARE_CONCRETE_INSTRUCTION | 7523 #undef DECLARE_CONCRETE_INSTRUCTION |
7523 | 7524 |
7524 } } // namespace v8::internal | 7525 } } // namespace v8::internal |
7525 | 7526 |
7526 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7527 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |