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 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3270 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | 3270 call->ic_data()->AsUnaryClassChecksForArgNr(0)), |
3271 call->deopt_id(), | 3271 call->deopt_id(), |
3272 call->env(), | 3272 call->env(), |
3273 call); | 3273 call); |
3274 Float64x2ZeroArgInstr* zeroArg = | 3274 Float64x2ZeroArgInstr* zeroArg = |
3275 new Float64x2ZeroArgInstr(recognized_kind, new Value(left), | 3275 new Float64x2ZeroArgInstr(recognized_kind, new Value(left), |
3276 call->deopt_id()); | 3276 call->deopt_id()); |
3277 ReplaceCall(call, zeroArg); | 3277 ReplaceCall(call, zeroArg); |
3278 return true; | 3278 return true; |
3279 } | 3279 } |
| 3280 case MethodRecognizer::kFloat64x2Scale: |
| 3281 case MethodRecognizer::kFloat64x2WithX: |
| 3282 case MethodRecognizer::kFloat64x2WithY: |
| 3283 case MethodRecognizer::kFloat64x2Min: |
| 3284 case MethodRecognizer::kFloat64x2Max: { |
| 3285 Definition* left = call->ArgumentAt(0); |
| 3286 Definition* right = call->ArgumentAt(1); |
| 3287 // Type check left. |
| 3288 AddCheckClass(left, |
| 3289 ICData::ZoneHandle( |
| 3290 call->ic_data()->AsUnaryClassChecksForArgNr(0)), |
| 3291 call->deopt_id(), |
| 3292 call->env(), |
| 3293 call); |
| 3294 Float64x2OneArgInstr* zeroArg = |
| 3295 new Float64x2OneArgInstr(recognized_kind, new Value(left), |
| 3296 new Value(right), call->deopt_id()); |
| 3297 ReplaceCall(call, zeroArg); |
| 3298 return true; |
| 3299 } |
3280 default: | 3300 default: |
3281 return false; | 3301 return false; |
3282 } | 3302 } |
3283 } | 3303 } |
3284 | 3304 |
3285 | 3305 |
3286 bool FlowGraphOptimizer::TryInlineInt32x4Method( | 3306 bool FlowGraphOptimizer::TryInlineInt32x4Method( |
3287 InstanceCallInstr* call, | 3307 InstanceCallInstr* call, |
3288 MethodRecognizer::Kind recognized_kind) { | 3308 MethodRecognizer::Kind recognized_kind) { |
3289 if (!ShouldInlineSimd()) { | 3309 if (!ShouldInlineSimd()) { |
(...skipping 4685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7975 Float64x2SplatInstr* instr) { | 7995 Float64x2SplatInstr* instr) { |
7976 SetValue(instr, non_constant_); | 7996 SetValue(instr, non_constant_); |
7977 } | 7997 } |
7978 | 7998 |
7979 | 7999 |
7980 void ConstantPropagator::VisitFloat64x2Constructor( | 8000 void ConstantPropagator::VisitFloat64x2Constructor( |
7981 Float64x2ConstructorInstr* instr) { | 8001 Float64x2ConstructorInstr* instr) { |
7982 SetValue(instr, non_constant_); | 8002 SetValue(instr, non_constant_); |
7983 } | 8003 } |
7984 | 8004 |
| 8005 |
7985 void ConstantPropagator::VisitFloat64x2ZeroArg(Float64x2ZeroArgInstr* instr) { | 8006 void ConstantPropagator::VisitFloat64x2ZeroArg(Float64x2ZeroArgInstr* instr) { |
7986 // TODO(johnmccutchan): Implement constant propagation. | 8007 // TODO(johnmccutchan): Implement constant propagation. |
7987 SetValue(instr, non_constant_); | 8008 SetValue(instr, non_constant_); |
7988 } | 8009 } |
7989 | 8010 |
7990 | 8011 |
| 8012 void ConstantPropagator::VisitFloat64x2OneArg(Float64x2OneArgInstr* instr) { |
| 8013 // TODO(johnmccutchan): Implement constant propagation. |
| 8014 SetValue(instr, non_constant_); |
| 8015 } |
| 8016 |
| 8017 |
7991 void ConstantPropagator::VisitMathUnary(MathUnaryInstr* instr) { | 8018 void ConstantPropagator::VisitMathUnary(MathUnaryInstr* instr) { |
7992 const Object& value = instr->value()->definition()->constant_value(); | 8019 const Object& value = instr->value()->definition()->constant_value(); |
7993 if (IsNonConstant(value)) { | 8020 if (IsNonConstant(value)) { |
7994 SetValue(instr, non_constant_); | 8021 SetValue(instr, non_constant_); |
7995 } else if (IsConstant(value)) { | 8022 } else if (IsConstant(value)) { |
7996 // TODO(kmillikin): Handle Math's unary operations (sqrt, cos, sin). | 8023 // TODO(kmillikin): Handle Math's unary operations (sqrt, cos, sin). |
7997 SetValue(instr, non_constant_); | 8024 SetValue(instr, non_constant_); |
7998 } | 8025 } |
7999 } | 8026 } |
8000 | 8027 |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8913 } | 8940 } |
8914 | 8941 |
8915 // Insert materializations at environment uses. | 8942 // Insert materializations at environment uses. |
8916 for (intptr_t i = 0; i < exits.length(); i++) { | 8943 for (intptr_t i = 0; i < exits.length(); i++) { |
8917 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); | 8944 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); |
8918 } | 8945 } |
8919 } | 8946 } |
8920 | 8947 |
8921 | 8948 |
8922 } // namespace dart | 8949 } // namespace dart |
OLD | NEW |