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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm64.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: Cleanup 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 | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 DECLARE_FLAG(int, optimization_counter_threshold);
27 DECLARE_FLAG(int, reoptimization_counter_threshold);
28 DECLARE_FLAG(bool, enable_simd_inline); 26 DECLARE_FLAG(bool, enable_simd_inline);
29 27
30 28
31 FlowGraphCompiler::~FlowGraphCompiler() { 29 FlowGraphCompiler::~FlowGraphCompiler() {
32 // BlockInfos are zone-allocated, so their destructors are not called. 30 // BlockInfos are zone-allocated, so their destructors are not called.
33 // Verify the labels explicitly here. 31 // Verify the labels explicitly here.
34 for (int i = 0; i < block_info_.length(); ++i) { 32 for (int i = 0; i < block_info_.length(); ++i) {
35 ASSERT(!block_info_[i]->jump_label()->IsLinked()); 33 ASSERT(!block_info_[i]->jump_label()->IsLinked());
36 } 34 }
37 } 35 }
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 967
970 // Set up pool pointer in new_pp. 968 // Set up pool pointer in new_pp.
971 __ LoadPoolPointer(new_pp); 969 __ LoadPoolPointer(new_pp);
972 970
973 // Load function object using the callee's pool pointer. 971 // Load function object using the callee's pool pointer.
974 __ LoadObject(function_reg, function, new_pp); 972 __ LoadObject(function_reg, function, new_pp);
975 973
976 // Patch point is after the eventually inlined function object. 974 // Patch point is after the eventually inlined function object.
977 entry_patch_pc_offset_ = assembler()->CodeSize(); 975 entry_patch_pc_offset_ = assembler()->CodeSize();
978 976
979 intptr_t threshold = FLAG_optimization_counter_threshold;
980 __ LoadFieldFromOffset( 977 __ LoadFieldFromOffset(
981 R7, function_reg, Function::usage_counter_offset(), new_pp, kWord); 978 R7, function_reg, Function::usage_counter_offset(), new_pp, kWord);
982 if (is_optimizing()) { 979 // Reoptimization of an optimized function is triggered by counting in
983 // Reoptimization of an optimized function is triggered by counting in 980 // IC stubs, but not at the entry of the function.
984 // IC stubs, but not at the entry of the function. 981 if (!is_optimizing()) {
985 threshold = FLAG_reoptimization_counter_threshold;
986 } else {
987 __ add(R7, R7, Operand(1)); 982 __ add(R7, R7, Operand(1));
988 __ StoreFieldToOffset( 983 __ StoreFieldToOffset(
989 R7, function_reg, Function::usage_counter_offset(), new_pp, kWord); 984 R7, function_reg, Function::usage_counter_offset(), new_pp, kWord);
990 } 985 }
991 __ CompareImmediate(R7, threshold, new_pp); 986 __ CompareImmediate(R7, GetOptimizationThreshold(), new_pp);
992 ASSERT(function_reg == R6); 987 ASSERT(function_reg == R6);
993 Label dont_optimize; 988 Label dont_optimize;
994 __ b(&dont_optimize, LT); 989 __ b(&dont_optimize, LT);
995 __ Branch(&stub_code->OptimizeFunctionLabel(), new_pp); 990 __ Branch(&stub_code->OptimizeFunctionLabel(), new_pp);
996 __ Bind(&dont_optimize); 991 __ Bind(&dont_optimize);
997 } else if (!flow_graph().IsCompiledForOsr()) { 992 } else if (!flow_graph().IsCompiledForOsr()) {
998 // We have to load the PP here too because a load of an external label 993 // We have to load the PP here too because a load of an external label
999 // may be patched at the AddCurrentDescriptor below. 994 // may be patched at the AddCurrentDescriptor below.
1000 new_pp = R13; 995 new_pp = R13;
1001 996
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1732 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1738 UNIMPLEMENTED(); 1733 UNIMPLEMENTED();
1739 } 1734 }
1740 1735
1741 1736
1742 #undef __ 1737 #undef __
1743 1738
1744 } // namespace dart 1739 } // namespace dart
1745 1740
1746 #endif // defined TARGET_ARCH_ARM64 1741 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698