Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: runtime/vm/flow_graph_optimizer.cc

Issue 13936009: Inline Float32x4 constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 } 2100 }
2101 2101
2102 2102
2103 void FlowGraphOptimizer::VisitStaticCall(StaticCallInstr* call) { 2103 void FlowGraphOptimizer::VisitStaticCall(StaticCallInstr* call) {
2104 MethodRecognizer::Kind recognized_kind = 2104 MethodRecognizer::Kind recognized_kind =
2105 MethodRecognizer::RecognizeKind(call->function()); 2105 MethodRecognizer::RecognizeKind(call->function());
2106 if (recognized_kind == MethodRecognizer::kMathSqrt) { 2106 if (recognized_kind == MethodRecognizer::kMathSqrt) {
2107 MathSqrtInstr* sqrt = 2107 MathSqrtInstr* sqrt =
2108 new MathSqrtInstr(new Value(call->ArgumentAt(0)), call); 2108 new MathSqrtInstr(new Value(call->ArgumentAt(0)), call);
2109 ReplaceCall(call, sqrt); 2109 ReplaceCall(call, sqrt);
2110 } else if (recognized_kind == MethodRecognizer::kFloat32x4Zero) {
2111 Float32x4ZeroInstr* zero = new Float32x4ZeroInstr(call);
2112 ReplaceCall(call, zero);
2113 } else if (recognized_kind == MethodRecognizer::kFloat32x4Splat) {
2114 Float32x4SplatInstr* splat =
2115 new Float32x4SplatInstr(new Value(call->ArgumentAt(1)), call);
2116 ReplaceCall(call, splat);
2117 } else if (recognized_kind == MethodRecognizer::kFloat32x4Constructor) {
2118 Float32x4ConstructorInstr* con =
2119 new Float32x4ConstructorInstr(new Value(call->ArgumentAt(1)),
2120 new Value(call->ArgumentAt(2)),
2121 new Value(call->ArgumentAt(3)),
2122 new Value(call->ArgumentAt(4)),
2123 call);
2124 ReplaceCall(call, con);
2110 } 2125 }
2111 } 2126 }
2112 2127
2113 2128
2114 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, 2129 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr,
2115 const ICData& unary_ic_data) { 2130 const ICData& unary_ic_data) {
2116 ASSERT((unary_ic_data.NumberOfChecks() > 0) && 2131 ASSERT((unary_ic_data.NumberOfChecks() > 0) &&
2117 (unary_ic_data.num_args_tested() == 1)); 2132 (unary_ic_data.num_args_tested() == 1));
2118 if (FLAG_enable_type_checks) { 2133 if (FLAG_enable_type_checks) {
2119 // TODO(srdjan): Add assignable check node if --enable_type_checks. 2134 // TODO(srdjan): Add assignable check node if --enable_type_checks.
(...skipping 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after
4722 const Object& right = instr->right()->definition()->constant_value(); 4737 const Object& right = instr->right()->definition()->constant_value();
4723 if (IsNonConstant(left) || IsNonConstant(right)) { 4738 if (IsNonConstant(left) || IsNonConstant(right)) {
4724 SetValue(instr, non_constant_); 4739 SetValue(instr, non_constant_);
4725 } else if (IsConstant(left) && IsConstant(right)) { 4740 } else if (IsConstant(left) && IsConstant(right)) {
4726 // TODO(kmillikin): Handle binary operation. 4741 // TODO(kmillikin): Handle binary operation.
4727 SetValue(instr, non_constant_); 4742 SetValue(instr, non_constant_);
4728 } 4743 }
4729 } 4744 }
4730 4745
4731 4746
4747 void ConstantPropagator::VisitFloat32x4Constructor(
4748 Float32x4ConstructorInstr* instr) {
4749 SetValue(instr, non_constant_);
4750 }
4751
4752
4732 void ConstantPropagator::VisitFloat32x4Shuffle(Float32x4ShuffleInstr* instr) { 4753 void ConstantPropagator::VisitFloat32x4Shuffle(Float32x4ShuffleInstr* instr) {
4733 SetValue(instr, non_constant_); 4754 SetValue(instr, non_constant_);
4734 } 4755 }
4735 4756
4736 4757
4758 void ConstantPropagator::VisitFloat32x4Zero(Float32x4ZeroInstr* instr) {
4759 SetValue(instr, non_constant_);
4760 }
4761
4762
4763 void ConstantPropagator::VisitFloat32x4Splat(Float32x4SplatInstr* instr) {
4764 SetValue(instr, non_constant_);
4765 }
4766
4767
4737 void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) { 4768 void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) {
4738 const Object& value = instr->value()->definition()->constant_value(); 4769 const Object& value = instr->value()->definition()->constant_value();
4739 if (IsNonConstant(value)) { 4770 if (IsNonConstant(value)) {
4740 SetValue(instr, non_constant_); 4771 SetValue(instr, non_constant_);
4741 } else if (IsConstant(value)) { 4772 } else if (IsConstant(value)) {
4742 // TODO(kmillikin): Handle sqrt. 4773 // TODO(kmillikin): Handle sqrt.
4743 SetValue(instr, non_constant_); 4774 SetValue(instr, non_constant_);
4744 } 4775 }
4745 } 4776 }
4746 4777
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
5351 if (changed) { 5382 if (changed) {
5352 // We may have changed the block order and the dominator tree. 5383 // We may have changed the block order and the dominator tree.
5353 flow_graph->DiscoverBlocks(); 5384 flow_graph->DiscoverBlocks();
5354 GrowableArray<BitVector*> dominance_frontier; 5385 GrowableArray<BitVector*> dominance_frontier;
5355 flow_graph->ComputeDominators(&dominance_frontier); 5386 flow_graph->ComputeDominators(&dominance_frontier);
5356 } 5387 }
5357 } 5388 }
5358 5389
5359 5390
5360 } // namespace dart 5391 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698