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 3730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3741 } | 3741 } |
3742 | 3742 |
3743 | 3743 |
3744 static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) { | 3744 static void DehoistArrayIndex(ArrayInstructionInterface* array_operation) { |
3745 HValue* index = array_operation->GetKey(); | 3745 HValue* index = array_operation->GetKey(); |
3746 | 3746 |
3747 HConstant* constant; | 3747 HConstant* constant; |
3748 HValue* subexpression; | 3748 HValue* subexpression; |
3749 int32_t sign; | 3749 int32_t sign; |
3750 if (index->IsAdd()) { | 3750 if (index->IsAdd()) { |
3751 if (!index->representation().IsInteger32()) | |
3752 return; | |
Jakob Kummerow
2012/09/11 13:16:24
{} please (or put it all on one line).
Again below
| |
3751 sign = 1; | 3753 sign = 1; |
3752 HAdd* add = HAdd::cast(index); | 3754 HAdd* add = HAdd::cast(index); |
3753 if (add->left()->IsConstant()) { | 3755 if (add->left()->IsConstant()) { |
3754 subexpression = add->right(); | 3756 subexpression = add->right(); |
3755 constant = HConstant::cast(add->left()); | 3757 constant = HConstant::cast(add->left()); |
3756 } else if (add->right()->IsConstant()) { | 3758 } else if (add->right()->IsConstant()) { |
3757 subexpression = add->left(); | 3759 subexpression = add->left(); |
3758 constant = HConstant::cast(add->right()); | 3760 constant = HConstant::cast(add->right()); |
3759 } else { | 3761 } else { |
3760 return; | 3762 return; |
3761 } | 3763 } |
3762 } else if (index->IsSub()) { | 3764 } else if (index->IsSub()) { |
3765 if (!index->representation().IsInteger32()) | |
3766 return; | |
3763 sign = -1; | 3767 sign = -1; |
3764 HSub* sub = HSub::cast(index); | 3768 HSub* sub = HSub::cast(index); |
3765 if (sub->left()->IsConstant()) { | 3769 if (sub->left()->IsConstant()) { |
3766 subexpression = sub->right(); | 3770 subexpression = sub->right(); |
3767 constant = HConstant::cast(sub->left()); | 3771 constant = HConstant::cast(sub->left()); |
3768 } else if (sub->right()->IsConstant()) { | 3772 } else if (sub->right()->IsConstant()) { |
3769 subexpression = sub->left(); | 3773 subexpression = sub->left(); |
3770 constant = HConstant::cast(sub->right()); | 3774 constant = HConstant::cast(sub->right()); |
3771 } return; | 3775 } return; |
3772 } else { | 3776 } else { |
(...skipping 6203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9976 } | 9980 } |
9977 } | 9981 } |
9978 | 9982 |
9979 #ifdef DEBUG | 9983 #ifdef DEBUG |
9980 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9984 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9981 if (allocator_ != NULL) allocator_->Verify(); | 9985 if (allocator_ != NULL) allocator_->Verify(); |
9982 #endif | 9986 #endif |
9983 } | 9987 } |
9984 | 9988 |
9985 } } // namespace v8::internal | 9989 } } // namespace v8::internal |
OLD | NEW |