| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress"); | 41 DEFINE_FLAG(bool, trace_range_analysis, false, "Trace range analysis progress"); |
| 42 DEFINE_FLAG(bool, truncating_left_shift, true, | 42 DEFINE_FLAG(bool, truncating_left_shift, true, |
| 43 "Optimize left shift to truncate if possible"); | 43 "Optimize left shift to truncate if possible"); |
| 44 DEFINE_FLAG(bool, use_cha, true, "Use class hierarchy analysis."); | 44 DEFINE_FLAG(bool, use_cha, true, "Use class hierarchy analysis."); |
| 45 DECLARE_FLAG(bool, eliminate_type_checks); | 45 DECLARE_FLAG(bool, eliminate_type_checks); |
| 46 DECLARE_FLAG(bool, enable_type_checks); | 46 DECLARE_FLAG(bool, enable_type_checks); |
| 47 DECLARE_FLAG(bool, trace_type_check_elimination); | 47 DECLARE_FLAG(bool, trace_type_check_elimination); |
| 48 | 48 |
| 49 | 49 |
| 50 static bool ShouldInlineSimd() { | 50 static bool ShouldInlineSimd() { |
| 51 return FlowGraphCompiler::SupportsUnboxedFloat32x4(); | 51 return FlowGraphCompiler::SupportsUnboxedSimd128(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 // Optimize instance calls using ICData. | 55 // Optimize instance calls using ICData. |
| 56 void FlowGraphOptimizer::ApplyICData() { | 56 void FlowGraphOptimizer::ApplyICData() { |
| 57 VisitBlocks(); | 57 VisitBlocks(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 // Optimize instance calls using cid. This is called after optimizer | 61 // Optimize instance calls using cid. This is called after optimizer |
| (...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 if (HasOnlyTwoOf(ic_data, kSmiCid)) { | 1953 if (HasOnlyTwoOf(ic_data, kSmiCid)) { |
| 1954 // Don't generate smi code if the IC data is marked because of an | 1954 // Don't generate smi code if the IC data is marked because of an |
| 1955 // overflow. | 1955 // overflow. |
| 1956 // TODO(fschneider): Add unboxed mint multiplication. | 1956 // TODO(fschneider): Add unboxed mint multiplication. |
| 1957 if (ic_data.deopt_reason() == kDeoptBinarySmiOp) return false; | 1957 if (ic_data.deopt_reason() == kDeoptBinarySmiOp) return false; |
| 1958 operands_type = kSmiCid; | 1958 operands_type = kSmiCid; |
| 1959 } else if (ShouldSpecializeForDouble(ic_data)) { | 1959 } else if (ShouldSpecializeForDouble(ic_data)) { |
| 1960 operands_type = kDoubleCid; | 1960 operands_type = kDoubleCid; |
| 1961 } else if (HasOnlyTwoOf(ic_data, kFloat32x4Cid)) { | 1961 } else if (HasOnlyTwoOf(ic_data, kFloat32x4Cid)) { |
| 1962 operands_type = kFloat32x4Cid; | 1962 operands_type = kFloat32x4Cid; |
| 1963 } else if (HasOnlyTwoOf(ic_data, kFloat64x2Cid)) { |
| 1964 operands_type = kFloat64x2Cid; |
| 1963 } else { | 1965 } else { |
| 1964 return false; | 1966 return false; |
| 1965 } | 1967 } |
| 1966 break; | 1968 break; |
| 1967 case Token::kDIV: | 1969 case Token::kDIV: |
| 1968 if (ShouldSpecializeForDouble(ic_data) || | 1970 if (ShouldSpecializeForDouble(ic_data) || |
| 1969 HasOnlyTwoOf(ic_data, kSmiCid)) { | 1971 HasOnlyTwoOf(ic_data, kSmiCid)) { |
| 1970 operands_type = kDoubleCid; | 1972 operands_type = kDoubleCid; |
| 1971 } else if (HasOnlyTwoOf(ic_data, kFloat32x4Cid)) { | 1973 } else if (HasOnlyTwoOf(ic_data, kFloat32x4Cid)) { |
| 1972 operands_type = kFloat32x4Cid; | 1974 operands_type = kFloat32x4Cid; |
| 1975 } else if (HasOnlyTwoOf(ic_data, kFloat64x2Cid)) { |
| 1976 operands_type = kFloat64x2Cid; |
| 1973 } else { | 1977 } else { |
| 1974 return false; | 1978 return false; |
| 1975 } | 1979 } |
| 1976 break; | 1980 break; |
| 1977 case Token::kBIT_AND: | 1981 case Token::kBIT_AND: |
| 1978 case Token::kBIT_OR: | 1982 case Token::kBIT_OR: |
| 1979 case Token::kBIT_XOR: | 1983 case Token::kBIT_XOR: |
| 1980 if (HasOnlyTwoOf(ic_data, kSmiCid)) { | 1984 if (HasOnlyTwoOf(ic_data, kSmiCid)) { |
| 1981 operands_type = kSmiCid; | 1985 operands_type = kSmiCid; |
| 1982 } else if (HasTwoMintOrSmi(ic_data)) { | 1986 } else if (HasTwoMintOrSmi(ic_data)) { |
| (...skipping 7053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9036 } | 9040 } |
| 9037 | 9041 |
| 9038 // Insert materializations at environment uses. | 9042 // Insert materializations at environment uses. |
| 9039 for (intptr_t i = 0; i < exits.length(); i++) { | 9043 for (intptr_t i = 0; i < exits.length(); i++) { |
| 9040 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); | 9044 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); |
| 9041 } | 9045 } |
| 9042 } | 9046 } |
| 9043 | 9047 |
| 9044 | 9048 |
| 9045 } // namespace dart | 9049 } // namespace dart |
| OLD | NEW |