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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
6 | 6 |
7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
8 | 8 |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 return false; | 1836 return false; |
1837 } | 1837 } |
1838 | 1838 |
1839 | 1839 |
1840 void FlowGraphCompiler::EmitPolymorphicInstanceCall( | 1840 void FlowGraphCompiler::EmitPolymorphicInstanceCall( |
1841 const ICData& ic_data, | 1841 const ICData& ic_data, |
1842 intptr_t argument_count, | 1842 intptr_t argument_count, |
1843 const Array& argument_names, | 1843 const Array& argument_names, |
1844 intptr_t deopt_id, | 1844 intptr_t deopt_id, |
1845 TokenPosition token_pos, | 1845 TokenPosition token_pos, |
1846 LocationSummary* locs) { | 1846 LocationSummary* locs, |
| 1847 bool complete) { |
1847 if (FLAG_polymorphic_with_deopt) { | 1848 if (FLAG_polymorphic_with_deopt) { |
1848 Label* deopt = AddDeoptStub(deopt_id, | 1849 Label* deopt = AddDeoptStub(deopt_id, |
1849 ICData::kDeoptPolymorphicInstanceCallTestFail); | 1850 ICData::kDeoptPolymorphicInstanceCallTestFail); |
1850 Label ok; | 1851 Label ok; |
1851 EmitTestAndCall(ic_data, argument_count, argument_names, | 1852 EmitTestAndCall(ic_data, argument_count, argument_names, |
1852 deopt, // No cid match. | 1853 deopt, // No cid match. |
1853 &ok, // Found cid. | 1854 &ok, // Found cid. |
1854 deopt_id, token_pos, locs); | 1855 deopt_id, token_pos, locs, complete); |
1855 assembler()->Bind(&ok); | 1856 assembler()->Bind(&ok); |
1856 } else { | 1857 } else { |
1857 // Instead of deoptimizing, do a megamorphic call when no matching | 1858 if (complete) { |
1858 // cid found. | 1859 Label ok; |
1859 Label ok; | 1860 EmitTestAndCall(ic_data, argument_count, argument_names, |
1860 MegamorphicSlowPath* slow_path = | 1861 NULL, // No cid match. |
| 1862 &ok, // Found cid. |
| 1863 deopt_id, token_pos, locs, true); |
| 1864 assembler()->Bind(&ok); |
| 1865 } else { |
| 1866 // Instead of deoptimizing, do a megamorphic call when no matching |
| 1867 // cid found. |
| 1868 Label ok; |
| 1869 MegamorphicSlowPath* slow_path = |
1861 new MegamorphicSlowPath(ic_data, argument_count, deopt_id, | 1870 new MegamorphicSlowPath(ic_data, argument_count, deopt_id, |
1862 token_pos, locs, CurrentTryIndex()); | 1871 token_pos, locs, CurrentTryIndex()); |
1863 AddSlowPathCode(slow_path); | 1872 AddSlowPathCode(slow_path); |
1864 EmitTestAndCall(ic_data, argument_count, argument_names, | 1873 EmitTestAndCall(ic_data, argument_count, argument_names, |
1865 slow_path->entry_label(), // No cid match. | 1874 slow_path->entry_label(), // No cid match. |
1866 &ok, // Found cid. | 1875 &ok, // Found cid. |
1867 deopt_id, token_pos, locs); | 1876 deopt_id, token_pos, locs, false); |
1868 | 1877 |
1869 assembler()->Bind(slow_path->exit_label()); | 1878 assembler()->Bind(slow_path->exit_label()); |
1870 assembler()->Bind(&ok); | 1879 assembler()->Bind(&ok); |
| 1880 } |
1871 } | 1881 } |
1872 } | 1882 } |
1873 | 1883 |
1874 | 1884 |
1875 #if defined(DEBUG) | 1885 #if defined(DEBUG) |
1876 void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) { | 1886 void FlowGraphCompiler::FrameStateUpdateWith(Instruction* instr) { |
1877 ASSERT(!is_optimizing()); | 1887 ASSERT(!is_optimizing()); |
1878 | 1888 |
1879 switch (instr->tag()) { | 1889 switch (instr->tag()) { |
1880 case Instruction::kPushArgument: | 1890 case Instruction::kPushArgument: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 | 1950 |
1941 | 1951 |
1942 void FlowGraphCompiler::FrameStateClear() { | 1952 void FlowGraphCompiler::FrameStateClear() { |
1943 ASSERT(!is_optimizing()); | 1953 ASSERT(!is_optimizing()); |
1944 frame_state_.TruncateTo(0); | 1954 frame_state_.TruncateTo(0); |
1945 } | 1955 } |
1946 #endif | 1956 #endif |
1947 | 1957 |
1948 | 1958 |
1949 } // namespace dart | 1959 } // namespace dart |
OLD | NEW |