Chromium Code Reviews| 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 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3252 if (!ShouldInlineSimd()) { | 3252 if (!ShouldInlineSimd()) { |
| 3253 return false; | 3253 return false; |
| 3254 } | 3254 } |
| 3255 ASSERT(call->HasICData()); | 3255 ASSERT(call->HasICData()); |
| 3256 switch (recognized_kind) { | 3256 switch (recognized_kind) { |
| 3257 case MethodRecognizer::kFloat64x2GetX: | 3257 case MethodRecognizer::kFloat64x2GetX: |
| 3258 case MethodRecognizer::kFloat64x2GetY: | 3258 case MethodRecognizer::kFloat64x2GetY: |
| 3259 ASSERT(call->ic_data()->HasReceiverClassId(kFloat64x2Cid)); | 3259 ASSERT(call->ic_data()->HasReceiverClassId(kFloat64x2Cid)); |
| 3260 ASSERT(call->ic_data()->HasOneTarget()); | 3260 ASSERT(call->ic_data()->HasOneTarget()); |
| 3261 return InlineFloat64x2Getter(call, recognized_kind); | 3261 return InlineFloat64x2Getter(call, recognized_kind); |
| 3262 case MethodRecognizer::kFloat64x2Negate: | |
| 3263 case MethodRecognizer::kFloat64x2Abs: | |
| 3264 case MethodRecognizer::kFloat64x2Sqrt: | |
| 3265 case MethodRecognizer::kFloat64x2GetSignMask: { | |
| 3266 Definition* left = call->ArgumentAt(0); | |
| 3267 // Type check left. | |
| 3268 AddCheckClass(left, | |
| 3269 ICData::ZoneHandle( | |
| 3270 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | |
| 3271 call->deopt_id(), | |
| 3272 call->env(), | |
| 3273 call); | |
| 3274 Float64x2ZeroArgInstr* zeroArg = | |
| 3275 new Float64x2ZeroArgInstr(recognized_kind, new Value(left), | |
| 3276 call->deopt_id()); | |
| 3277 ReplaceCall(call, zeroArg); | |
| 3278 return true; | |
| 3279 } | |
| 3262 default: | 3280 default: |
| 3263 return false; | 3281 return false; |
| 3264 } | 3282 } |
| 3265 } | 3283 } |
| 3266 | 3284 |
| 3267 | 3285 |
| 3268 bool FlowGraphOptimizer::TryInlineInt32x4Method( | 3286 bool FlowGraphOptimizer::TryInlineInt32x4Method( |
| 3269 InstanceCallInstr* call, | 3287 InstanceCallInstr* call, |
| 3270 MethodRecognizer::Kind recognized_kind) { | 3288 MethodRecognizer::Kind recognized_kind) { |
| 3271 if (!ShouldInlineSimd()) { | 3289 if (!ShouldInlineSimd()) { |
| (...skipping 4685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7957 Float64x2SplatInstr* instr) { | 7975 Float64x2SplatInstr* instr) { |
| 7958 SetValue(instr, non_constant_); | 7976 SetValue(instr, non_constant_); |
| 7959 } | 7977 } |
| 7960 | 7978 |
| 7961 | 7979 |
| 7962 void ConstantPropagator::VisitFloat64x2Constructor( | 7980 void ConstantPropagator::VisitFloat64x2Constructor( |
| 7963 Float64x2ConstructorInstr* instr) { | 7981 Float64x2ConstructorInstr* instr) { |
| 7964 SetValue(instr, non_constant_); | 7982 SetValue(instr, non_constant_); |
| 7965 } | 7983 } |
| 7966 | 7984 |
| 7985 void ConstantPropagator::VisitFloat64x2ZeroArg(Float64x2ZeroArgInstr* instr) { | |
|
srdjan
2014/03/10 20:45:58
Add a TODO to implement constant propagation for F
Cutch
2014/03/10 20:52:47
Done.
| |
| 7986 SetValue(instr, non_constant_); | |
| 7987 } | |
| 7988 | |
| 7967 | 7989 |
| 7968 void ConstantPropagator::VisitMathUnary(MathUnaryInstr* instr) { | 7990 void ConstantPropagator::VisitMathUnary(MathUnaryInstr* instr) { |
| 7969 const Object& value = instr->value()->definition()->constant_value(); | 7991 const Object& value = instr->value()->definition()->constant_value(); |
| 7970 if (IsNonConstant(value)) { | 7992 if (IsNonConstant(value)) { |
| 7971 SetValue(instr, non_constant_); | 7993 SetValue(instr, non_constant_); |
| 7972 } else if (IsConstant(value)) { | 7994 } else if (IsConstant(value)) { |
| 7973 // TODO(kmillikin): Handle Math's unary operations (sqrt, cos, sin). | 7995 // TODO(kmillikin): Handle Math's unary operations (sqrt, cos, sin). |
| 7974 SetValue(instr, non_constant_); | 7996 SetValue(instr, non_constant_); |
| 7975 } | 7997 } |
| 7976 } | 7998 } |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8890 } | 8912 } |
| 8891 | 8913 |
| 8892 // Insert materializations at environment uses. | 8914 // Insert materializations at environment uses. |
| 8893 for (intptr_t i = 0; i < exits.length(); i++) { | 8915 for (intptr_t i = 0; i < exits.length(); i++) { |
| 8894 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); | 8916 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); |
| 8895 } | 8917 } |
| 8896 } | 8918 } |
| 8897 | 8919 |
| 8898 | 8920 |
| 8899 } // namespace dart | 8921 } // namespace dart |
| OLD | NEW |