| OLD | NEW |
| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 Register temp = locs()->temp(0).reg(); | 47 Register temp = locs()->temp(0).reg(); |
| 48 ASSERT(result == EAX); | 48 ASSERT(result == EAX); |
| 49 if (!compiler->is_optimizing()) { | 49 if (!compiler->is_optimizing()) { |
| 50 // Count only in unoptimized code. | 50 // Count only in unoptimized code. |
| 51 // TODO(srdjan): Replace the counting code with a type feedback | 51 // TODO(srdjan): Replace the counting code with a type feedback |
| 52 // collection and counting stub. | 52 // collection and counting stub. |
| 53 const Function& function = | 53 const Function& function = |
| 54 Function::ZoneHandle(compiler->parsed_function().function().raw()); | 54 Function::ZoneHandle(compiler->parsed_function().function().raw()); |
| 55 __ LoadObject(temp, function); | 55 __ LoadObject(temp, function); |
| 56 __ incl(FieldAddress(temp, Function::usage_counter_offset())); | 56 __ incl(FieldAddress(temp, Function::usage_counter_offset())); |
| 57 if (FlowGraphCompiler::CanOptimize()) { | 57 if (FlowGraphCompiler::CanOptimize() && |
| 58 compiler->parsed_function().function().is_optimizable()) { |
| 58 // Do not optimize if usage count must be reported. | 59 // Do not optimize if usage count must be reported. |
| 59 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), | 60 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), |
| 60 Immediate(FLAG_optimization_counter_threshold)); | 61 Immediate(FLAG_optimization_counter_threshold)); |
| 61 Label not_yet_hot, already_optimized; | 62 Label not_yet_hot, already_optimized; |
| 62 __ j(LESS, ¬_yet_hot, Assembler::kNearJump); | 63 __ j(LESS, ¬_yet_hot, Assembler::kNearJump); |
| 63 __ j(GREATER, &already_optimized, Assembler::kNearJump); | 64 __ j(GREATER, &already_optimized, Assembler::kNearJump); |
| 64 __ pushl(result); // Preserve result. | 65 __ pushl(result); // Preserve result. |
| 65 __ pushl(temp); // Argument for runtime: function to optimize. | 66 __ pushl(temp); // Argument for runtime: function to optimize. |
| 66 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 67 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 67 __ popl(temp); // Remove argument. | 68 __ popl(temp); // Remove argument. |
| (...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 __ j(ABOVE_EQUAL, deopt); | 2224 __ j(ABOVE_EQUAL, deopt); |
| 2224 } | 2225 } |
| 2225 } | 2226 } |
| 2226 | 2227 |
| 2227 | 2228 |
| 2228 } // namespace dart | 2229 } // namespace dart |
| 2229 | 2230 |
| 2230 #undef __ | 2231 #undef __ |
| 2231 | 2232 |
| 2232 #endif // defined TARGET_ARCH_X64 | 2233 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |