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

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 11364184: Remove unused/not working function tracing flag and functionality. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
11 #include "vm/flow_graph_compiler.h" 11 #include "vm/flow_graph_compiler.h"
12 #include "vm/locations.h" 12 #include "vm/locations.h"
13 #include "vm/object_store.h" 13 #include "vm/object_store.h"
14 #include "vm/parser.h" 14 #include "vm/parser.h"
15 #include "vm/stub_code.h" 15 #include "vm/stub_code.h"
16 #include "vm/symbols.h" 16 #include "vm/symbols.h"
17 17
18 #define __ compiler->assembler()-> 18 #define __ compiler->assembler()->
19 19
20 namespace dart { 20 namespace dart {
21 21
22 DECLARE_FLAG(int, optimization_counter_threshold); 22 DECLARE_FLAG(int, optimization_counter_threshold);
23 DECLARE_FLAG(bool, trace_functions);
24 DECLARE_FLAG(bool, propagate_ic_data); 23 DECLARE_FLAG(bool, propagate_ic_data);
25 24
26 // Generic summary for call instructions that have all arguments pushed 25 // Generic summary for call instructions that have all arguments pushed
27 // on the stack and return the result in a fixed register RAX. 26 // on the stack and return the result in a fixed register RAX.
28 LocationSummary* Instruction::MakeCallSummary() { 27 LocationSummary* Instruction::MakeCallSummary() {
29 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); 28 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall);
30 result->set_out(Location::RegisterLocation(RAX)); 29 result->set_out(Location::RegisterLocation(RAX));
31 return result; 30 return result;
32 } 31 }
33 32
34 33
35 LocationSummary* ReturnInstr::MakeLocationSummary() const { 34 LocationSummary* ReturnInstr::MakeLocationSummary() const {
36 const intptr_t kNumInputs = 1; 35 const intptr_t kNumInputs = 1;
37 const intptr_t kNumTemps = 1; 36 const intptr_t kNumTemps = 1;
38 LocationSummary* locs = 37 LocationSummary* locs =
39 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 38 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
40 locs->set_in(0, Location::RegisterLocation(RAX)); 39 locs->set_in(0, Location::RegisterLocation(RAX));
41 locs->set_temp(0, Location::RequiresRegister()); 40 locs->set_temp(0, Location::RegisterLocation(RDX));
42 return locs; 41 return locs;
43 } 42 }
44 43
45 44
46 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 45 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
47 Register result = locs()->in(0).reg(); 46 Register result = locs()->in(0).reg();
48 Register temp = locs()->temp(0).reg(); 47 Register func_reg = locs()->temp(0).reg();
49 ASSERT(result == RAX); 48 ASSERT(result == RAX);
50 if (!compiler->is_optimizing()) { 49 if (!compiler->is_optimizing()) {
51 __ Comment("Check function counter"); 50 __ Comment("Check function counter");
52 // Count only in unoptimized code. 51 // Count only in unoptimized code.
53 // TODO(srdjan): Replace the counting code with a type feedback 52 // TODO(srdjan): Replace the counting code with a type feedback
54 // collection and counting stub. 53 // collection and counting stub.
55 const Function& function = 54 const Function& function =
56 Function::ZoneHandle(compiler->parsed_function().function().raw()); 55 Function::ZoneHandle(compiler->parsed_function().function().raw());
57 __ LoadObject(temp, function); 56 __ LoadObject(func_reg, function);
58 __ incq(FieldAddress(temp, Function::usage_counter_offset())); 57 __ incq(FieldAddress(func_reg, Function::usage_counter_offset()));
59 if (FlowGraphCompiler::CanOptimize() && 58 if (FlowGraphCompiler::CanOptimize() &&
60 compiler->parsed_function().function().is_optimizable()) { 59 compiler->parsed_function().function().is_optimizable()) {
61 // Do not optimize if usage count must be reported. 60 // Do not optimize if usage count must be reported.
62 __ cmpq(FieldAddress(temp, Function::usage_counter_offset()), 61 __ cmpq(FieldAddress(func_reg, Function::usage_counter_offset()),
63 Immediate(FLAG_optimization_counter_threshold)); 62 Immediate(FLAG_optimization_counter_threshold));
64 Label not_yet_hot; 63 Label not_yet_hot;
65 __ j(LESS, &not_yet_hot, Assembler::kNearJump); 64 __ j(LESS, &not_yet_hot, Assembler::kNearJump);
66 __ pushq(result); // Preserve result. 65 // Equal (or greater), optimize.
67 __ pushq(temp); // Argument for runtime: function to optimize. 66 // The stub call preserves result register(RAX)
68 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); 67 ASSERT(func_reg == RDX);
69 __ popq(temp); // Remove argument. 68 compiler->GenerateCall(0, // no token position.
70 __ popq(result); // Restore result. 69 &StubCode::OptimizeFunctionLabel(),
70 PcDescriptors::kOther,
71 locs());
71 __ Bind(&not_yet_hot); 72 __ Bind(&not_yet_hot);
72 } 73 }
73 } 74 }
74 if (FLAG_trace_functions) {
75 const Function& function =
76 Function::ZoneHandle(compiler->parsed_function().function().raw());
77 __ LoadObject(temp, function);
78 __ pushq(result); // Preserve result.
79 __ pushq(temp);
80 compiler->GenerateCallRuntime(0,
81 kTraceFunctionExitRuntimeEntry,
82 NULL);
83 __ popq(temp); // Remove argument.
84 __ popq(result); // Restore result.
85 }
86 #if defined(DEBUG) 75 #if defined(DEBUG)
87 // TODO(srdjan): Fix for functions with finally clause. 76 // TODO(srdjan): Fix for functions with finally clause.
88 // A finally clause may leave a previously pushed return value if it 77 // A finally clause may leave a previously pushed return value if it
89 // has its own return instruction. Method that have finally are currently 78 // has its own return instruction. Method that have finally are currently
90 // not optimized. 79 // not optimized.
91 if (!compiler->HasFinally()) { 80 if (!compiler->HasFinally()) {
92 Label done; 81 Label done;
93 __ movq(RDI, RBP); 82 __ movq(RDI, RBP);
94 __ subq(RDI, RSP); 83 __ subq(RDI, RSP);
95 // + 1 for Pc marker. 84 // + 1 for Pc marker.
(...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 2346
2358 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2347 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2359 UNIMPLEMENTED(); 2348 UNIMPLEMENTED();
2360 } 2349 }
2361 2350
2362 } // namespace dart 2351 } // namespace dart
2363 2352
2364 #undef __ 2353 #undef __
2365 2354
2366 #endif // defined TARGET_ARCH_X64 2355 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698