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

Side by Side Diff: runtime/vm/flow_graph_compiler_mips.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_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.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) 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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/deopt_instructions.h" 13 #include "vm/deopt_instructions.h"
14 #include "vm/il_printer.h" 14 #include "vm/il_printer.h"
15 #include "vm/locations.h" 15 #include "vm/locations.h"
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #include "vm/parser.h" 17 #include "vm/parser.h"
18 #include "vm/stack_frame.h" 18 #include "vm/stack_frame.h"
19 #include "vm/stub_code.h" 19 #include "vm/stub_code.h"
20 #include "vm/symbols.h" 20 #include "vm/symbols.h"
21 21
22 namespace dart { 22 namespace dart {
23 23
24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); 24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
25 DECLARE_FLAG(int, optimization_counter_threshold);
26 DECLARE_FLAG(int, reoptimization_counter_threshold);
27 DECLARE_FLAG(bool, enable_type_checks); 25 DECLARE_FLAG(bool, enable_type_checks);
28 26
29 27
30 FlowGraphCompiler::~FlowGraphCompiler() { 28 FlowGraphCompiler::~FlowGraphCompiler() {
31 // BlockInfos are zone-allocated, so their destructors are not called. 29 // BlockInfos are zone-allocated, so their destructors are not called.
32 // Verify the labels explicitly here. 30 // Verify the labels explicitly here.
33 for (int i = 0; i < block_info_.length(); ++i) { 31 for (int i = 0; i < block_info_.length(); ++i) {
34 ASSERT(!block_info_[i]->jump_label()->IsLinked()); 32 ASSERT(!block_info_[i]->jump_label()->IsLinked());
35 } 33 }
36 } 34 }
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 // Temporarily setup pool pointer for this dart function. 999 // Temporarily setup pool pointer for this dart function.
1002 __ lw(PP, Address(T2, -object_pool_pc_dist)); 1000 __ lw(PP, Address(T2, -object_pool_pc_dist));
1003 // Load function object from object pool. 1001 // Load function object from object pool.
1004 __ LoadObject(function_reg, function); // Uses PP. 1002 __ LoadObject(function_reg, function); // Uses PP.
1005 // Restore PP of caller. 1003 // Restore PP of caller.
1006 __ mov(PP, T1); 1004 __ mov(PP, T1);
1007 1005
1008 // Patch point is after the eventually inlined function object. 1006 // Patch point is after the eventually inlined function object.
1009 entry_patch_pc_offset_ = assembler()->CodeSize(); 1007 entry_patch_pc_offset_ = assembler()->CodeSize();
1010 1008
1011 intptr_t threshold = FLAG_optimization_counter_threshold;
1012 __ lw(T1, FieldAddress(function_reg, Function::usage_counter_offset())); 1009 __ lw(T1, FieldAddress(function_reg, Function::usage_counter_offset()));
1013 if (is_optimizing()) { 1010 // Reoptimization of an optimized function is triggered by counting in
1014 // Reoptimization of an optimized function is triggered by counting in 1011 // IC stubs, but not at the entry of the function.
1015 // IC stubs, but not at the entry of the function. 1012 if (!is_optimizing()) {
1016 threshold = FLAG_reoptimization_counter_threshold;
1017 } else {
1018 __ addiu(T1, T1, Immediate(1)); 1013 __ addiu(T1, T1, Immediate(1));
1019 __ sw(T1, FieldAddress(function_reg, Function::usage_counter_offset())); 1014 __ sw(T1, FieldAddress(function_reg, Function::usage_counter_offset()));
1020 } 1015 }
1021 1016
1022 // Skip Branch if T1 is less than the threshold. 1017 // Skip Branch if T1 is less than the threshold.
1023 Label dont_branch; 1018 Label dont_branch;
1024 __ BranchSignedLess(T1, threshold, &dont_branch); 1019 __ BranchSignedLess(T1, GetOptimizationThreshold(), &dont_branch);
1025 1020
1026 ASSERT(function_reg == T0); 1021 ASSERT(function_reg == T0);
1027 __ Branch(&stub_code->OptimizeFunctionLabel()); 1022 __ Branch(&stub_code->OptimizeFunctionLabel());
1028 1023
1029 __ Bind(&dont_branch); 1024 __ Bind(&dont_branch);
1030 1025
1031 } else if (!flow_graph().IsCompiledForOsr()) { 1026 } else if (!flow_graph().IsCompiledForOsr()) {
1032 entry_patch_pc_offset_ = assembler()->CodeSize(); 1027 entry_patch_pc_offset_ = assembler()->CodeSize();
1033 } 1028 }
1034 __ Comment("Enter frame"); 1029 __ Comment("Enter frame");
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 __ AddImmediate(SP, kDoubleSize); 1805 __ AddImmediate(SP, kDoubleSize);
1811 } 1806 }
1812 1807
1813 1808
1814 #undef __ 1809 #undef __
1815 1810
1816 1811
1817 } // namespace dart 1812 } // namespace dart
1818 1813
1819 #endif // defined TARGET_ARCH_MIPS 1814 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698