| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| 11 #include "vm/flow_graph_compiler.h" | 11 #include "vm/flow_graph_compiler.h" |
| 12 #include "vm/flow_graph_optimizer.h" | 12 #include "vm/flow_graph_optimizer.h" |
| 13 #include "vm/locations.h" | 13 #include "vm/locations.h" |
| 14 #include "vm/object.h" | 14 #include "vm/object.h" |
| 15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 16 #include "vm/os.h" | 16 #include "vm/os.h" |
| 17 #include "vm/scopes.h" | 17 #include "vm/scopes.h" |
| 18 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
| 19 #include "vm/symbols.h" | 19 #include "vm/symbols.h" |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 | 22 |
| 23 DEFINE_FLAG(bool, propagate_ic_data, true, |
| 24 "Propagate IC data from unoptimized to optimized IC calls."); |
| 23 DECLARE_FLAG(bool, enable_type_checks); | 25 DECLARE_FLAG(bool, enable_type_checks); |
| 24 DECLARE_FLAG(int, max_polymorphic_checks); | 26 DECLARE_FLAG(int, max_polymorphic_checks); |
| 25 | 27 |
| 26 Definition::Definition() | 28 Definition::Definition() |
| 27 : range_(NULL), | 29 : range_(NULL), |
| 28 temp_index_(-1), | 30 temp_index_(-1), |
| 29 ssa_temp_index_(-1), | 31 ssa_temp_index_(-1), |
| 30 propagated_type_(AbstractType::Handle()), | 32 propagated_type_(AbstractType::Handle()), |
| 31 propagated_cid_(kIllegalCid), | 33 propagated_cid_(kIllegalCid), |
| 32 input_use_list_(NULL), | 34 input_use_list_(NULL), |
| (...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 __ Drop(argument_count); | 1841 __ Drop(argument_count); |
| 1840 } | 1842 } |
| 1841 | 1843 |
| 1842 | 1844 |
| 1843 LocationSummary* InstanceCallInstr::MakeLocationSummary() const { | 1845 LocationSummary* InstanceCallInstr::MakeLocationSummary() const { |
| 1844 return MakeCallSummary(); | 1846 return MakeCallSummary(); |
| 1845 } | 1847 } |
| 1846 | 1848 |
| 1847 | 1849 |
| 1848 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1850 void InstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1851 ICData& call_ic_data = ICData::ZoneHandle(ic_data()->raw()); |
| 1852 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) { |
| 1853 call_ic_data = ICData::New(compiler->parsed_function().function(), |
| 1854 function_name(), |
| 1855 deopt_id(), |
| 1856 checked_argument_count()); |
| 1857 } |
| 1849 if (compiler->is_optimizing()) { | 1858 if (compiler->is_optimizing()) { |
| 1850 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | 1859 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { |
| 1851 const ICData& unary_ic_data = | 1860 const ICData& unary_ic_data = |
| 1852 ICData::ZoneHandle(ic_data()->AsUnaryClassChecks()); | 1861 ICData::ZoneHandle(ic_data()->AsUnaryClassChecks()); |
| 1853 compiler->GenerateInstanceCall(deopt_id(), | 1862 compiler->GenerateInstanceCall(deopt_id(), |
| 1854 token_pos(), | 1863 token_pos(), |
| 1855 ArgumentCount(), | 1864 ArgumentCount(), |
| 1856 argument_names(), | 1865 argument_names(), |
| 1857 locs(), | 1866 locs(), |
| 1858 unary_ic_data); | 1867 unary_ic_data); |
| 1859 } else { | 1868 } else { |
| 1860 Label* deopt = | 1869 Label* deopt = |
| 1861 compiler->AddDeoptStub(deopt_id(), kDeoptInstanceCallNoICData); | 1870 compiler->AddDeoptStub(deopt_id(), kDeoptInstanceCallNoICData); |
| 1862 __ jmp(deopt); | 1871 __ jmp(deopt); |
| 1863 } | 1872 } |
| 1864 } else { | 1873 } else { |
| 1865 ASSERT(!HasICData()); | 1874 ASSERT(!HasICData()); |
| 1866 compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore, | 1875 compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore, |
| 1867 deopt_id(), | 1876 deopt_id(), |
| 1868 token_pos()); | 1877 token_pos()); |
| 1869 const ICData& initial_ic_data = ICData::ZoneHandle( | |
| 1870 ICData::New(compiler->parsed_function().function(), | |
| 1871 function_name(), | |
| 1872 deopt_id(), | |
| 1873 checked_argument_count())); | |
| 1874 compiler->GenerateInstanceCall(deopt_id(), | 1878 compiler->GenerateInstanceCall(deopt_id(), |
| 1875 token_pos(), | 1879 token_pos(), |
| 1876 ArgumentCount(), | 1880 ArgumentCount(), |
| 1877 argument_names(), | 1881 argument_names(), |
| 1878 locs(), | 1882 locs(), |
| 1879 initial_ic_data); | 1883 call_ic_data); |
| 1880 } | 1884 } |
| 1881 } | 1885 } |
| 1882 | 1886 |
| 1883 | 1887 |
| 1884 LocationSummary* StaticCallInstr::MakeLocationSummary() const { | 1888 LocationSummary* StaticCallInstr::MakeLocationSummary() const { |
| 1885 return MakeCallSummary(); | 1889 return MakeCallSummary(); |
| 1886 } | 1890 } |
| 1887 | 1891 |
| 1888 | 1892 |
| 1889 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1893 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2597 } while (CanonicalizeMaxBoundary(&max) || CanonicalizeMinBoundary(&length)); | 2601 } while (CanonicalizeMaxBoundary(&max) || CanonicalizeMinBoundary(&length)); |
| 2598 | 2602 |
| 2599 // Failed to prove that maximum is bounded with array length. | 2603 // Failed to prove that maximum is bounded with array length. |
| 2600 return false; | 2604 return false; |
| 2601 } | 2605 } |
| 2602 | 2606 |
| 2603 | 2607 |
| 2604 #undef __ | 2608 #undef __ |
| 2605 | 2609 |
| 2606 } // namespace dart | 2610 } // namespace dart |
| OLD | NEW |