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 3833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3844 bool Uint32Analysis::CheckPhiOperands(HPhi* phi) { | 3844 bool Uint32Analysis::CheckPhiOperands(HPhi* phi) { |
3845 if (!phi->CheckFlag(HInstruction::kUint32)) { | 3845 if (!phi->CheckFlag(HInstruction::kUint32)) { |
3846 // This phi is not uint32 safe. No need to check operands. | 3846 // This phi is not uint32 safe. No need to check operands. |
3847 return false; | 3847 return false; |
3848 } | 3848 } |
3849 | 3849 |
3850 for (int j = 0; j < phi->OperandCount(); j++) { | 3850 for (int j = 0; j < phi->OperandCount(); j++) { |
3851 HValue* operand = phi->OperandAt(j); | 3851 HValue* operand = phi->OperandAt(j); |
3852 if (!operand->CheckFlag(HInstruction::kUint32)) { | 3852 if (!operand->CheckFlag(HInstruction::kUint32)) { |
3853 // Lazyly mark constants that fit into uint32 range with kUint32 flag. | 3853 // Lazyly mark constants that fit into uint32 range with kUint32 flag. |
3854 if (operand->IsConstant() && | 3854 if (operand->IsInteger32Constant() && |
3855 HConstant::cast(operand)->IsUint32()) { | 3855 operand->GetInteger32Constant() >= 0) { |
3856 operand->SetFlag(HInstruction::kUint32); | 3856 operand->SetFlag(HInstruction::kUint32); |
3857 continue; | 3857 continue; |
3858 } | 3858 } |
3859 | 3859 |
3860 // This phi is not safe, some operands are not uint32 values. | 3860 // This phi is not safe, some operands are not uint32 values. |
3861 return false; | 3861 return false; |
3862 } | 3862 } |
3863 } | 3863 } |
3864 | 3864 |
3865 return true; | 3865 return true; |
(...skipping 4749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8615 HInstruction* sqrt = | 8615 HInstruction* sqrt = |
8616 HUnaryMathOperation::New(zone(), context, left, kMathPowHalf); | 8616 HUnaryMathOperation::New(zone(), context, left, kMathPowHalf); |
8617 AddInstruction(sqrt); | 8617 AddInstruction(sqrt); |
8618 // MathPowHalf doesn't have side effects so there's no need for | 8618 // MathPowHalf doesn't have side effects so there's no need for |
8619 // an environment simulation here. | 8619 // an environment simulation here. |
8620 ASSERT(!sqrt->HasObservableSideEffects()); | 8620 ASSERT(!sqrt->HasObservableSideEffects()); |
8621 result = HDiv::New(zone(), context, double_one, sqrt); | 8621 result = HDiv::New(zone(), context, double_one, sqrt); |
8622 } else if (exponent == 2.0) { | 8622 } else if (exponent == 2.0) { |
8623 result = HMul::New(zone(), context, left, left); | 8623 result = HMul::New(zone(), context, left, left); |
8624 } | 8624 } |
8625 } else if (right->IsConstant() && | 8625 } else if (right->EqualsInteger32Constant(2)) { |
8626 HConstant::cast(right)->HasInteger32Value() && | |
8627 HConstant::cast(right)->Integer32Value() == 2) { | |
8628 result = HMul::New(zone(), context, left, left); | 8626 result = HMul::New(zone(), context, left, left); |
8629 } | 8627 } |
8630 | 8628 |
8631 if (result == NULL) { | 8629 if (result == NULL) { |
8632 result = HPower::New(zone(), left, right); | 8630 result = HPower::New(zone(), left, right); |
8633 } | 8631 } |
8634 ast_context()->ReturnInstruction(result, expr->id()); | 8632 ast_context()->ReturnInstruction(result, expr->id()); |
8635 return true; | 8633 return true; |
8636 } | 8634 } |
8637 break; | 8635 break; |
(...skipping 3055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11693 } | 11691 } |
11694 } | 11692 } |
11695 | 11693 |
11696 #ifdef DEBUG | 11694 #ifdef DEBUG |
11697 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11695 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11698 if (allocator_ != NULL) allocator_->Verify(); | 11696 if (allocator_ != NULL) allocator_->Verify(); |
11699 #endif | 11697 #endif |
11700 } | 11698 } |
11701 | 11699 |
11702 } } // namespace v8::internal | 11700 } } // namespace v8::internal |
OLD | NEW |