| 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_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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 Register temp = locs()->temp(0).reg(); | 57 Register temp = locs()->temp(0).reg(); |
| 58 ASSERT(result == RAX); | 58 ASSERT(result == RAX); |
| 59 if (!compiler->is_optimizing()) { | 59 if (!compiler->is_optimizing()) { |
| 60 // Count only in unoptimized code. | 60 // Count only in unoptimized code. |
| 61 // TODO(srdjan): Replace the counting code with a type feedback | 61 // TODO(srdjan): Replace the counting code with a type feedback |
| 62 // collection and counting stub. | 62 // collection and counting stub. |
| 63 const Function& function = | 63 const Function& function = |
| 64 Function::ZoneHandle(compiler->parsed_function().function().raw()); | 64 Function::ZoneHandle(compiler->parsed_function().function().raw()); |
| 65 __ LoadObject(temp, function); | 65 __ LoadObject(temp, function); |
| 66 __ incq(FieldAddress(temp, Function::usage_counter_offset())); | 66 __ incq(FieldAddress(temp, Function::usage_counter_offset())); |
| 67 if (CodeGenerator::CanOptimize()) { | 67 if (FlowGraphCompiler::CanOptimize()) { |
| 68 // Do not optimize if usage count must be reported. | 68 // Do not optimize if usage count must be reported. |
| 69 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), | 69 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), |
| 70 Immediate(FLAG_optimization_counter_threshold)); | 70 Immediate(FLAG_optimization_counter_threshold)); |
| 71 Label not_yet_hot; | 71 Label not_yet_hot; |
| 72 __ j(LESS_EQUAL, ¬_yet_hot, Assembler::kNearJump); | 72 __ j(LESS_EQUAL, ¬_yet_hot, Assembler::kNearJump); |
| 73 __ pushq(result); // Preserve result. | 73 __ pushq(result); // Preserve result. |
| 74 __ pushq(temp); // Argument for runtime: function to optimize. | 74 __ pushq(temp); // Argument for runtime: function to optimize. |
| 75 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 75 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 76 __ popq(temp); // Remove argument. | 76 __ popq(temp); // Remove argument. |
| 77 __ popq(result); // Restore result. | 77 __ popq(result); // Restore result. |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 instance_call()->argument_names()); | 1979 instance_call()->argument_names()); |
| 1980 } | 1980 } |
| 1981 __ Bind(&done); | 1981 __ Bind(&done); |
| 1982 } | 1982 } |
| 1983 | 1983 |
| 1984 } // namespace dart | 1984 } // namespace dart |
| 1985 | 1985 |
| 1986 #undef __ | 1986 #undef __ |
| 1987 | 1987 |
| 1988 #endif // defined TARGET_ARCH_X64 | 1988 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |