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

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

Issue 501553005: Scale invocation count by the number of BBs in the flow-graph of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 11 matching lines...) Expand all
22 #include "vm/symbols.h" 22 #include "vm/symbols.h"
23 23
24 namespace dart { 24 namespace dart {
25 25
26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); 26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); 27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic.");
28 DECLARE_FLAG(int, optimization_counter_threshold); 28 DECLARE_FLAG(int, optimization_counter_threshold);
29 DECLARE_FLAG(int, reoptimization_counter_threshold); 29 DECLARE_FLAG(int, reoptimization_counter_threshold);
30 DECLARE_FLAG(bool, enable_type_checks); 30 DECLARE_FLAG(bool, enable_type_checks);
31 DECLARE_FLAG(bool, enable_simd_inline); 31 DECLARE_FLAG(bool, enable_simd_inline);
32 DEFINE_FLAG(int, optimization_counter_scale, 2270,
Vyacheslav Egorov (Google) 2014/08/28 14:26:40 Maybe use 100 * Math.pow(Math.PI, Math.E) here? :)
Anders Johnsen 2014/08/28 14:44:16 I'm not sure - where do you get that "magic number
srdjan 2014/08/28 16:49:16 The number is definitely wrong, it must be a typo
srdjan 2014/08/28 17:39:10 On a serious note: do specific number (2270) looks
Vyacheslav Egorov (Google) 2014/08/28 18:06:49 I would like to clarify where 2270 came from: orig
Anders Johnsen 2014/08/29 07:11:37 Yes, the quadratic scale came from Karl and I expe
33 "The scale of invocation count, by size of the function.");
34 DEFINE_FLAG(int, optimization_counter_start, 5000,
35 "The minimum invocation count for a function.");
srdjan 2014/08/28 17:39:10 Maybe rename to min_optimization_counter_threshold
Anders Johnsen 2014/08/29 07:11:37 Done.
32 36
33 37
34 FlowGraphCompiler::~FlowGraphCompiler() { 38 FlowGraphCompiler::~FlowGraphCompiler() {
35 // BlockInfos are zone-allocated, so their destructors are not called. 39 // BlockInfos are zone-allocated, so their destructors are not called.
36 // Verify the labels explicitly here. 40 // Verify the labels explicitly here.
37 for (int i = 0; i < block_info_.length(); ++i) { 41 for (int i = 0; i < block_info_.length(); ++i) {
38 ASSERT(!block_info_[i]->jump_label()->IsLinked()); 42 ASSERT(!block_info_[i]->jump_label()->IsLinked());
39 ASSERT(!block_info_[i]->jump_label()->HasNear()); 43 ASSERT(!block_info_[i]->jump_label()->HasNear());
40 } 44 }
41 } 45 }
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 997
994 // Patch point is after the eventually inlined function object. 998 // Patch point is after the eventually inlined function object.
995 entry_patch_pc_offset_ = assembler()->CodeSize(); 999 entry_patch_pc_offset_ = assembler()->CodeSize();
996 1000
997 if (is_optimizing()) { 1001 if (is_optimizing()) {
998 // Reoptimization of an optimized function is triggered by counting in 1002 // Reoptimization of an optimized function is triggered by counting in
999 // IC stubs, but not at the entry of the function. 1003 // IC stubs, but not at the entry of the function.
1000 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()), 1004 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()),
1001 Immediate(FLAG_reoptimization_counter_threshold)); 1005 Immediate(FLAG_reoptimization_counter_threshold));
1002 } else { 1006 } else {
1007 intptr_t basic_blocks = flow_graph().preorder().length();
srdjan 2014/08/28 17:39:10 const
Anders Johnsen 2014/08/29 07:11:37 Done.
1008 ASSERT(basic_blocks > 0);
1009 intptr_t limit = FLAG_optimization_counter_scale * basic_blocks +
1010 FLAG_optimization_counter_start;
srdjan 2014/08/28 17:39:10 const
Anders Johnsen 2014/08/29 07:11:37 Cannot, I may reassign below.
1011 if (limit > FLAG_optimization_counter_threshold) {
1012 limit = FLAG_optimization_counter_threshold;
1013 }
1003 __ incl(FieldAddress(function_reg, Function::usage_counter_offset())); 1014 __ incl(FieldAddress(function_reg, Function::usage_counter_offset()));
1004 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()), 1015 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()),
1005 Immediate(FLAG_optimization_counter_threshold)); 1016 Immediate(limit));
1006 } 1017 }
1007 ASSERT(function_reg == EDI); 1018 ASSERT(function_reg == EDI);
1008 __ j(GREATER_EQUAL, &stub_code->OptimizeFunctionLabel()); 1019 __ j(GREATER_EQUAL, &stub_code->OptimizeFunctionLabel());
1009 } else if (!flow_graph().IsCompiledForOsr()) { 1020 } else if (!flow_graph().IsCompiledForOsr()) {
1010 entry_patch_pc_offset_ = assembler()->CodeSize(); 1021 entry_patch_pc_offset_ = assembler()->CodeSize();
1011 } 1022 }
1012 __ Comment("Enter frame"); 1023 __ Comment("Enter frame");
1013 if (flow_graph().IsCompiledForOsr()) { 1024 if (flow_graph().IsCompiledForOsr()) {
1014 intptr_t extra_slots = StackSize() 1025 intptr_t extra_slots = StackSize()
1015 - flow_graph().num_stack_locals() 1026 - flow_graph().num_stack_locals()
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 __ movups(reg, Address(ESP, 0)); 1784 __ movups(reg, Address(ESP, 0));
1774 __ addl(ESP, Immediate(kFpuRegisterSize)); 1785 __ addl(ESP, Immediate(kFpuRegisterSize));
1775 } 1786 }
1776 1787
1777 1788
1778 #undef __ 1789 #undef __
1779 1790
1780 } // namespace dart 1791 } // namespace dart
1781 1792
1782 #endif // defined TARGET_ARCH_IA32 1793 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698