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

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, 7 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 =
2112 new Float32x4ZeroInstr(recognized_kind, call);
2113 ReplaceCall(call, zero);
2114 } else if (recognized_kind == MethodRecognizer::kFloat32x4Splat) {
2115 Float32x4SplatInstr* splat =
2116 new Float32x4SplatInstr(recognized_kind, new Value(call->ArgumentAt(1)),
2117 call);
2118 ReplaceCall(call, splat);
2119 } else if (recognized_kind == MethodRecognizer::kFloat32x4Constructor) {
2120 Float32x4ConstructorInstr* con =
2121 new Float32x4ConstructorInstr(recognized_kind,
2122 new Value(call->ArgumentAt(1)),
2123 new Value(call->ArgumentAt(2)),
2124 new Value(call->ArgumentAt(3)),
2125 new Value(call->ArgumentAt(4)),
2126 call);
2127 ReplaceCall(call, con);
2110 } 2128 }
2111 } 2129 }
2112 2130
2113 2131
2114 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, 2132 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr,
2115 const ICData& unary_ic_data) { 2133 const ICData& unary_ic_data) {
2116 ASSERT((unary_ic_data.NumberOfChecks() > 0) && 2134 ASSERT((unary_ic_data.NumberOfChecks() > 0) &&
2117 (unary_ic_data.num_args_tested() == 1)); 2135 (unary_ic_data.num_args_tested() == 1));
2118 if (FLAG_enable_type_checks) { 2136 if (FLAG_enable_type_checks) {
2119 // TODO(srdjan): Add assignable check node if --enable_type_checks. 2137 // 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(); 4740 const Object& right = instr->right()->definition()->constant_value();
4723 if (IsNonConstant(left) || IsNonConstant(right)) { 4741 if (IsNonConstant(left) || IsNonConstant(right)) {
4724 SetValue(instr, non_constant_); 4742 SetValue(instr, non_constant_);
4725 } else if (IsConstant(left) && IsConstant(right)) { 4743 } else if (IsConstant(left) && IsConstant(right)) {
4726 // TODO(kmillikin): Handle binary operation. 4744 // TODO(kmillikin): Handle binary operation.
4727 SetValue(instr, non_constant_); 4745 SetValue(instr, non_constant_);
4728 } 4746 }
4729 } 4747 }
4730 4748
4731 4749
4750 void ConstantPropagator::VisitFloat32x4Constructor(
4751 Float32x4ConstructorInstr* instr) {
4752 SetValue(instr, non_constant_);
4753 }
4754
4755
4732 void ConstantPropagator::VisitFloat32x4Shuffle(Float32x4ShuffleInstr* instr) { 4756 void ConstantPropagator::VisitFloat32x4Shuffle(Float32x4ShuffleInstr* instr) {
4733 SetValue(instr, non_constant_); 4757 SetValue(instr, non_constant_);
4734 } 4758 }
4735 4759
4736 4760
4761 void ConstantPropagator::VisitFloat32x4Zero(Float32x4ZeroInstr* instr) {
srdjan 2013/04/25 20:19:25 Add SetValue(...)
Cutch 2013/04/25 20:52:07 Done.
4762 }
4763
4764
4765 void ConstantPropagator::VisitFloat32x4Splat(Float32x4SplatInstr* instr) {
4766 SetValue(instr, non_constant_);
4767 }
4768
4769
4737 void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) { 4770 void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) {
4738 const Object& value = instr->value()->definition()->constant_value(); 4771 const Object& value = instr->value()->definition()->constant_value();
4739 if (IsNonConstant(value)) { 4772 if (IsNonConstant(value)) {
4740 SetValue(instr, non_constant_); 4773 SetValue(instr, non_constant_);
4741 } else if (IsConstant(value)) { 4774 } else if (IsConstant(value)) {
4742 // TODO(kmillikin): Handle sqrt. 4775 // TODO(kmillikin): Handle sqrt.
4743 SetValue(instr, non_constant_); 4776 SetValue(instr, non_constant_);
4744 } 4777 }
4745 } 4778 }
4746 4779
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
5351 if (changed) { 5384 if (changed) {
5352 // We may have changed the block order and the dominator tree. 5385 // We may have changed the block order and the dominator tree.
5353 flow_graph->DiscoverBlocks(); 5386 flow_graph->DiscoverBlocks();
5354 GrowableArray<BitVector*> dominance_frontier; 5387 GrowableArray<BitVector*> dominance_frontier;
5355 flow_graph->ComputeDominators(&dominance_frontier); 5388 flow_graph->ComputeDominators(&dominance_frontier);
5356 } 5389 }
5357 } 5390 }
5358 5391
5359 5392
5360 } // namespace dart 5393 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698