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

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

Issue 1496713002: --collect_dynamic_function_names (default false): find unique virtual function names and use them t… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: g Created 5 years 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 | « no previous file | runtime/vm/object_store.h » ('j') | runtime/vm/precompiler.cc » ('J')
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_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/exceptions.h" 12 #include "vm/exceptions.h"
13 #include "vm/flow_graph_builder.h" 13 #include "vm/flow_graph_builder.h"
14 #include "vm/flow_graph_compiler.h" 14 #include "vm/flow_graph_compiler.h"
15 #include "vm/flow_graph_range_analysis.h" 15 #include "vm/flow_graph_range_analysis.h"
16 #include "vm/hash_map.h" 16 #include "vm/hash_map.h"
17 #include "vm/il_printer.h" 17 #include "vm/il_printer.h"
18 #include "vm/intermediate_language.h" 18 #include "vm/intermediate_language.h"
19 #include "vm/object_store.h" 19 #include "vm/object_store.h"
20 #include "vm/parser.h" 20 #include "vm/parser.h"
21 #include "vm/precompiler.h"
21 #include "vm/resolver.h" 22 #include "vm/resolver.h"
22 #include "vm/scopes.h" 23 #include "vm/scopes.h"
23 #include "vm/stack_frame.h" 24 #include "vm/stack_frame.h"
24 #include "vm/symbols.h" 25 #include "vm/symbols.h"
25 26
26 namespace dart { 27 namespace dart {
27 28
28 DEFINE_FLAG(int, getter_setter_ratio, 13, 29 DEFINE_FLAG(int, getter_setter_ratio, 13,
29 "Ratio of getter/setter usage used for double field unboxing heuristics"); 30 "Ratio of getter/setter usage used for double field unboxing heuristics");
30 DEFINE_FLAG(bool, guess_other_cid, true, 31 DEFINE_FLAG(bool, guess_other_cid, true,
(...skipping 11 matching lines...) Expand all
42 "Print live sets for load optimization pass."); 43 "Print live sets for load optimization pass.");
43 DEFINE_FLAG(bool, trace_optimization, false, "Print optimization details."); 44 DEFINE_FLAG(bool, trace_optimization, false, "Print optimization details.");
44 DEFINE_FLAG(bool, truncating_left_shift, true, 45 DEFINE_FLAG(bool, truncating_left_shift, true,
45 "Optimize left shift to truncate if possible"); 46 "Optimize left shift to truncate if possible");
46 DEFINE_FLAG(bool, use_cha_deopt, true, 47 DEFINE_FLAG(bool, use_cha_deopt, true,
47 "Use class hierarchy analysis even if it can cause deoptimization."); 48 "Use class hierarchy analysis even if it can cause deoptimization.");
48 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32) 49 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32)
49 DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass."); 50 DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass.");
50 #endif 51 #endif
51 52
53 DECLARE_FLAG(bool, precompilation);
52 DECLARE_FLAG(bool, polymorphic_with_deopt); 54 DECLARE_FLAG(bool, polymorphic_with_deopt);
53 DECLARE_FLAG(bool, source_lines); 55 DECLARE_FLAG(bool, source_lines);
54 DECLARE_FLAG(bool, trace_cha); 56 DECLARE_FLAG(bool, trace_cha);
55 DECLARE_FLAG(bool, trace_field_guards); 57 DECLARE_FLAG(bool, trace_field_guards);
56 DECLARE_FLAG(bool, trace_type_check_elimination); 58 DECLARE_FLAG(bool, trace_type_check_elimination);
57 DECLARE_FLAG(bool, warn_on_javascript_compatibility); 59 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
58 60
59 // Quick access to the current isolate and zone. 61 // Quick access to the current isolate and zone.
60 #define I (isolate()) 62 #define I (isolate())
61 #define Z (zone()) 63 #define Z (zone())
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 !CHA::HasSubclasses(owner_class) && 261 !CHA::HasSubclasses(owner_class) &&
260 !CHA::IsImplemented(owner_class)) { 262 !CHA::IsImplemented(owner_class)) {
261 const Array& args_desc_array = Array::Handle(Z, 263 const Array& args_desc_array = Array::Handle(Z,
262 ArgumentsDescriptor::New(call->ArgumentCount(), 264 ArgumentsDescriptor::New(call->ArgumentCount(),
263 call->argument_names())); 265 call->argument_names()));
264 ArgumentsDescriptor args_desc(args_desc_array); 266 ArgumentsDescriptor args_desc(args_desc_array);
265 const Function& function = Function::Handle(Z, 267 const Function& function = Function::Handle(Z,
266 Resolver::ResolveDynamicForReceiverClass(owner_class, 268 Resolver::ResolveDynamicForReceiverClass(owner_class,
267 call->function_name(), 269 call->function_name(),
268 args_desc)); 270 args_desc));
269 if (function.IsNull()) { 271 if (!function.IsNull()) {
270 return false; 272 const ICData& ic_data = ICData::ZoneHandle(Z,
273 ICData::NewFrom(*call->ic_data(), class_ids.length()));
274 ic_data.AddReceiverCheck(owner_class.id(), function);
275 call->set_ic_data(&ic_data);
276 return true;
271 } 277 }
278 }
279 }
280
281 if (FLAG_precompilation &&
282 (isolate()->object_store()->unique_dynamic_targets() != Array::null())) {
283 // Check if the target is unique.
284 Function& target_function = Function::Handle(Z);
285 Precompiler::GetUniqueDynamicTarget(
286 isolate(), call->function_name(), &target_function);
287 if (!target_function.IsNull()) {
288 const intptr_t cid = Class::Handle(Z, target_function.Owner()).id();
272 const ICData& ic_data = ICData::ZoneHandle(Z, 289 const ICData& ic_data = ICData::ZoneHandle(Z,
273 ICData::NewFrom(*call->ic_data(), class_ids.length())); 290 ICData::NewFrom(*call->ic_data(), 1));
274 ic_data.AddReceiverCheck(owner_class.id(), function); 291 ic_data.AddReceiverCheck(cid, target_function);
275 call->set_ic_data(&ic_data); 292 call->set_ic_data(&ic_data);
276 return true; 293 return true;
277 } 294 }
278 } 295 }
279 296
280 return false; 297 return false;
281 } 298 }
282 299
283 300
284 const ICData& FlowGraphOptimizer::TrySpecializeICData(const ICData& ic_data, 301 const ICData& FlowGraphOptimizer::TrySpecializeICData(const ICData& ic_data,
(...skipping 8540 matching lines...) Expand 10 before | Expand all | Expand 10 after
8825 8842
8826 // Insert materializations at environment uses. 8843 // Insert materializations at environment uses.
8827 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 8844 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
8828 CreateMaterializationAt( 8845 CreateMaterializationAt(
8829 exits_collector_.exits()[i], alloc, *slots); 8846 exits_collector_.exits()[i], alloc, *slots);
8830 } 8847 }
8831 } 8848 }
8832 8849
8833 8850
8834 } // namespace dart 8851 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object_store.h » ('j') | runtime/vm/precompiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698