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" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 ASSERT(block_order()[0]->IsGraphEntry()); | 267 ASSERT(block_order()[0]->IsGraphEntry()); |
268 BlockInfo* block_info = block_info_[block_order()[0]->postorder_number()]; | 268 BlockInfo* block_info = block_info_[block_order()[0]->postorder_number()]; |
269 block_info->set_next_nonempty_label(nonempty_label); | 269 block_info->set_next_nonempty_label(nonempty_label); |
270 } | 270 } |
271 | 271 |
272 | 272 |
273 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { | 273 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { |
274 if (!is_optimizing()) { | 274 if (!is_optimizing()) { |
275 if (FLAG_enable_type_checks && instr->IsAssertAssignable()) { | 275 if (FLAG_enable_type_checks && instr->IsAssertAssignable()) { |
276 AssertAssignableInstr* assert = instr->AsAssertAssignable(); | 276 AssertAssignableInstr* assert = instr->AsAssertAssignable(); |
277 AddCurrentDescriptor(PcDescriptors::kDeopt, | 277 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
278 assert->deopt_id(), | 278 assert->deopt_id(), |
279 assert->token_pos()); | 279 assert->token_pos()); |
280 } else if (instr->CanBecomeDeoptimizationTarget() && !instr->IsGoto()) { | 280 } else if (instr->CanBecomeDeoptimizationTarget() && !instr->IsGoto()) { |
281 // Instructions that can be deoptimization targets need to record kDeopt | 281 // Instructions that can be deoptimization targets need to record kDeopt |
282 // PcDescriptor corresponding to their deopt id. GotoInstr records its | 282 // PcDescriptor corresponding to their deopt id. GotoInstr records its |
283 // own so that it can control the placement. | 283 // own so that it can control the placement. |
284 AddCurrentDescriptor(PcDescriptors::kDeopt, | 284 AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
285 instr->deopt_id(), | 285 instr->deopt_id(), |
286 Scanner::kNoSourcePos); | 286 Scanner::kNoSourcePos); |
287 } | 287 } |
288 AllocateRegistersLocally(instr); | 288 AllocateRegistersLocally(instr); |
289 } else if (instr->MayThrow() && | 289 } else if (instr->MayThrow() && |
290 (CurrentTryIndex() != CatchClauseNode::kInvalidTryIndex)) { | 290 (CurrentTryIndex() != CatchClauseNode::kInvalidTryIndex)) { |
291 // Optimized try-block: Sync locals to fixed stack locations. | 291 // Optimized try-block: Sync locals to fixed stack locations. |
292 EmitTrySync(instr, CurrentTryIndex()); | 292 EmitTrySync(instr, CurrentTryIndex()); |
293 } | 293 } |
294 } | 294 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 needs_stacktrace); | 480 needs_stacktrace); |
481 } | 481 } |
482 | 482 |
483 | 483 |
484 void FlowGraphCompiler::SetNeedsStacktrace(intptr_t try_index) { | 484 void FlowGraphCompiler::SetNeedsStacktrace(intptr_t try_index) { |
485 exception_handlers_list_->SetNeedsStacktrace(try_index); | 485 exception_handlers_list_->SetNeedsStacktrace(try_index); |
486 } | 486 } |
487 | 487 |
488 | 488 |
489 // Uses current pc position and try-index. | 489 // Uses current pc position and try-index. |
490 void FlowGraphCompiler::AddCurrentDescriptor(PcDescriptors::Kind kind, | 490 void FlowGraphCompiler::AddCurrentDescriptor(RawPcDescriptors::Kind kind, |
491 intptr_t deopt_id, | 491 intptr_t deopt_id, |
492 intptr_t token_pos) { | 492 intptr_t token_pos) { |
493 pc_descriptors_list()->AddDescriptor(kind, | 493 pc_descriptors_list()->AddDescriptor(kind, |
494 assembler()->CodeSize(), | 494 assembler()->CodeSize(), |
495 deopt_id, | 495 deopt_id, |
496 token_pos, | 496 token_pos, |
497 CurrentTryIndex()); | 497 CurrentTryIndex()); |
498 } | 498 } |
499 | 499 |
500 | 500 |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 } | 1389 } |
1390 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( | 1390 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( |
1391 parsed_function().function(), String::Handle(isolate(), target.name()), | 1391 parsed_function().function(), String::Handle(isolate(), target.name()), |
1392 arguments_descriptor, deopt_id, num_args_tested)); | 1392 arguments_descriptor, deopt_id, num_args_tested)); |
1393 ic_data.AddTarget(target); | 1393 ic_data.AddTarget(target); |
1394 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; | 1394 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; |
1395 return &ic_data; | 1395 return &ic_data; |
1396 } | 1396 } |
1397 | 1397 |
1398 } // namespace dart | 1398 } // namespace dart |
OLD | NEW |