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 3433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3444 HInstruction* instruction) { | 3444 HInstruction* instruction) { |
3445 return instruction->Prepend(HConstant::New( | 3445 return instruction->Prepend(HConstant::New( |
3446 zone, context, value, representation)); | 3446 zone, context, value, representation)); |
3447 } | 3447 } |
3448 | 3448 |
3449 static HConstant* CreateAndInsertBefore(Zone* zone, | 3449 static HConstant* CreateAndInsertBefore(Zone* zone, |
3450 Unique<Object> unique, | 3450 Unique<Object> unique, |
3451 bool is_not_in_new_space, | 3451 bool is_not_in_new_space, |
3452 HInstruction* instruction) { | 3452 HInstruction* instruction) { |
3453 return instruction->Prepend(new(zone) HConstant( | 3453 return instruction->Prepend(new(zone) HConstant( |
3454 unique, Representation::Tagged(), HType::Tagged(), false, | 3454 unique, Representation::Tagged(), HType::Tagged(), |
3455 is_not_in_new_space, false, false)); | 3455 is_not_in_new_space, false, false, kUnknownInstanceType)); |
3456 } | 3456 } |
3457 | 3457 |
3458 Handle<Object> handle(Isolate* isolate) { | 3458 Handle<Object> handle(Isolate* isolate) { |
3459 if (object_.handle().is_null()) { | 3459 if (object_.handle().is_null()) { |
3460 // Default arguments to is_not_in_new_space depend on this heap number | 3460 // Default arguments to is_not_in_new_space depend on this heap number |
3461 // to be tenured so that it's guaranteed not to be located in new space. | 3461 // to be tenured so that it's guaranteed not to be located in new space. |
3462 object_ = Unique<Object>::CreateUninitialized( | 3462 object_ = Unique<Object>::CreateUninitialized( |
3463 isolate->factory()->NewNumber(double_value_, TENURED)); | 3463 isolate->factory()->NewNumber(double_value_, TENURED)); |
3464 } | 3464 } |
3465 AllowDeferredHandleDereference smi_check; | 3465 AllowDeferredHandleDereference smi_check; |
(...skipping 14 matching lines...) Expand all Loading... |
3480 std::isnan(double_value_)); | 3480 std::isnan(double_value_)); |
3481 } | 3481 } |
3482 | 3482 |
3483 bool NotInNewSpace() const { | 3483 bool NotInNewSpace() const { |
3484 return is_not_in_new_space_; | 3484 return is_not_in_new_space_; |
3485 } | 3485 } |
3486 | 3486 |
3487 bool ImmortalImmovable() const; | 3487 bool ImmortalImmovable() const; |
3488 | 3488 |
3489 bool IsCell() const { | 3489 bool IsCell() const { |
3490 return is_cell_; | 3490 return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE; |
3491 } | 3491 } |
3492 | 3492 |
3493 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3493 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
3494 return Representation::None(); | 3494 return Representation::None(); |
3495 } | 3495 } |
3496 | 3496 |
3497 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { | 3497 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { |
3498 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); | 3498 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); |
3499 if (HasInteger32Value()) return Representation::Integer32(); | 3499 if (HasInteger32Value()) return Representation::Integer32(); |
3500 if (HasNumberValue()) return Representation::Double(); | 3500 if (HasNumberValue()) return Representation::Double(); |
(...skipping 27 matching lines...) Expand all Loading... |
3528 int32_t NumberValueAsInteger32() const { | 3528 int32_t NumberValueAsInteger32() const { |
3529 ASSERT(HasNumberValue()); | 3529 ASSERT(HasNumberValue()); |
3530 // Irrespective of whether a numeric HConstant can be safely | 3530 // Irrespective of whether a numeric HConstant can be safely |
3531 // represented as an int32, we store the (in some cases lossy) | 3531 // represented as an int32, we store the (in some cases lossy) |
3532 // representation of the number in int32_value_. | 3532 // representation of the number in int32_value_. |
3533 return int32_value_; | 3533 return int32_value_; |
3534 } | 3534 } |
3535 bool HasStringValue() const { | 3535 bool HasStringValue() const { |
3536 if (has_double_value_ || has_int32_value_) return false; | 3536 if (has_double_value_ || has_int32_value_) return false; |
3537 ASSERT(!object_.handle().is_null()); | 3537 ASSERT(!object_.handle().is_null()); |
3538 return type_.IsString(); | 3538 return instance_type_ < FIRST_NONSTRING_TYPE; |
3539 } | 3539 } |
3540 Handle<String> StringValue() const { | 3540 Handle<String> StringValue() const { |
3541 ASSERT(HasStringValue()); | 3541 ASSERT(HasStringValue()); |
3542 return Handle<String>::cast(object_.handle()); | 3542 return Handle<String>::cast(object_.handle()); |
3543 } | 3543 } |
3544 bool HasInternalizedStringValue() const { | 3544 bool HasInternalizedStringValue() const { |
3545 return HasStringValue() && is_internalized_string_; | 3545 return HasStringValue() && StringShape(instance_type_).IsInternalized(); |
3546 } | 3546 } |
3547 | 3547 |
3548 bool HasExternalReferenceValue() const { | 3548 bool HasExternalReferenceValue() const { |
3549 return has_external_reference_value_; | 3549 return has_external_reference_value_; |
3550 } | 3550 } |
3551 ExternalReference ExternalReferenceValue() const { | 3551 ExternalReference ExternalReferenceValue() const { |
3552 return external_reference_value_; | 3552 return external_reference_value_; |
3553 } | 3553 } |
3554 | 3554 |
3555 bool HasBooleanValue() const { return type_.IsBoolean(); } | 3555 bool HasBooleanValue() const { return type_.IsBoolean(); } |
3556 bool BooleanValue() const { return boolean_value_; } | 3556 bool BooleanValue() const { return boolean_value_; } |
| 3557 bool IsUndetectable() const { return is_undetectable_; } |
| 3558 InstanceType GetInstanceType() const { return instance_type_; } |
3557 | 3559 |
3558 virtual intptr_t Hashcode() V8_OVERRIDE { | 3560 virtual intptr_t Hashcode() V8_OVERRIDE { |
3559 if (has_int32_value_) { | 3561 if (has_int32_value_) { |
3560 return static_cast<intptr_t>(int32_value_); | 3562 return static_cast<intptr_t>(int32_value_); |
3561 } else if (has_double_value_) { | 3563 } else if (has_double_value_) { |
3562 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); | 3564 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); |
3563 } else if (has_external_reference_value_) { | 3565 } else if (has_external_reference_value_) { |
3564 return reinterpret_cast<intptr_t>(external_reference_value_.address()); | 3566 return reinterpret_cast<intptr_t>(external_reference_value_.address()); |
3565 } else { | 3567 } else { |
3566 ASSERT(!object_.handle().is_null()); | 3568 ASSERT(!object_.handle().is_null()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3623 Representation r = Representation::None(), | 3625 Representation r = Representation::None(), |
3624 bool is_not_in_new_space = true, | 3626 bool is_not_in_new_space = true, |
3625 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3627 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
3626 HConstant(double value, | 3628 HConstant(double value, |
3627 Representation r = Representation::None(), | 3629 Representation r = Representation::None(), |
3628 bool is_not_in_new_space = true, | 3630 bool is_not_in_new_space = true, |
3629 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3631 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
3630 HConstant(Unique<Object> unique, | 3632 HConstant(Unique<Object> unique, |
3631 Representation r, | 3633 Representation r, |
3632 HType type, | 3634 HType type, |
3633 bool is_internalized_string, | |
3634 bool is_not_in_new_space, | 3635 bool is_not_in_new_space, |
3635 bool is_cell, | 3636 bool boolean_value, |
3636 bool boolean_value); | 3637 bool is_undetectable, |
| 3638 InstanceType instance_type); |
3637 | 3639 |
3638 explicit HConstant(ExternalReference reference); | 3640 explicit HConstant(ExternalReference reference); |
3639 | 3641 |
3640 void Initialize(Representation r); | 3642 void Initialize(Representation r); |
3641 | 3643 |
3642 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 3644 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
3643 | 3645 |
3644 // If this is a numerical constant, object_ either points to the | 3646 // If this is a numerical constant, object_ either points to the |
3645 // HeapObject the constant originated from or is null. If the | 3647 // HeapObject the constant originated from or is null. If the |
3646 // constant is non-numeric, object_ always points to a valid | 3648 // constant is non-numeric, object_ always points to a valid |
3647 // constant HeapObject. | 3649 // constant HeapObject. |
3648 Unique<Object> object_; | 3650 Unique<Object> object_; |
3649 | 3651 |
3650 // We store the HConstant in the most specific form safely possible. | 3652 // We store the HConstant in the most specific form safely possible. |
3651 // The two flags, has_int32_value_ and has_double_value_ tell us if | 3653 // The two flags, has_int32_value_ and has_double_value_ tell us if |
3652 // int32_value_ and double_value_ hold valid, safe representations | 3654 // int32_value_ and double_value_ hold valid, safe representations |
3653 // of the constant. has_int32_value_ implies has_double_value_ but | 3655 // of the constant. has_int32_value_ implies has_double_value_ but |
3654 // not the converse. | 3656 // not the converse. |
3655 bool has_smi_value_ : 1; | 3657 bool has_smi_value_ : 1; |
3656 bool has_int32_value_ : 1; | 3658 bool has_int32_value_ : 1; |
3657 bool has_double_value_ : 1; | 3659 bool has_double_value_ : 1; |
3658 bool has_external_reference_value_ : 1; | 3660 bool has_external_reference_value_ : 1; |
3659 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. | |
3660 bool is_not_in_new_space_ : 1; | 3661 bool is_not_in_new_space_ : 1; |
3661 bool is_cell_ : 1; | |
3662 bool boolean_value_ : 1; | 3662 bool boolean_value_ : 1; |
| 3663 bool is_undetectable_: 1; |
3663 int32_t int32_value_; | 3664 int32_t int32_value_; |
3664 double double_value_; | 3665 double double_value_; |
3665 ExternalReference external_reference_value_; | 3666 ExternalReference external_reference_value_; |
| 3667 |
| 3668 static const InstanceType kUnknownInstanceType = FILLER_TYPE; |
| 3669 InstanceType instance_type_; |
3666 }; | 3670 }; |
3667 | 3671 |
3668 | 3672 |
3669 class HBinaryOperation : public HTemplateInstruction<3> { | 3673 class HBinaryOperation : public HTemplateInstruction<3> { |
3670 public: | 3674 public: |
3671 HBinaryOperation(HValue* context, HValue* left, HValue* right, | 3675 HBinaryOperation(HValue* context, HValue* left, HValue* right, |
3672 HType type = HType::Tagged()) | 3676 HType type = HType::Tagged()) |
3673 : HTemplateInstruction<3>(type), | 3677 : HTemplateInstruction<3>(type), |
3674 observed_output_representation_(Representation::None()) { | 3678 observed_output_representation_(Representation::None()) { |
3675 ASSERT(left != NULL && right != NULL); | 3679 ASSERT(left != NULL && right != NULL); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4321 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { | 4325 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { |
4322 public: | 4326 public: |
4323 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); | 4327 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); |
4324 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, | 4328 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, |
4325 HBasicBlock*, HBasicBlock*); | 4329 HBasicBlock*, HBasicBlock*); |
4326 | 4330 |
4327 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4331 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4328 return Representation::Tagged(); | 4332 return Representation::Tagged(); |
4329 } | 4333 } |
4330 | 4334 |
| 4335 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 4336 |
4331 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) | 4337 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) |
4332 | 4338 |
4333 private: | 4339 private: |
4334 HIsObjectAndBranch(HValue* value, | 4340 HIsObjectAndBranch(HValue* value, |
4335 HBasicBlock* true_target = NULL, | 4341 HBasicBlock* true_target = NULL, |
4336 HBasicBlock* false_target = NULL) | 4342 HBasicBlock* false_target = NULL) |
4337 : HUnaryControlInstruction(value, true_target, false_target) {} | 4343 : HUnaryControlInstruction(value, true_target, false_target) {} |
4338 }; | 4344 }; |
4339 | 4345 |
4340 | 4346 |
4341 class HIsStringAndBranch V8_FINAL : public HUnaryControlInstruction { | 4347 class HIsStringAndBranch V8_FINAL : public HUnaryControlInstruction { |
4342 public: | 4348 public: |
4343 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*); | 4349 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*); |
4344 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*, | 4350 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*, |
4345 HBasicBlock*, HBasicBlock*); | 4351 HBasicBlock*, HBasicBlock*); |
4346 | 4352 |
4347 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4353 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4348 return Representation::Tagged(); | 4354 return Representation::Tagged(); |
4349 } | 4355 } |
4350 | 4356 |
| 4357 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 4358 |
4351 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) | 4359 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) |
4352 | 4360 |
4353 protected: | 4361 protected: |
4354 virtual int RedefinedOperandIndex() { return 0; } | 4362 virtual int RedefinedOperandIndex() { return 0; } |
4355 | 4363 |
4356 private: | 4364 private: |
4357 HIsStringAndBranch(HValue* value, | 4365 HIsStringAndBranch(HValue* value, |
4358 HBasicBlock* true_target = NULL, | 4366 HBasicBlock* true_target = NULL, |
4359 HBasicBlock* false_target = NULL) | 4367 HBasicBlock* false_target = NULL) |
4360 : HUnaryControlInstruction(value, true_target, false_target) {} | 4368 : HUnaryControlInstruction(value, true_target, false_target) {} |
4361 }; | 4369 }; |
4362 | 4370 |
4363 | 4371 |
4364 class HIsSmiAndBranch V8_FINAL : public HUnaryControlInstruction { | 4372 class HIsSmiAndBranch V8_FINAL : public HUnaryControlInstruction { |
4365 public: | 4373 public: |
4366 DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*); | 4374 DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*); |
4367 DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*, | 4375 DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*, |
4368 HBasicBlock*, HBasicBlock*); | 4376 HBasicBlock*, HBasicBlock*); |
4369 | 4377 |
4370 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) | 4378 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) |
4371 | 4379 |
4372 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4380 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4373 return Representation::Tagged(); | 4381 return Representation::Tagged(); |
4374 } | 4382 } |
4375 | 4383 |
| 4384 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 4385 |
4376 protected: | 4386 protected: |
4377 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4387 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
4378 virtual int RedefinedOperandIndex() { return 0; } | 4388 virtual int RedefinedOperandIndex() { return 0; } |
4379 | 4389 |
4380 private: | 4390 private: |
4381 HIsSmiAndBranch(HValue* value, | 4391 HIsSmiAndBranch(HValue* value, |
4382 HBasicBlock* true_target = NULL, | 4392 HBasicBlock* true_target = NULL, |
4383 HBasicBlock* false_target = NULL) | 4393 HBasicBlock* false_target = NULL) |
4384 : HUnaryControlInstruction(value, true_target, false_target) {} | 4394 : HUnaryControlInstruction(value, true_target, false_target) {} |
4385 }; | 4395 }; |
4386 | 4396 |
4387 | 4397 |
4388 class HIsUndetectableAndBranch V8_FINAL : public HUnaryControlInstruction { | 4398 class HIsUndetectableAndBranch V8_FINAL : public HUnaryControlInstruction { |
4389 public: | 4399 public: |
4390 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*); | 4400 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*); |
4391 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*, | 4401 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*, |
4392 HBasicBlock*, HBasicBlock*); | 4402 HBasicBlock*, HBasicBlock*); |
4393 | 4403 |
4394 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4404 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4395 return Representation::Tagged(); | 4405 return Representation::Tagged(); |
4396 } | 4406 } |
4397 | 4407 |
| 4408 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 4409 |
4398 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) | 4410 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) |
4399 | 4411 |
4400 private: | 4412 private: |
4401 HIsUndetectableAndBranch(HValue* value, | 4413 HIsUndetectableAndBranch(HValue* value, |
4402 HBasicBlock* true_target = NULL, | 4414 HBasicBlock* true_target = NULL, |
4403 HBasicBlock* false_target = NULL) | 4415 HBasicBlock* false_target = NULL) |
4404 : HUnaryControlInstruction(value, true_target, false_target) {} | 4416 : HUnaryControlInstruction(value, true_target, false_target) {} |
4405 }; | 4417 }; |
4406 | 4418 |
4407 | 4419 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4470 | 4482 |
4471 InstanceType from() { return from_; } | 4483 InstanceType from() { return from_; } |
4472 InstanceType to() { return to_; } | 4484 InstanceType to() { return to_; } |
4473 | 4485 |
4474 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4486 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
4475 | 4487 |
4476 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4488 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4477 return Representation::Tagged(); | 4489 return Representation::Tagged(); |
4478 } | 4490 } |
4479 | 4491 |
| 4492 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 4493 |
4480 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) | 4494 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) |
4481 | 4495 |
4482 private: | 4496 private: |
4483 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) | 4497 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) |
4484 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } | 4498 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } |
4485 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) | 4499 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) |
4486 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { | 4500 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { |
4487 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. | 4501 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. |
4488 } | 4502 } |
4489 | 4503 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4551 class_name_(class_name) { } | 4565 class_name_(class_name) { } |
4552 | 4566 |
4553 Handle<String> class_name_; | 4567 Handle<String> class_name_; |
4554 }; | 4568 }; |
4555 | 4569 |
4556 | 4570 |
4557 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction { | 4571 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction { |
4558 public: | 4572 public: |
4559 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); | 4573 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); |
4560 | 4574 |
4561 Handle<String> type_literal() { return type_literal_; } | 4575 Handle<String> type_literal() { return type_literal_.handle(); } |
4562 bool compares_number_type() { return compares_number_type_; } | |
4563 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4576 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
4564 | 4577 |
4565 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) | 4578 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) |
4566 | 4579 |
4567 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4580 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4568 return Representation::None(); | 4581 return Representation::None(); |
4569 } | 4582 } |
4570 | 4583 |
4571 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; | 4584 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
4572 | 4585 |
| 4586 virtual void FinalizeUniqueness() V8_OVERRIDE { |
| 4587 type_literal_ = Unique<String>(type_literal_.handle()); |
| 4588 } |
| 4589 |
4573 private: | 4590 private: |
4574 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) | 4591 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) |
4575 : HUnaryControlInstruction(value, NULL, NULL), | 4592 : HUnaryControlInstruction(value, NULL, NULL), |
4576 type_literal_(type_literal) { | 4593 type_literal_(Unique<String>::CreateUninitialized(type_literal)) { } |
4577 Heap* heap = type_literal->GetHeap(); | |
4578 compares_number_type_ = type_literal->Equals(heap->number_string()); | |
4579 } | |
4580 | 4594 |
4581 Handle<String> type_literal_; | 4595 Unique<String> type_literal_; |
4582 bool compares_number_type_ : 1; | |
4583 }; | 4596 }; |
4584 | 4597 |
4585 | 4598 |
4586 class HInstanceOf V8_FINAL : public HBinaryOperation { | 4599 class HInstanceOf V8_FINAL : public HBinaryOperation { |
4587 public: | 4600 public: |
4588 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); | 4601 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); |
4589 | 4602 |
4590 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4603 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
4591 return Representation::Tagged(); | 4604 return Representation::Tagged(); |
4592 } | 4605 } |
(...skipping 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7505 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7518 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7506 }; | 7519 }; |
7507 | 7520 |
7508 | 7521 |
7509 #undef DECLARE_INSTRUCTION | 7522 #undef DECLARE_INSTRUCTION |
7510 #undef DECLARE_CONCRETE_INSTRUCTION | 7523 #undef DECLARE_CONCRETE_INSTRUCTION |
7511 | 7524 |
7512 } } // namespace v8::internal | 7525 } } // namespace v8::internal |
7513 | 7526 |
7514 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7527 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |