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

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

Issue 2451893002: Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern." (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/flow_graph_inliner.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/aot_optimizer.h" 7 #include "vm/aot_optimizer.h"
8 #include "vm/block_scheduler.h" 8 #include "vm/block_scheduler.h"
9 #include "vm/branch_optimizer.h" 9 #include "vm/branch_optimizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 param_stubs); 841 param_stubs);
842 DEBUG_ASSERT(callee_graph->VerifyUseLists()); 842 DEBUG_ASSERT(callee_graph->VerifyUseLists());
843 } 843 }
844 844
845 { 845 {
846 CSTAT_TIMER_SCOPE(thread(), graphinliner_opt_timer); 846 CSTAT_TIMER_SCOPE(thread(), graphinliner_opt_timer);
847 // TODO(fschneider): Improve suppression of speculative inlining. 847 // TODO(fschneider): Improve suppression of speculative inlining.
848 // Deopt-ids overlap between caller and callee. 848 // Deopt-ids overlap between caller and callee.
849 if (FLAG_precompiled_mode) { 849 if (FLAG_precompiled_mode) {
850 #ifdef DART_PRECOMPILER 850 #ifdef DART_PRECOMPILER
851 AotOptimizer optimizer(inliner_->precompiler_, 851 AotOptimizer optimizer(callee_graph,
852 callee_graph,
853 inliner_->use_speculative_inlining_, 852 inliner_->use_speculative_inlining_,
854 inliner_->inlining_black_list_); 853 inliner_->inlining_black_list_);
855 optimizer.PopulateWithICData(); 854 optimizer.PopulateWithICData();
856 855
857 optimizer.ApplyClassIds(); 856 optimizer.ApplyClassIds();
858 DEBUG_ASSERT(callee_graph->VerifyUseLists()); 857 DEBUG_ASSERT(callee_graph->VerifyUseLists());
859 858
860 FlowGraphTypePropagator::Propagate(callee_graph); 859 FlowGraphTypePropagator::Propagate(callee_graph);
861 DEBUG_ASSERT(callee_graph->VerifyUseLists()); 860 DEBUG_ASSERT(callee_graph->VerifyUseLists());
862 861
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 return FLAG_trace_inlining && FlowGraphPrinter::ShouldPrint(top); 1892 return FLAG_trace_inlining && FlowGraphPrinter::ShouldPrint(top);
1894 } 1893 }
1895 1894
1896 1895
1897 FlowGraphInliner::FlowGraphInliner( 1896 FlowGraphInliner::FlowGraphInliner(
1898 FlowGraph* flow_graph, 1897 FlowGraph* flow_graph,
1899 GrowableArray<const Function*>* inline_id_to_function, 1898 GrowableArray<const Function*>* inline_id_to_function,
1900 GrowableArray<TokenPosition>* inline_id_to_token_pos, 1899 GrowableArray<TokenPosition>* inline_id_to_token_pos,
1901 GrowableArray<intptr_t>* caller_inline_id, 1900 GrowableArray<intptr_t>* caller_inline_id,
1902 bool use_speculative_inlining, 1901 bool use_speculative_inlining,
1903 GrowableArray<intptr_t>* inlining_black_list, 1902 GrowableArray<intptr_t>* inlining_black_list)
1904 Precompiler* precompiler)
1905 : flow_graph_(flow_graph), 1903 : flow_graph_(flow_graph),
1906 inline_id_to_function_(inline_id_to_function), 1904 inline_id_to_function_(inline_id_to_function),
1907 inline_id_to_token_pos_(inline_id_to_token_pos), 1905 inline_id_to_token_pos_(inline_id_to_token_pos),
1908 caller_inline_id_(caller_inline_id), 1906 caller_inline_id_(caller_inline_id),
1909 trace_inlining_(ShouldTraceInlining(flow_graph)), 1907 trace_inlining_(ShouldTraceInlining(flow_graph)),
1910 use_speculative_inlining_(use_speculative_inlining), 1908 use_speculative_inlining_(use_speculative_inlining),
1911 inlining_black_list_(inlining_black_list), 1909 inlining_black_list_(inlining_black_list) {
1912 precompiler_(precompiler) {
1913 ASSERT(!use_speculative_inlining || (inlining_black_list != NULL)); 1910 ASSERT(!use_speculative_inlining || (inlining_black_list != NULL));
1914 } 1911 }
1915 1912
1916 1913
1917 void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph, bool force) { 1914 void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph, bool force) {
1918 const Function& function = flow_graph->function(); 1915 const Function& function = flow_graph->function();
1919 if (force || (function.optimized_instruction_count() == 0)) { 1916 if (force || (function.optimized_instruction_count() == 0)) {
1920 GraphInfoCollector info; 1917 GraphInfoCollector info;
1921 info.Collect(*flow_graph); 1918 info.Collect(*flow_graph);
1922 1919
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
3806 flow_graph->AppendTo(*entry, *last, 3803 flow_graph->AppendTo(*entry, *last,
3807 call->deopt_id() != Thread::kNoDeoptId ? 3804 call->deopt_id() != Thread::kNoDeoptId ?
3808 call->env() : NULL, 3805 call->env() : NULL,
3809 FlowGraph::kValue); 3806 FlowGraph::kValue);
3810 return true; 3807 return true;
3811 } 3808 }
3812 } 3809 }
3813 return false; 3810 return false;
3814 } 3811 }
3815 3812
3816 case MethodRecognizer::kObjectRuntimeType: {
3817 Type& type = Type::Handle(Z);
3818 if (RawObject::IsStringClassId(receiver_cid)) {
3819 type = Type::StringType();
3820 } else if (receiver_cid == kDoubleCid) {
3821 type = Type::Double();
3822 } else if (RawObject::IsIntegerClassId(receiver_cid)) {
3823 type = Type::IntType();
3824 } else if (receiver_cid != kClosureCid) {
3825 const Class& cls = Class::Handle(Z,
3826 flow_graph->isolate()->class_table()->At(receiver_cid));
3827 if (!cls.IsGeneric()) {
3828 type = cls.CanonicalType();
3829 }
3830 }
3831
3832 if (!type.IsNull()) {
3833 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(),
3834 call->GetBlock()->try_index());
3835 (*entry)->InheritDeoptTarget(Z, call);
3836 *last = new(Z) ConstantInstr(Type::ZoneHandle(Z, type.raw()));
3837 flow_graph->AppendTo(*entry, *last,
3838 call->deopt_id() != Thread::kNoDeoptId ?
3839 call->env() : NULL,
3840 FlowGraph::kValue);
3841 return true;
3842 }
3843 return false;
3844 }
3845
3846 case MethodRecognizer::kOneByteStringSetAt: { 3813 case MethodRecognizer::kOneByteStringSetAt: {
3847 // This is an internal method, no need to check argument types nor 3814 // This is an internal method, no need to check argument types nor
3848 // range. 3815 // range.
3849 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(), 3816 *entry = new(Z) TargetEntryInstr(flow_graph->allocate_block_id(),
3850 call->GetBlock()->try_index()); 3817 call->GetBlock()->try_index());
3851 (*entry)->InheritDeoptTarget(Z, call); 3818 (*entry)->InheritDeoptTarget(Z, call);
3852 Definition* str = call->ArgumentAt(0); 3819 Definition* str = call->ArgumentAt(0);
3853 Definition* index = call->ArgumentAt(1); 3820 Definition* index = call->ArgumentAt(1);
3854 Definition* value = call->ArgumentAt(2); 3821 Definition* value = call->ArgumentAt(2);
3855 *last = new(Z) StoreIndexedInstr( 3822 *last = new(Z) StoreIndexedInstr(
(...skipping 13 matching lines...) Expand all
3869 return true; 3836 return true;
3870 } 3837 }
3871 3838
3872 default: 3839 default:
3873 return false; 3840 return false;
3874 } 3841 }
3875 } 3842 }
3876 3843
3877 3844
3878 } // namespace dart 3845 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698