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

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

Issue 2716593002: Propagate this-specialization to regular (megamorphic) calls (Closed)
Patch Set: 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"
11 #include "vm/cpu.h" 11 #include "vm/cpu.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/flow_graph_allocator.h" 13 #include "vm/flow_graph_allocator.h"
14 #include "vm/flow_graph_builder.h" 14 #include "vm/flow_graph_builder.h"
15 #include "vm/flow_graph_compiler.h" 15 #include "vm/flow_graph_compiler.h"
16 #include "vm/flow_graph_range_analysis.h" 16 #include "vm/flow_graph_range_analysis.h"
17 #include "vm/jit_optimizer.h"
17 #include "vm/locations.h" 18 #include "vm/locations.h"
18 #include "vm/method_recognizer.h" 19 #include "vm/method_recognizer.h"
19 #include "vm/object.h" 20 #include "vm/object.h"
20 #include "vm/object_store.h" 21 #include "vm/object_store.h"
21 #include "vm/os.h" 22 #include "vm/os.h"
22 #include "vm/regexp_assembler_ir.h" 23 #include "vm/regexp_assembler_ir.h"
23 #include "vm/resolver.h" 24 #include "vm/resolver.h"
24 #include "vm/scopes.h" 25 #include "vm/scopes.h"
25 #include "vm/stub_code.h" 26 #include "vm/stub_code.h"
26 #include "vm/symbols.h" 27 #include "vm/symbols.h"
(...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 } else if (is_integer) { 3186 } else if (is_integer) {
3186 return Type::IntType(); 3187 return Type::IntType();
3187 } else if (is_double) { 3188 } else if (is_double) {
3188 return Type::Double(); 3189 return Type::Double();
3189 } 3190 }
3190 3191
3191 return Type::null(); 3192 return Type::null();
3192 } 3193 }
3193 3194
3194 3195
3196 Definition* InstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
3197 const intptr_t receiver_cid = PushArgumentAt(0)->value()->Type()->ToCid();
3198
3199 if (!HasICData()) return this;
3200
3201 const ICData& new_ic_data =
3202 JitOptimizer::TrySpecializeICData(*ic_data(), 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 return specialized;
3213 }
3214
3215
3195 Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) { 3216 Definition* PolymorphicInstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
3196 if (!HasSingleRecognizedTarget() || with_checks()) { 3217 if (!HasSingleRecognizedTarget() || with_checks()) {
3197 return this; 3218 return this;
3198 } 3219 }
3199 3220
3200 const Function& target = Function::Handle(ic_data().GetTargetAt(0)); 3221 const Function& target = Function::Handle(ic_data().GetTargetAt(0));
3201 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) { 3222 if (target.recognized_kind() == MethodRecognizer::kObjectRuntimeType) {
3202 const AbstractType& type = 3223 const AbstractType& type =
3203 AbstractType::Handle(ComputeRuntimeType(ic_data())); 3224 AbstractType::Handle(ComputeRuntimeType(ic_data()));
3204 if (!type.IsNull()) { 3225 if (!type.IsNull()) {
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3936 set_native_c_function(native_function); 3957 set_native_c_function(native_function);
3937 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3958 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3938 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3959 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3939 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3960 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3940 set_is_bootstrap_native(is_bootstrap_native); 3961 set_is_bootstrap_native(is_bootstrap_native);
3941 } 3962 }
3942 3963
3943 #undef __ 3964 #undef __
3944 3965
3945 } // namespace dart 3966 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698