| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/double.h" | 8 #include "src/double.h" |
| 9 #include "src/factory.h" | 9 #include "src/factory.h" |
| 10 #include "src/hydrogen-infer-representation.h" | 10 #include "src/hydrogen-infer-representation.h" |
| (...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2204 * This method detects if phi is an induction variable, with phi_operand as | 2204 * This method detects if phi is an induction variable, with phi_operand as |
| 2205 * its "incremented" value (the other operand would be the "base" value). | 2205 * its "incremented" value (the other operand would be the "base" value). |
| 2206 * | 2206 * |
| 2207 * It cheks is phi_operand has the form "phi + constant". | 2207 * It cheks is phi_operand has the form "phi + constant". |
| 2208 * If yes, the constant is the increment that the induction variable gets at | 2208 * If yes, the constant is the increment that the induction variable gets at |
| 2209 * every loop iteration. | 2209 * every loop iteration. |
| 2210 * Otherwise it returns 0. | 2210 * Otherwise it returns 0. |
| 2211 */ | 2211 */ |
| 2212 int32_t InductionVariableData::ComputeIncrement(HPhi* phi, | 2212 int32_t InductionVariableData::ComputeIncrement(HPhi* phi, |
| 2213 HValue* phi_operand) { | 2213 HValue* phi_operand) { |
| 2214 if (!phi_operand->representation().IsInteger32()) return 0; | 2214 if (!phi_operand->representation().IsSmiOrInteger32()) return 0; |
| 2215 | 2215 |
| 2216 if (phi_operand->IsAdd()) { | 2216 if (phi_operand->IsAdd()) { |
| 2217 HAdd* operation = HAdd::cast(phi_operand); | 2217 HAdd* operation = HAdd::cast(phi_operand); |
| 2218 if (operation->left() == phi && | 2218 if (operation->left() == phi && |
| 2219 operation->right()->IsInteger32Constant()) { | 2219 operation->right()->IsInteger32Constant()) { |
| 2220 return operation->right()->GetInteger32Constant(); | 2220 return operation->right()->GetInteger32Constant(); |
| 2221 } else if (operation->right() == phi && | 2221 } else if (operation->right() == phi && |
| 2222 operation->left()->IsInteger32Constant()) { | 2222 operation->left()->IsInteger32Constant()) { |
| 2223 return operation->left()->GetInteger32Constant(); | 2223 return operation->left()->GetInteger32Constant(); |
| 2224 } | 2224 } |
| (...skipping 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4804 break; | 4804 break; |
| 4805 case HObjectAccess::kExternalMemory: | 4805 case HObjectAccess::kExternalMemory: |
| 4806 os << "[external-memory]"; | 4806 os << "[external-memory]"; |
| 4807 break; | 4807 break; |
| 4808 } | 4808 } |
| 4809 | 4809 |
| 4810 return os << "@" << access.offset(); | 4810 return os << "@" << access.offset(); |
| 4811 } | 4811 } |
| 4812 | 4812 |
| 4813 } } // namespace v8::internal | 4813 } } // namespace v8::internal |
| OLD | NEW |