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

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

Issue 11031016: Do not trigger optimization on functions that are not optimizable (e.g. natives). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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/intermediate_language_ia32.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) 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"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ASSERT(result == RAX); 48 ASSERT(result == RAX);
49 if (!compiler->is_optimizing()) { 49 if (!compiler->is_optimizing()) {
50 __ Comment("Check function counter"); 50 __ Comment("Check function counter");
51 // Count only in unoptimized code. 51 // Count only in unoptimized code.
52 // TODO(srdjan): Replace the counting code with a type feedback 52 // TODO(srdjan): Replace the counting code with a type feedback
53 // collection and counting stub. 53 // collection and counting stub.
54 const Function& function = 54 const Function& function =
55 Function::ZoneHandle(compiler->parsed_function().function().raw()); 55 Function::ZoneHandle(compiler->parsed_function().function().raw());
56 __ LoadObject(temp, function); 56 __ LoadObject(temp, function);
57 __ incq(FieldAddress(temp, Function::usage_counter_offset())); 57 __ incq(FieldAddress(temp, Function::usage_counter_offset()));
58 if (FlowGraphCompiler::CanOptimize()) { 58 if (FlowGraphCompiler::CanOptimize() &&
59 compiler->parsed_function().function().is_optimizable()) {
59 // Do not optimize if usage count must be reported. 60 // Do not optimize if usage count must be reported.
60 __ cmpq(FieldAddress(temp, Function::usage_counter_offset()), 61 __ cmpq(FieldAddress(temp, Function::usage_counter_offset()),
61 Immediate(FLAG_optimization_counter_threshold)); 62 Immediate(FLAG_optimization_counter_threshold));
62 Label not_yet_hot, already_optimized; 63 Label not_yet_hot, already_optimized;
63 __ j(LESS, &not_yet_hot, Assembler::kNearJump); 64 __ j(LESS, &not_yet_hot, Assembler::kNearJump);
64 __ j(GREATER, &already_optimized, Assembler::kNearJump); 65 __ j(GREATER, &already_optimized, Assembler::kNearJump);
65 __ pushq(result); // Preserve result. 66 __ pushq(result); // Preserve result.
66 __ pushq(temp); // Argument for runtime: function to optimize. 67 __ pushq(temp); // Argument for runtime: function to optimize.
67 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); 68 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
68 __ popq(temp); // Remove argument. 69 __ popq(temp); // Remove argument.
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 __ j(ABOVE_EQUAL, deopt); 2249 __ j(ABOVE_EQUAL, deopt);
2249 } 2250 }
2250 } 2251 }
2251 2252
2252 2253
2253 } // namespace dart 2254 } // namespace dart
2254 2255
2255 #undef __ 2256 #undef __
2256 2257
2257 #endif // defined TARGET_ARCH_X64 2258 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698