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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.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: Refactor and port to archs. 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
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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"
11 #include "vm/compiler.h" 11 #include "vm/compiler.h"
12 #include "vm/cpu.h" 12 #include "vm/cpu.h"
13 #include "vm/dart_entry.h" 13 #include "vm/dart_entry.h"
14 #include "vm/deopt_instructions.h" 14 #include "vm/deopt_instructions.h"
15 #include "vm/il_printer.h" 15 #include "vm/il_printer.h"
16 #include "vm/locations.h" 16 #include "vm/locations.h"
17 #include "vm/object_store.h" 17 #include "vm/object_store.h"
18 #include "vm/parser.h" 18 #include "vm/parser.h"
19 #include "vm/stack_frame.h" 19 #include "vm/stack_frame.h"
20 #include "vm/stub_code.h" 20 #include "vm/stub_code.h"
21 #include "vm/symbols.h" 21 #include "vm/symbols.h"
22 22
23 namespace dart { 23 namespace dart {
24 24
25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); 25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
26 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); 26 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic.");
27 DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic."); 27 DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic.");
28 DECLARE_FLAG(int, optimization_counter_threshold);
29 DECLARE_FLAG(int, reoptimization_counter_threshold);
30 DECLARE_FLAG(bool, enable_type_checks); 28 DECLARE_FLAG(bool, enable_type_checks);
31 DECLARE_FLAG(bool, enable_simd_inline); 29 DECLARE_FLAG(bool, enable_simd_inline);
32 30
33 31
34 FlowGraphCompiler::~FlowGraphCompiler() { 32 FlowGraphCompiler::~FlowGraphCompiler() {
35 // BlockInfos are zone-allocated, so their destructors are not called. 33 // BlockInfos are zone-allocated, so their destructors are not called.
36 // Verify the labels explicitly here. 34 // Verify the labels explicitly here.
37 for (int i = 0; i < block_info_.length(); ++i) { 35 for (int i = 0; i < block_info_.length(); ++i) {
38 ASSERT(!block_info_[i]->jump_label()->IsLinked()); 36 ASSERT(!block_info_[i]->jump_label()->IsLinked());
39 } 37 }
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 // Temporarily setup pool pointer for this dart function. 970 // Temporarily setup pool pointer for this dart function.
973 __ LoadPoolPointer(); 971 __ LoadPoolPointer();
974 // Load function object from object pool. 972 // Load function object from object pool.
975 __ LoadObject(function_reg, function); // Uses PP. 973 __ LoadObject(function_reg, function); // Uses PP.
976 // Restore PP of caller. 974 // Restore PP of caller.
977 __ mov(PP, Operand(R7)); 975 __ mov(PP, Operand(R7));
978 976
979 // Patch point is after the eventually inlined function object. 977 // Patch point is after the eventually inlined function object.
980 entry_patch_pc_offset_ = assembler()->CodeSize(); 978 entry_patch_pc_offset_ = assembler()->CodeSize();
981 979
982 intptr_t threshold = FLAG_optimization_counter_threshold; 980 const intptr_t threshold = GetOptimizationThreshold();;
983 __ ldr(R7, FieldAddress(function_reg, 981 __ ldr(R7, FieldAddress(function_reg,
984 Function::usage_counter_offset())); 982 Function::usage_counter_offset()));
985 if (is_optimizing()) { 983 if (is_optimizing()) {
986 // Reoptimization of an optimized function is triggered by counting in 984 // Reoptimization of an optimized function is triggered by counting in
987 // IC stubs, but not at the entry of the function. 985 // IC stubs, but not at the entry of the function.
988 threshold = FLAG_reoptimization_counter_threshold;
989 } else { 986 } else {
Vyacheslav Egorov (Google) 2014/08/29 11:17:18 else -> if (!is_optimizing()) move comment above i
Anders Johnsen 2014/08/29 11:56:28 Done.
990 __ add(R7, R7, Operand(1)); 987 __ add(R7, R7, Operand(1));
991 __ str(R7, FieldAddress(function_reg, 988 __ str(R7, FieldAddress(function_reg,
992 Function::usage_counter_offset())); 989 Function::usage_counter_offset()));
993 } 990 }
994 __ CompareImmediate(R7, threshold); 991 __ CompareImmediate(R7, threshold);
995 ASSERT(function_reg == R6); 992 ASSERT(function_reg == R6);
996 __ Branch(&stub_code->OptimizeFunctionLabel(), GE); 993 __ Branch(&stub_code->OptimizeFunctionLabel(), GE);
997 } else if (!flow_graph().IsCompiledForOsr()) { 994 } else if (!flow_graph().IsCompiledForOsr()) {
998 entry_patch_pc_offset_ = assembler()->CodeSize(); 995 entry_patch_pc_offset_ = assembler()->CodeSize();
999 } 996 }
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 DRegister dreg = EvenDRegisterOf(reg); 1782 DRegister dreg = EvenDRegisterOf(reg);
1786 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1783 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1787 } 1784 }
1788 1785
1789 1786
1790 #undef __ 1787 #undef __
1791 1788
1792 } // namespace dart 1789 } // namespace dart
1793 1790
1794 #endif // defined TARGET_ARCH_ARM 1791 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698