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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 } | 36 } |
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 __ TraceSimMsg("Initialize spill slots"); | 1194 __ TraceSimMsg("Initialize spill slots"); |
1197 __ Comment("Initialize spill slots"); | 1195 __ Comment("Initialize spill slots"); |
1198 const intptr_t slot_base = parsed_function().first_stack_local_index(); | 1196 const intptr_t slot_base = parsed_function().first_stack_local_index(); |
1199 for (intptr_t i = 0; i < num_locals; ++i) { | 1197 for (intptr_t i = 0; i < num_locals; ++i) { |
1200 // Subtract index i (locals lie at lower addresses than FP). | 1198 // Subtract index i (locals lie at lower addresses than FP). |
1201 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null())); | 1199 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null())); |
1202 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize)); | 1200 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize)); |
1203 } | 1201 } |
1204 } | 1202 } |
1205 | 1203 |
1206 if (FLAG_print_scopes) { | |
1207 // Print the function scope (again) after generating the prologue in order | |
1208 // to see annotations such as allocation indices of locals. | |
1209 if (FLAG_print_ast) { | |
1210 // Second printing. | |
1211 OS::Print("Annotated "); | |
1212 } | |
1213 AstPrinter::PrintFunctionScope(parsed_function()); | |
1214 } | |
1215 | |
1216 VisitBlocks(); | 1204 VisitBlocks(); |
1217 | 1205 |
1218 __ break_(0); | 1206 __ break_(0); |
1219 GenerateDeferredCode(); | 1207 GenerateDeferredCode(); |
1220 // Emit function patching code. This will be swapped with the first 5 bytes | 1208 // Emit function patching code. This will be swapped with the first 5 bytes |
1221 // at entry point. | 1209 // at entry point. |
1222 AddCurrentDescriptor(PcDescriptors::kPatchCode, | 1210 AddCurrentDescriptor(PcDescriptors::kPatchCode, |
1223 Isolate::kNoDeoptId, | 1211 Isolate::kNoDeoptId, |
1224 0); // No token position. | 1212 0); // No token position. |
1225 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); | 1213 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 __ AddImmediate(SP, kDoubleSize); | 1996 __ AddImmediate(SP, kDoubleSize); |
2009 } | 1997 } |
2010 | 1998 |
2011 | 1999 |
2012 #undef __ | 2000 #undef __ |
2013 | 2001 |
2014 | 2002 |
2015 } // namespace dart | 2003 } // namespace dart |
2016 | 2004 |
2017 #endif // defined TARGET_ARCH_MIPS | 2005 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |