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

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

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Add new Canonicalize call to make use of type data Created 3 years, 9 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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/jit_optimizer.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/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/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 3174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 } else if (is_integer) { 3185 } else if (is_integer) {
3186 return Type::IntType(); 3186 return Type::IntType();
3187 } else if (is_double) { 3187 } else if (is_double) {
3188 return Type::Double(); 3188 return Type::Double();
3189 } 3189 }
3190 3190
3191 return Type::null(); 3191 return Type::null();
3192 } 3192 }
3193 3193
3194 3194
3195 Definition* InstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
3196 const intptr_t receiver_cid = PushArgumentAt(0)->value()->Type()->ToCid();
3197
3198 if (!HasICData()) return this;
3199
3200 const ICData& new_ic_data =
3201 FlowGraphCompiler::TrySpecializeICDataByReceiverCid(*ic_data(),
3202 receiver_cid);
3203 if (new_ic_data.raw() == ic_data()->raw()) {
3204 // No specialization.
3205 return this;
3206 }
3207
3208 const bool with_checks = false;
3209 const bool complete = false;
3210 PolymorphicInstanceCallInstr* specialized = new PolymorphicInstanceCallInstr(
3211 this, new_ic_data, with_checks, complete);
3212 flow_graph->InsertBefore(this, specialized, env(), FlowGraph::kValue);
3213 return specialized;
3214 }
3215
3216
3195 Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) { 3217 Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
3196 if (!HasSingleRecognizedTarget() || with_checks()) { 3218 if (!HasSingleRecognizedTarget() || with_checks()) {
3197 return this; 3219 return this;
3198 } 3220 }
3199 3221
3200 const Function& target = Function::Handle(ic_data().GetTargetAt(0)); 3222 const Function& target = Function::Handle(ic_data().GetTargetAt(0));
3201 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) { 3223 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) {
3202 const AbstractType& type = 3224 const AbstractType& type =
3203 AbstractType::Handle(ComputeRuntimeType(ic_data())); 3225 AbstractType::Handle(ComputeRuntimeType(ic_data()));
3204 if (!type.IsNull()) { 3226 if (!type.IsNull()) {
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3936 set_native_c_function(native_function); 3958 set_native_c_function(native_function);
3937 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3959 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3938 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3960 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3939 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3961 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3940 set_is_bootstrap_native(is_bootstrap_native); 3962 set_is_bootstrap_native(is_bootstrap_native);
3941 } 3963 }
3942 3964
3943 #undef __ 3965 #undef __
3944 3966
3945 } // namespace dart 3967 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/jit_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698