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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.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_mips.cc ('k') | 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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 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 ASSERT(!block_info_[i]->jump_label()->HasNear()); 34 ASSERT(!block_info_[i]->jump_label()->HasNear());
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 997
1000 // Load callee's pool pointer. 998 // Load callee's pool pointer.
1001 __ movq(new_pp, Address(new_pc, -object_pool_pc_dist - offset)); 999 __ movq(new_pp, Address(new_pc, -object_pool_pc_dist - offset));
1002 1000
1003 // Load function object using the callee's pool pointer. 1001 // Load function object using the callee's pool pointer.
1004 __ LoadObject(function_reg, function, new_pp); 1002 __ LoadObject(function_reg, function, new_pp);
1005 1003
1006 // Patch point is after the eventually inlined function object. 1004 // Patch point is after the eventually inlined function object.
1007 entry_patch_pc_offset_ = assembler()->CodeSize(); 1005 entry_patch_pc_offset_ = assembler()->CodeSize();
1008 1006
1009 if (is_optimizing()) { 1007 // Reoptimization of an optimized function is triggered by counting in
1010 // Reoptimization of an optimized function is triggered by counting in 1008 // IC stubs, but not at the entry of the function.
1011 // IC stubs, but not at the entry of the function. 1009 if (!is_optimizing()) {
1012 __ cmpl(
1013 FieldAddress(function_reg, Function::usage_counter_offset()),
1014 Immediate(FLAG_reoptimization_counter_threshold));
1015 } else {
1016 __ incl(FieldAddress(function_reg, Function::usage_counter_offset())); 1010 __ incl(FieldAddress(function_reg, Function::usage_counter_offset()));
1017 __ cmpl(
1018 FieldAddress(function_reg, Function::usage_counter_offset()),
1019 Immediate(FLAG_optimization_counter_threshold));
1020 } 1011 }
1012 __ cmpl(
1013 FieldAddress(function_reg, Function::usage_counter_offset()),
1014 Immediate(GetOptimizationThreshold()));
1021 ASSERT(function_reg == RDI); 1015 ASSERT(function_reg == RDI);
1022 __ J(GREATER_EQUAL, &stub_code->OptimizeFunctionLabel(), R13); 1016 __ J(GREATER_EQUAL, &stub_code->OptimizeFunctionLabel(), R13);
1023 } else if (!flow_graph().IsCompiledForOsr()) { 1017 } else if (!flow_graph().IsCompiledForOsr()) {
1024 // We have to load the PP here too because a load of an external label 1018 // We have to load the PP here too because a load of an external label
1025 // may be patched at the AddCurrentDescriptor below. 1019 // may be patched at the AddCurrentDescriptor below.
1026 new_pp = R13; 1020 new_pp = R13;
1027 new_pc = R12; 1021 new_pc = R12;
1028 1022
1029 Label next; 1023 Label next;
1030 __ nop(4); // Need a fixed size sequence on frame entry. 1024 __ nop(4); // Need a fixed size sequence on frame entry.
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 __ movups(reg, Address(RSP, 0)); 1722 __ movups(reg, Address(RSP, 0));
1729 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1723 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1730 } 1724 }
1731 1725
1732 1726
1733 #undef __ 1727 #undef __
1734 1728
1735 } // namespace dart 1729 } // namespace dart
1736 1730
1737 #endif // defined TARGET_ARCH_X64 1731 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698