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/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 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1795 new Float32x4ScaleInstr(recognized_kind, new Value(right), | 1795 new Float32x4ScaleInstr(recognized_kind, new Value(right), |
| 1796 new Value(left), call); | 1796 new Value(left), call); |
| 1797 ReplaceCall(call, scale); | 1797 ReplaceCall(call, scale); |
| 1798 return true; | 1798 return true; |
| 1799 } | 1799 } |
| 1800 case MethodRecognizer::kFloat32x4Sqrt: | 1800 case MethodRecognizer::kFloat32x4Sqrt: |
| 1801 case MethodRecognizer::kFloat32x4ReciprocalSqrt: | 1801 case MethodRecognizer::kFloat32x4ReciprocalSqrt: |
| 1802 case MethodRecognizer::kFloat32x4Reciprocal: { | 1802 case MethodRecognizer::kFloat32x4Reciprocal: { |
| 1803 Definition* left = call->ArgumentAt(0); | 1803 Definition* left = call->ArgumentAt(0); |
| 1804 AddCheckClass(left, | 1804 AddCheckClass(left, |
| 1805 ICData::ZoneHandle( | 1805 ICData::ZoneHandle( |
| 1806 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | 1806 call->ic_data()->AsUnaryClassChecksForArgNr(0)), |
| 1807 call->deopt_id(), | 1807 call->deopt_id(), |
| 1808 call->env(), | 1808 call->env(), |
| 1809 call); | 1809 call); |
| 1810 Float32x4SqrtInstr* sqrt = | 1810 Float32x4SqrtInstr* sqrt = |
| 1811 new Float32x4SqrtInstr(recognized_kind, new Value(left), call); | 1811 new Float32x4SqrtInstr(recognized_kind, new Value(left), call); |
| 1812 ReplaceCall(call, sqrt); | 1812 ReplaceCall(call, sqrt); |
| 1813 return true; | 1813 return true; |
| 1814 } | 1814 } |
| 1815 case MethodRecognizer::kFloat32x4WithX: | |
| 1816 case MethodRecognizer::kFloat32x4WithY: | |
| 1817 case MethodRecognizer::kFloat32x4WithZ: | |
| 1818 case MethodRecognizer::kFloat32x4WithW: { | |
| 1819 Definition* left = call->ArgumentAt(0); | |
| 1820 Definition* right = call->ArgumentAt(1); | |
| 1821 // Type check left. | |
| 1822 AddCheckClass(left, | |
| 1823 ICData::ZoneHandle( | |
| 1824 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | |
| 1825 call->deopt_id(), | |
| 1826 call->env(), | |
| 1827 call); | |
| 1828 Float32x4WithInstr* with = new Float32x4WithInstr(recognized_kind, | |
| 1829 new Value(left), | |
| 1830 new Value(right), | |
| 1831 call); | |
| 1832 ReplaceCall(call, with); | |
| 1833 return true; | |
| 1834 } | |
| 1835 case MethodRecognizer::kFloat32x4Absolute: | |
| 1836 case MethodRecognizer::kFloat32x4Negate: { | |
| 1837 Definition* left = call->ArgumentAt(0); | |
| 1838 // Type check left. | |
| 1839 AddCheckClass(left, | |
| 1840 ICData::ZoneHandle( | |
| 1841 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | |
| 1842 call->deopt_id(), | |
| 1843 call->env(), | |
| 1844 call); | |
| 1845 Float32x4ZeroArgInstr* zeroArg = | |
| 1846 new Float32x4ZeroArgInstr(recognized_kind, new Value(left), call); | |
| 1847 ReplaceCall(call, zeroArg); | |
| 1848 return true; | |
| 1849 } | |
| 1850 case MethodRecognizer::kFloat32x4Clamp: { | |
| 1851 Definition* left = call->ArgumentAt(0); | |
| 1852 Definition* lower = call->ArgumentAt(1); | |
| 1853 Definition* upper = call->ArgumentAt(2); | |
| 1854 // Type check left. | |
| 1855 AddCheckClass(left, | |
| 1856 ICData::ZoneHandle( | |
| 1857 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | |
| 1858 call->deopt_id(), | |
| 1859 call->env(), | |
| 1860 call); | |
| 1861 Float32x4ClampInstr* clamp = new Float32x4ClampInstr(new Value(left), | |
| 1862 new Value(lower), | |
| 1863 new Value(upper), | |
| 1864 call); | |
| 1865 ReplaceCall(call, clamp); | |
| 1866 return true; | |
| 1867 } | |
| 1868 case MethodRecognizer::kFloat32x4ToUint32x4: { | |
| 1869 Definition* left = call->ArgumentAt(0); | |
| 1870 // Type check left. | |
| 1871 AddCheckClass(left, | |
| 1872 ICData::ZoneHandle( | |
| 1873 call->ic_data()->AsUnaryClassChecksForArgNr(0)), | |
| 1874 call->deopt_id(), | |
| 1875 call->env(), | |
| 1876 call); | |
| 1877 Float32x4ToUint32x4Instr* cast = | |
| 1878 new Float32x4ToUint32x4Instr(new Value(left), call); | |
| 1879 ReplaceCall(call, cast); | |
| 1880 return true; | |
| 1881 } | |
|
srdjan
2013/05/01 18:33:18
This method has been become unwieldy. You may cons
Cutch
2013/05/01 19:56:37
Done.
| |
| 1815 default: | 1882 default: |
| 1816 return false; | 1883 return false; |
| 1817 } | 1884 } |
| 1818 } | 1885 } |
| 1819 return false; | 1886 return false; |
| 1820 } | 1887 } |
| 1821 | 1888 |
| 1822 | 1889 |
| 1823 bool FlowGraphOptimizer::BuildByteArrayViewLoad( | 1890 bool FlowGraphOptimizer::BuildByteArrayViewLoad( |
| 1824 InstanceCallInstr* call, | 1891 InstanceCallInstr* call, |
| (...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4930 void ConstantPropagator::VisitFloat32x4Scale(Float32x4ScaleInstr* instr) { | 4997 void ConstantPropagator::VisitFloat32x4Scale(Float32x4ScaleInstr* instr) { |
| 4931 SetValue(instr, non_constant_); | 4998 SetValue(instr, non_constant_); |
| 4932 } | 4999 } |
| 4933 | 5000 |
| 4934 | 5001 |
| 4935 void ConstantPropagator::VisitFloat32x4Sqrt(Float32x4SqrtInstr* instr) { | 5002 void ConstantPropagator::VisitFloat32x4Sqrt(Float32x4SqrtInstr* instr) { |
| 4936 SetValue(instr, non_constant_); | 5003 SetValue(instr, non_constant_); |
| 4937 } | 5004 } |
| 4938 | 5005 |
| 4939 | 5006 |
| 5007 void ConstantPropagator::VisitFloat32x4ZeroArg(Float32x4ZeroArgInstr* instr) { | |
| 5008 SetValue(instr, non_constant_); | |
| 5009 } | |
| 5010 | |
| 5011 | |
| 5012 void ConstantPropagator::VisitFloat32x4Clamp(Float32x4ClampInstr* instr) { | |
| 5013 SetValue(instr, non_constant_); | |
| 5014 } | |
| 5015 | |
| 5016 | |
| 5017 void ConstantPropagator::VisitFloat32x4With(Float32x4WithInstr* instr) { | |
| 5018 SetValue(instr, non_constant_); | |
| 5019 } | |
| 5020 | |
| 5021 | |
| 5022 void ConstantPropagator::VisitFloat32x4ToUint32x4( | |
| 5023 Float32x4ToUint32x4Instr* instr) { | |
| 5024 SetValue(instr, non_constant_); | |
| 5025 } | |
| 5026 | |
| 5027 | |
| 4940 void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) { | 5028 void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) { |
| 4941 const Object& value = instr->value()->definition()->constant_value(); | 5029 const Object& value = instr->value()->definition()->constant_value(); |
| 4942 if (IsNonConstant(value)) { | 5030 if (IsNonConstant(value)) { |
| 4943 SetValue(instr, non_constant_); | 5031 SetValue(instr, non_constant_); |
| 4944 } else if (IsConstant(value)) { | 5032 } else if (IsConstant(value)) { |
| 4945 // TODO(kmillikin): Handle sqrt. | 5033 // TODO(kmillikin): Handle sqrt. |
| 4946 SetValue(instr, non_constant_); | 5034 SetValue(instr, non_constant_); |
| 4947 } | 5035 } |
| 4948 } | 5036 } |
| 4949 | 5037 |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5576 if (changed) { | 5664 if (changed) { |
| 5577 // We may have changed the block order and the dominator tree. | 5665 // We may have changed the block order and the dominator tree. |
| 5578 flow_graph->DiscoverBlocks(); | 5666 flow_graph->DiscoverBlocks(); |
| 5579 GrowableArray<BitVector*> dominance_frontier; | 5667 GrowableArray<BitVector*> dominance_frontier; |
| 5580 flow_graph->ComputeDominators(&dominance_frontier); | 5668 flow_graph->ComputeDominators(&dominance_frontier); |
| 5581 } | 5669 } |
| 5582 } | 5670 } |
| 5583 | 5671 |
| 5584 | 5672 |
| 5585 } // namespace dart | 5673 } // namespace dart |
| OLD | NEW |