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 4479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4490 if (use->IsBinaryOperation()) { | 4490 if (use->IsBinaryOperation()) { |
4491 HBinaryOperation::cast(use)->set_observed_input_representation( | 4491 HBinaryOperation::cast(use)->set_observed_input_representation( |
4492 it.index(), Representation::Smi()); | 4492 it.index(), Representation::Smi()); |
4493 } | 4493 } |
4494 } | 4494 } |
4495 } | 4495 } |
4496 | 4496 |
4497 | 4497 |
4498 void HPhi::InferRepresentation(HInferRepresentationPhase* h_infer) { | 4498 void HPhi::InferRepresentation(HInferRepresentationPhase* h_infer) { |
4499 DCHECK(CheckFlag(kFlexibleRepresentation)); | 4499 DCHECK(CheckFlag(kFlexibleRepresentation)); |
4500 Representation new_rep = RepresentationFromInputs(); | 4500 Representation new_rep = RepresentationFromUses(); |
| 4501 UpdateRepresentation(new_rep, h_infer, "uses"); |
| 4502 new_rep = RepresentationFromInputs(); |
4501 UpdateRepresentation(new_rep, h_infer, "inputs"); | 4503 UpdateRepresentation(new_rep, h_infer, "inputs"); |
4502 new_rep = RepresentationFromUses(); | |
4503 UpdateRepresentation(new_rep, h_infer, "uses"); | |
4504 new_rep = RepresentationFromUseRequirements(); | 4504 new_rep = RepresentationFromUseRequirements(); |
4505 UpdateRepresentation(new_rep, h_infer, "use requirements"); | 4505 UpdateRepresentation(new_rep, h_infer, "use requirements"); |
4506 } | 4506 } |
4507 | 4507 |
4508 | 4508 |
4509 Representation HPhi::RepresentationFromInputs() { | 4509 Representation HPhi::RepresentationFromInputs() { |
4510 Representation r = Representation::None(); | 4510 bool has_type_feedback = |
| 4511 smi_non_phi_uses() + int32_non_phi_uses() + double_non_phi_uses() > 0; |
| 4512 Representation r = representation(); |
4511 for (int i = 0; i < OperandCount(); ++i) { | 4513 for (int i = 0; i < OperandCount(); ++i) { |
| 4514 // Ignore conservative Tagged assumption of parameters if we have |
| 4515 // reason to believe that it's too conservative. |
| 4516 if (has_type_feedback && OperandAt(i)->IsParameter()) continue; |
| 4517 |
4512 r = r.generalize(OperandAt(i)->KnownOptimalRepresentation()); | 4518 r = r.generalize(OperandAt(i)->KnownOptimalRepresentation()); |
4513 } | 4519 } |
4514 return r; | 4520 return r; |
4515 } | 4521 } |
4516 | 4522 |
4517 | 4523 |
4518 // Returns a representation if all uses agree on the same representation. | 4524 // Returns a representation if all uses agree on the same representation. |
4519 // Integer32 is also returned when some uses are Smi but others are Integer32. | 4525 // Integer32 is also returned when some uses are Smi but others are Integer32. |
4520 Representation HValue::RepresentationFromUseRequirements() { | 4526 Representation HValue::RepresentationFromUseRequirements() { |
4521 Representation rep = Representation::None(); | 4527 Representation rep = Representation::None(); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4805 break; | 4811 break; |
4806 case HObjectAccess::kExternalMemory: | 4812 case HObjectAccess::kExternalMemory: |
4807 os << "[external-memory]"; | 4813 os << "[external-memory]"; |
4808 break; | 4814 break; |
4809 } | 4815 } |
4810 | 4816 |
4811 return os << "@" << access.offset(); | 4817 return os << "@" << access.offset(); |
4812 } | 4818 } |
4813 | 4819 |
4814 } } // namespace v8::internal | 4820 } } // namespace v8::internal |
OLD | NEW |