| 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_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/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/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 13 #include "vm/deopt_instructions.h" | 13 #include "vm/deopt_instructions.h" |
| 14 #include "vm/il_printer.h" | 14 #include "vm/il_printer.h" |
| 15 #include "vm/locations.h" | 15 #include "vm/locations.h" |
| 16 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
| 17 #include "vm/parser.h" | 17 #include "vm/parser.h" |
| 18 #include "vm/stack_frame.h" | 18 #include "vm/stack_frame.h" |
| 19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
| 20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
| 21 | 21 |
| 22 namespace dart { | 22 namespace dart { |
| 23 | 23 |
| 24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 25 DECLARE_FLAG(int, optimization_counter_threshold); | 25 DECLARE_FLAG(int, optimization_counter_threshold); |
| 26 DECLARE_FLAG(int, reoptimization_counter_threshold); | 26 DECLARE_FLAG(int, reoptimization_counter_threshold); |
| 27 DECLARE_FLAG(bool, print_ast); | |
| 28 DECLARE_FLAG(bool, print_scopes); | |
| 29 DECLARE_FLAG(bool, enable_type_checks); | 27 DECLARE_FLAG(bool, enable_type_checks); |
| 30 DECLARE_FLAG(bool, eliminate_type_checks); | 28 DECLARE_FLAG(bool, eliminate_type_checks); |
| 31 | 29 |
| 32 | 30 |
| 33 FlowGraphCompiler::~FlowGraphCompiler() { | 31 FlowGraphCompiler::~FlowGraphCompiler() { |
| 34 // BlockInfos are zone-allocated, so their destructors are not called. | 32 // BlockInfos are zone-allocated, so their destructors are not called. |
| 35 // Verify the labels explicitly here. | 33 // Verify the labels explicitly here. |
| 36 for (int i = 0; i < block_info_.length(); ++i) { | 34 for (int i = 0; i < block_info_.length(); ++i) { |
| 37 ASSERT(!block_info_[i]->jump_label()->IsLinked()); | 35 ASSERT(!block_info_[i]->jump_label()->IsLinked()); |
| 38 ASSERT(!block_info_[i]->jump_label()->HasNear()); | 36 ASSERT(!block_info_[i]->jump_label()->HasNear()); |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 if (!is_optimizing() && (num_locals > 0)) { | 1192 if (!is_optimizing() && (num_locals > 0)) { |
| 1195 __ Comment("Initialize spill slots"); | 1193 __ Comment("Initialize spill slots"); |
| 1196 const intptr_t slot_base = parsed_function().first_stack_local_index(); | 1194 const intptr_t slot_base = parsed_function().first_stack_local_index(); |
| 1197 __ LoadObject(RAX, Object::null_object(), PP); | 1195 __ LoadObject(RAX, Object::null_object(), PP); |
| 1198 for (intptr_t i = 0; i < num_locals; ++i) { | 1196 for (intptr_t i = 0; i < num_locals; ++i) { |
| 1199 // Subtract index i (locals lie at lower addresses than RBP). | 1197 // Subtract index i (locals lie at lower addresses than RBP). |
| 1200 __ movq(Address(RBP, (slot_base - i) * kWordSize), RAX); | 1198 __ movq(Address(RBP, (slot_base - i) * kWordSize), RAX); |
| 1201 } | 1199 } |
| 1202 } | 1200 } |
| 1203 | 1201 |
| 1204 if (FLAG_print_scopes) { | |
| 1205 // Print the function scope (again) after generating the prologue in order | |
| 1206 // to see annotations such as allocation indices of locals. | |
| 1207 if (FLAG_print_ast) { | |
| 1208 // Second printing. | |
| 1209 OS::Print("Annotated "); | |
| 1210 } | |
| 1211 AstPrinter::PrintFunctionScope(parsed_function()); | |
| 1212 } | |
| 1213 | |
| 1214 ASSERT(!block_order().is_empty()); | 1202 ASSERT(!block_order().is_empty()); |
| 1215 VisitBlocks(); | 1203 VisitBlocks(); |
| 1216 | 1204 |
| 1217 __ int3(); | 1205 __ int3(); |
| 1218 GenerateDeferredCode(); | 1206 GenerateDeferredCode(); |
| 1219 // Emit function patching code. This will be swapped with the first 13 bytes | 1207 // Emit function patching code. This will be swapped with the first 13 bytes |
| 1220 // at entry point. | 1208 // at entry point. |
| 1221 AddCurrentDescriptor(PcDescriptors::kPatchCode, | 1209 AddCurrentDescriptor(PcDescriptors::kPatchCode, |
| 1222 Isolate::kNoDeoptId, | 1210 Isolate::kNoDeoptId, |
| 1223 0); // No token position. | 1211 0); // No token position. |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1938 __ movups(reg, Address(RSP, 0)); | 1926 __ movups(reg, Address(RSP, 0)); |
| 1939 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1927 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1940 } | 1928 } |
| 1941 | 1929 |
| 1942 | 1930 |
| 1943 #undef __ | 1931 #undef __ |
| 1944 | 1932 |
| 1945 } // namespace dart | 1933 } // namespace dart |
| 1946 | 1934 |
| 1947 #endif // defined TARGET_ARCH_X64 | 1935 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |