Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: src/hydrogen-instructions.cc

Issue 21072002: Eagerly set the types of many kinds of hydrogen instructions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3613 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 3624
3625 3625
3626 // Implementation of type inference and type conversions. Calculates 3626 // Implementation of type inference and type conversions. Calculates
3627 // the inferred type of this instruction based on the input operands. 3627 // the inferred type of this instruction based on the input operands.
3628 3628
3629 HType HValue::CalculateInferredType() { 3629 HType HValue::CalculateInferredType() {
3630 return type_; 3630 return type_;
3631 } 3631 }
3632 3632
3633 3633
3634 HType HCheckMaps::CalculateInferredType() {
3635 return value()->type();
3636 }
3637
3638
3639 HType HCheckFunction::CalculateInferredType() {
3640 return value()->type();
3641 }
3642
3643
3644 HType HCheckHeapObject::CalculateInferredType() {
3645 return HType::NonPrimitive();
3646 }
3647
3648
3649 HType HCheckSmi::CalculateInferredType() {
3650 return HType::Smi();
3651 }
3652
3653
3654 HType HPhi::CalculateInferredType() { 3634 HType HPhi::CalculateInferredType() {
3655 if (OperandCount() == 0) return HType::Tagged(); 3635 if (OperandCount() == 0) return HType::Tagged();
3656 HType result = OperandAt(0)->type(); 3636 HType result = OperandAt(0)->type();
3657 for (int i = 1; i < OperandCount(); ++i) { 3637 for (int i = 1; i < OperandCount(); ++i) {
3658 HType current = OperandAt(i)->type(); 3638 HType current = OperandAt(i)->type();
3659 result = result.Combine(current); 3639 result = result.Combine(current);
3660 } 3640 }
3661 return result; 3641 return result;
3662 } 3642 }
3663 3643
3664 3644
3665 HType HCompareGeneric::CalculateInferredType() {
3666 return HType::Boolean();
3667 }
3668
3669
3670 HType HInstanceOf::CalculateInferredType() {
3671 return HType::Boolean();
3672 }
3673
3674
3675 HType HInstanceOfKnownGlobal::CalculateInferredType() {
3676 return HType::Boolean();
3677 }
3678
3679
3680 HType HChange::CalculateInferredType() { 3645 HType HChange::CalculateInferredType() {
3681 if (from().IsDouble() && to().IsTagged()) return HType::HeapNumber(); 3646 if (from().IsDouble() && to().IsTagged()) return HType::HeapNumber();
3682 return type(); 3647 return type();
3683 } 3648 }
3684 3649
3685 3650
3686 HType HBitwiseBinaryOperation::CalculateInferredType() {
3687 return HType::TaggedNumber();
3688 }
3689
3690
3691 HType HArithmeticBinaryOperation::CalculateInferredType() {
3692 return HType::TaggedNumber();
3693 }
3694
3695
3696 HType HAdd::CalculateInferredType() {
3697 return HType::Tagged();
3698 }
3699
3700
3701 HType HBitNot::CalculateInferredType() {
3702 return HType::TaggedNumber();
3703 }
3704
3705
3706 HType HUnaryMathOperation::CalculateInferredType() {
3707 return HType::TaggedNumber();
3708 }
3709
3710
3711 Representation HUnaryMathOperation::RepresentationFromInputs() { 3651 Representation HUnaryMathOperation::RepresentationFromInputs() {
3712 Representation rep = representation(); 3652 Representation rep = representation();
3713 // If any of the actual input representation is more general than what we 3653 // If any of the actual input representation is more general than what we
3714 // have so far but not Tagged, use that representation instead. 3654 // have so far but not Tagged, use that representation instead.
3715 Representation input_rep = value()->representation(); 3655 Representation input_rep = value()->representation();
3716 if (!input_rep.IsTagged()) rep = rep.generalize(input_rep); 3656 if (!input_rep.IsTagged()) rep = rep.generalize(input_rep);
3717 return rep; 3657 return rep;
3718 } 3658 }
3719 3659
3720 3660
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3798 } 3738 }
3799 } 3739 }
3800 3740
3801 3741
3802 void HAllocate::PrintDataTo(StringStream* stream) { 3742 void HAllocate::PrintDataTo(StringStream* stream) {
3803 size()->PrintNameTo(stream); 3743 size()->PrintNameTo(stream);
3804 if (!GuaranteedInNewSpace()) stream->Add(" (pretenure)"); 3744 if (!GuaranteedInNewSpace()) stream->Add(" (pretenure)");
3805 } 3745 }
3806 3746
3807 3747
3808 HType HRegExpLiteral::CalculateInferredType() {
3809 return HType::JSObject();
3810 }
3811
3812
3813 HType HFunctionLiteral::CalculateInferredType() {
3814 return HType::JSObject();
3815 }
3816
3817
3818 HValue* HUnaryMathOperation::EnsureAndPropagateNotMinusZero( 3748 HValue* HUnaryMathOperation::EnsureAndPropagateNotMinusZero(
3819 BitVector* visited) { 3749 BitVector* visited) {
3820 visited->Add(id()); 3750 visited->Add(id());
3821 if (representation().IsSmiOrInteger32() && 3751 if (representation().IsSmiOrInteger32() &&
3822 !value()->representation().Equals(representation())) { 3752 !value()->representation().Equals(representation())) {
3823 if (value()->range() == NULL || value()->range()->CanBeMinusZero()) { 3753 if (value()->range() == NULL || value()->range()->CanBeMinusZero()) {
3824 SetFlag(kBailoutOnMinusZero); 3754 SetFlag(kBailoutOnMinusZero);
3825 } 3755 }
3826 } 3756 }
3827 if (RequiredInputRepresentation(0).IsSmiOrInteger32() && 3757 if (RequiredInputRepresentation(0).IsSmiOrInteger32() &&
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
4530 case kBackingStore: 4460 case kBackingStore:
4531 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 4461 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
4532 stream->Add("[backing-store]"); 4462 stream->Add("[backing-store]");
4533 break; 4463 break;
4534 } 4464 }
4535 4465
4536 stream->Add("@%d", offset()); 4466 stream->Add("@%d", offset());
4537 } 4467 }
4538 4468
4539 } } // namespace v8::internal 4469 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698