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

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

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: Cleanups Created 3 years, 10 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
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::TrySpecializeICData(*ic_data(), receiver_cid);
3202 if (new_ic_data.raw() == ic_data()->raw()) {
3203 // No specialization.
3204 return this;
3205 }
3206
3207 const bool with_checks = false;
3208 const bool complete = false;
3209 PolymorphicInstanceCallInstr* specialized = new PolymorphicInstanceCallInstr(
3210 this, new_ic_data, with_checks, complete);
3211
Vyacheslav Egorov (Google) 2017/02/23 15:32:38 Remove empty line before and after InsertBefore.
3212 flow_graph->InsertBefore(this, specialized, env(), FlowGraph::kValue);
3213
3214 return specialized;
3215 }
3216
3217
3195 Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) { 3218 Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
3196 if (!HasSingleRecognizedTarget() || with_checks()) { 3219 if (!HasSingleRecognizedTarget() || with_checks()) {
3197 return this; 3220 return this;
3198 } 3221 }
3199 3222
3200 const Function& target = Function::Handle(ic_data().GetTargetAt(0)); 3223 const Function& target = Function::Handle(ic_data().GetTargetAt(0));
3201 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) { 3224 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) {
3202 const AbstractType& type = 3225 const AbstractType& type =
3203 AbstractType::Handle(ComputeRuntimeType(ic_data())); 3226 AbstractType::Handle(ComputeRuntimeType(ic_data()));
3204 if (!type.IsNull()) { 3227 if (!type.IsNull()) {
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3936 set_native_c_function(native_function); 3959 set_native_c_function(native_function);
3937 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3960 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3938 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3961 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3939 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3962 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3940 set_is_bootstrap_native(is_bootstrap_native); 3963 set_is_bootstrap_native(is_bootstrap_native);
3941 } 3964 }
3942 3965
3943 #undef __ 3966 #undef __
3944 3967
3945 } // namespace dart 3968 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698