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

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: 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_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; 1009 const intptr_t threshold = GetOptimizationThreshold();
1012 __ lw(T1, FieldAddress(function_reg, Function::usage_counter_offset())); 1010 __ lw(T1, FieldAddress(function_reg, Function::usage_counter_offset()));
1013 if (is_optimizing()) { 1011 if (is_optimizing()) {
Vyacheslav Egorov (Google) 2014/08/29 11:17:18 ditto like on arm.
Anders Johnsen 2014/08/29 11:56:28 Done.
1014 // Reoptimization of an optimized function is triggered by counting in 1012 // Reoptimization of an optimized function is triggered by counting in
1015 // IC stubs, but not at the entry of the function. 1013 // IC stubs, but not at the entry of the function.
1016 threshold = FLAG_reoptimization_counter_threshold;
1017 } else { 1014 } else {
1018 __ addiu(T1, T1, Immediate(1)); 1015 __ addiu(T1, T1, Immediate(1));
1019 __ sw(T1, FieldAddress(function_reg, Function::usage_counter_offset())); 1016 __ sw(T1, FieldAddress(function_reg, Function::usage_counter_offset()));
1020 } 1017 }
1021 1018
1022 // Skip Branch if T1 is less than the threshold. 1019 // Skip Branch if T1 is less than the threshold.
1023 Label dont_branch; 1020 Label dont_branch;
1024 __ BranchSignedLess(T1, threshold, &dont_branch); 1021 __ BranchSignedLess(T1, threshold, &dont_branch);
1025 1022
1026 ASSERT(function_reg == T0); 1023 ASSERT(function_reg == T0);
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 __ AddImmediate(SP, kDoubleSize); 1807 __ AddImmediate(SP, kDoubleSize);
1811 } 1808 }
1812 1809
1813 1810
1814 #undef __ 1811 #undef __
1815 1812
1816 1813
1817 } // namespace dart 1814 } // namespace dart
1818 1815
1819 #endif // defined TARGET_ARCH_MIPS 1816 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698