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_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
6 | 6 |
7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
8 | 8 |
9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
11 #include "vm/debugger.h" | 11 #include "vm/debugger.h" |
12 #include "vm/deopt_instructions.h" | 12 #include "vm/deopt_instructions.h" |
13 #include "vm/flow_graph_allocator.h" | 13 #include "vm/flow_graph_allocator.h" |
14 #include "vm/il_printer.h" | 14 #include "vm/il_printer.h" |
15 #include "vm/intrinsifier.h" | 15 #include "vm/intrinsifier.h" |
16 #include "vm/locations.h" | 16 #include "vm/locations.h" |
17 #include "vm/longjump.h" | 17 #include "vm/longjump.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/stub_code.h" | 21 #include "vm/stub_code.h" |
21 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
22 | 23 |
23 namespace dart { | 24 namespace dart { |
24 | 25 |
25 DECLARE_FLAG(bool, code_comments); | 26 DECLARE_FLAG(bool, code_comments); |
26 DECLARE_FLAG(bool, enable_type_checks); | 27 DECLARE_FLAG(bool, enable_type_checks); |
27 DECLARE_FLAG(bool, intrinsify); | 28 DECLARE_FLAG(bool, intrinsify); |
28 DECLARE_FLAG(bool, propagate_ic_data); | 29 DECLARE_FLAG(bool, propagate_ic_data); |
29 DECLARE_FLAG(bool, report_usage_count); | 30 DECLARE_FLAG(bool, report_usage_count); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 function.token_pos(), | 291 function.token_pos(), |
291 LanguageError::kError, | 292 LanguageError::kError, |
292 Heap::kNew, | 293 Heap::kNew, |
293 "FlowGraphCompiler Bailout: %s %s", | 294 "FlowGraphCompiler Bailout: %s %s", |
294 String::Handle(function.name()).ToCString(), | 295 String::Handle(function.name()).ToCString(), |
295 reason)); | 296 reason)); |
296 Isolate::Current()->long_jump_base()->Jump(1, error); | 297 Isolate::Current()->long_jump_base()->Jump(1, error); |
297 } | 298 } |
298 | 299 |
299 | 300 |
301 void FlowGraphCompiler::EmitTrySync(Instruction* instr, intptr_t try_index) { | |
302 ASSERT(is_optimizing()); | |
303 Environment* env = instr->env(); | |
304 CatchBlockEntryInstr* catch_block = | |
305 flow_graph().graph_entry()->GetCatchEntry(try_index); | |
306 const GrowableArray<Definition*>* idefs = catch_block->initial_definitions(); | |
307 | |
308 // Construct a ParallelMove instruction for parameters and locals. Skip the | |
309 // special locals exception_var and stacktrace_var since they will be filled | |
310 // when an exception is thrown. Constant locations are known to be the same | |
311 // at all instructions that may throw, and do not need to be materialized. | |
312 | |
313 // Parameters first. | |
314 intptr_t i = 0; | |
315 const intptr_t num_non_copied_params = flow_graph().num_non_copied_params(); | |
316 ParallelMoveInstr* move_instr = new ParallelMoveInstr(); | |
317 for (; i < num_non_copied_params; ++i) { | |
318 if ((*idefs)[i]->IsConstant()) continue; // Common constants | |
319 Location src = env->LocationAt(i); | |
320 intptr_t dest_index = i - num_non_copied_params; | |
321 Location dest = Location::StackSlot(dest_index); | |
322 move_instr->AddMove(dest, src); | |
323 } | |
324 | |
325 // Process locals. Skip exception_var and stacktrace_var. | |
326 intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params; | |
327 intptr_t ex_idx = local_base - catch_block->exception_var().index(); | |
328 intptr_t st_idx = local_base - catch_block->stacktrace_var().index(); | |
329 for (; i < flow_graph().variable_count(); ++i) { | |
330 if (i == ex_idx || i == st_idx) continue; | |
331 if ((*idefs)[i]->IsConstant()) continue; | |
332 Location src = env->LocationAt(i); | |
333 ASSERT(!src.IsFpuRegister()); | |
334 ASSERT(!src.IsDoubleStackSlot()); | |
Florian Schneider
2014/01/06 15:12:50
I added these two asserts that were violated befor
| |
335 intptr_t dest_index = i - num_non_copied_params; | |
336 Location dest = Location::StackSlot(dest_index); | |
337 move_instr->AddMove(dest, src); | |
338 // Update safepoint bitmap to indicate that the target location | |
339 // now contains a pointer. | |
340 instr->locs()->stack_bitmap()->Set(dest_index, true); | |
341 } | |
342 parallel_move_resolver()->EmitNativeCode(move_instr); | |
343 } | |
344 | |
345 | |
300 intptr_t FlowGraphCompiler::StackSize() const { | 346 intptr_t FlowGraphCompiler::StackSize() const { |
301 if (is_optimizing_) { | 347 if (is_optimizing_) { |
302 return flow_graph_.graph_entry()->spill_slot_count(); | 348 return flow_graph_.graph_entry()->spill_slot_count(); |
303 } else { | 349 } else { |
304 return parsed_function_.num_stack_locals() + | 350 return parsed_function_.num_stack_locals() + |
305 parsed_function_.num_copied_params(); | 351 parsed_function_.num_copied_params(); |
306 } | 352 } |
307 } | 353 } |
308 | 354 |
309 | 355 |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 | 1271 |
1226 for (int i = 0; i < len; i++) { | 1272 for (int i = 0; i < len; i++) { |
1227 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1273 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
1228 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1274 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
1229 ic_data.GetCountAt(i))); | 1275 ic_data.GetCountAt(i))); |
1230 } | 1276 } |
1231 sorted->Sort(HighestCountFirst); | 1277 sorted->Sort(HighestCountFirst); |
1232 } | 1278 } |
1233 | 1279 |
1234 } // namespace dart | 1280 } // namespace dart |
OLD | NEW |