| OLD | NEW |
| 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_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/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/cpu.h" | 12 #include "vm/cpu.h" |
| 13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
| 14 #include "vm/deopt_instructions.h" | 14 #include "vm/deopt_instructions.h" |
| 15 #include "vm/flow_graph_builder.h" | 15 #include "vm/flow_graph_builder.h" |
| 16 #include "vm/il_printer.h" | 16 #include "vm/il_printer.h" |
| 17 #include "vm/locations.h" | 17 #include "vm/locations.h" |
| 18 #include "vm/object_store.h" | 18 #include "vm/object_store.h" |
| 19 #include "vm/parser.h" | 19 #include "vm/parser.h" |
| 20 #include "vm/stack_frame.h" | 20 #include "vm/stack_frame.h" |
| 21 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 22 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
| 23 | 23 |
| 24 namespace dart { | 24 namespace dart { |
| 25 | 25 |
| 26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
| 28 DECLARE_FLAG(int, optimization_counter_threshold); | |
| 29 DECLARE_FLAG(int, reoptimization_counter_threshold); | |
| 30 DECLARE_FLAG(bool, enable_type_checks); | 28 DECLARE_FLAG(bool, enable_type_checks); |
| 31 DECLARE_FLAG(bool, enable_simd_inline); | 29 DECLARE_FLAG(bool, enable_simd_inline); |
| 32 | 30 |
| 33 | 31 |
| 34 FlowGraphCompiler::~FlowGraphCompiler() { | 32 FlowGraphCompiler::~FlowGraphCompiler() { |
| 35 // BlockInfos are zone-allocated, so their destructors are not called. | 33 // BlockInfos are zone-allocated, so their destructors are not called. |
| 36 // Verify the labels explicitly here. | 34 // Verify the labels explicitly here. |
| 37 for (int i = 0; i < block_info_.length(); ++i) { | 35 for (int i = 0; i < block_info_.length(); ++i) { |
| 38 ASSERT(!block_info_[i]->jump_label()->IsLinked()); | 36 ASSERT(!block_info_[i]->jump_label()->IsLinked()); |
| 39 ASSERT(!block_info_[i]->jump_label()->HasNear()); | 37 ASSERT(!block_info_[i]->jump_label()->HasNear()); |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 if (CanOptimizeFunction() && | 985 if (CanOptimizeFunction() && |
| 988 function.IsOptimizable() && | 986 function.IsOptimizable() && |
| 989 (!is_optimizing() || may_reoptimize())) { | 987 (!is_optimizing() || may_reoptimize())) { |
| 990 StubCode* stub_code = isolate()->stub_code(); | 988 StubCode* stub_code = isolate()->stub_code(); |
| 991 const Register function_reg = EDI; | 989 const Register function_reg = EDI; |
| 992 __ LoadObject(function_reg, function); | 990 __ LoadObject(function_reg, function); |
| 993 | 991 |
| 994 // Patch point is after the eventually inlined function object. | 992 // Patch point is after the eventually inlined function object. |
| 995 entry_patch_pc_offset_ = assembler()->CodeSize(); | 993 entry_patch_pc_offset_ = assembler()->CodeSize(); |
| 996 | 994 |
| 997 if (is_optimizing()) { | 995 // Reoptimization of an optimized function is triggered by counting in |
| 998 // Reoptimization of an optimized function is triggered by counting in | 996 // IC stubs, but not at the entry of the function. |
| 999 // IC stubs, but not at the entry of the function. | 997 if (!is_optimizing()) { |
| 1000 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()), | |
| 1001 Immediate(FLAG_reoptimization_counter_threshold)); | |
| 1002 } else { | |
| 1003 __ incl(FieldAddress(function_reg, Function::usage_counter_offset())); | 998 __ incl(FieldAddress(function_reg, Function::usage_counter_offset())); |
| 1004 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()), | |
| 1005 Immediate(FLAG_optimization_counter_threshold)); | |
| 1006 } | 999 } |
| 1000 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()), |
| 1001 Immediate(GetOptimizationThreshold())); |
| 1007 ASSERT(function_reg == EDI); | 1002 ASSERT(function_reg == EDI); |
| 1008 __ j(GREATER_EQUAL, &stub_code->OptimizeFunctionLabel()); | 1003 __ j(GREATER_EQUAL, &stub_code->OptimizeFunctionLabel()); |
| 1009 } else if (!flow_graph().IsCompiledForOsr()) { | 1004 } else if (!flow_graph().IsCompiledForOsr()) { |
| 1010 entry_patch_pc_offset_ = assembler()->CodeSize(); | 1005 entry_patch_pc_offset_ = assembler()->CodeSize(); |
| 1011 } | 1006 } |
| 1012 __ Comment("Enter frame"); | 1007 __ Comment("Enter frame"); |
| 1013 if (flow_graph().IsCompiledForOsr()) { | 1008 if (flow_graph().IsCompiledForOsr()) { |
| 1014 intptr_t extra_slots = StackSize() | 1009 intptr_t extra_slots = StackSize() |
| 1015 - flow_graph().num_stack_locals() | 1010 - flow_graph().num_stack_locals() |
| 1016 - flow_graph().num_copied_params(); | 1011 - flow_graph().num_copied_params(); |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 __ movups(reg, Address(ESP, 0)); | 1768 __ movups(reg, Address(ESP, 0)); |
| 1774 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1769 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1775 } | 1770 } |
| 1776 | 1771 |
| 1777 | 1772 |
| 1778 #undef __ | 1773 #undef __ |
| 1779 | 1774 |
| 1780 } // namespace dart | 1775 } // namespace dart |
| 1781 | 1776 |
| 1782 #endif // defined TARGET_ARCH_IA32 | 1777 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |