Chromium Code Reviews| 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/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 exception_handlers_list_(NULL), | 91 exception_handlers_list_(NULL), |
| 92 pc_descriptors_list_(NULL), | 92 pc_descriptors_list_(NULL), |
| 93 stackmap_table_builder_( | 93 stackmap_table_builder_( |
| 94 is_optimizing ? new StackmapTableBuilder() : NULL), | 94 is_optimizing ? new StackmapTableBuilder() : NULL), |
| 95 block_info_(block_order_.length()), | 95 block_info_(block_order_.length()), |
| 96 deopt_infos_(), | 96 deopt_infos_(), |
| 97 static_calls_target_table_(GrowableObjectArray::ZoneHandle( | 97 static_calls_target_table_(GrowableObjectArray::ZoneHandle( |
| 98 GrowableObjectArray::New())), | 98 GrowableObjectArray::New())), |
| 99 is_optimizing_(is_optimizing), | 99 is_optimizing_(is_optimizing), |
| 100 may_reoptimize_(false), | 100 may_reoptimize_(false), |
| 101 intrinsic_mode_(false), | |
| 101 double_class_(Class::ZoneHandle( | 102 double_class_(Class::ZoneHandle( |
| 102 isolate_->object_store()->double_class())), | 103 isolate_->object_store()->double_class())), |
| 103 mint_class_(Class::ZoneHandle( | 104 mint_class_(Class::ZoneHandle( |
| 104 isolate_->object_store()->mint_class())), | 105 isolate_->object_store()->mint_class())), |
| 105 float32x4_class_(Class::ZoneHandle( | 106 float32x4_class_(Class::ZoneHandle( |
| 106 isolate_->object_store()->float32x4_class())), | 107 isolate_->object_store()->float32x4_class())), |
| 107 float64x2_class_(Class::ZoneHandle( | 108 float64x2_class_(Class::ZoneHandle( |
| 108 isolate_->object_store()->float64x2_class())), | 109 isolate_->object_store()->float64x2_class())), |
| 109 int32x4_class_(Class::ZoneHandle( | 110 int32x4_class_(Class::ZoneHandle( |
| 110 isolate_->object_store()->int32x4_class())), | 111 isolate_->object_store()->int32x4_class())), |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 ASSERT(Code::kSCallTableFunctionEntry == 1); | 541 ASSERT(Code::kSCallTableFunctionEntry == 1); |
| 541 static_calls_target_table_.Add(func); | 542 static_calls_target_table_.Add(func); |
| 542 ASSERT(Code::kSCallTableCodeEntry == 2); | 543 ASSERT(Code::kSCallTableCodeEntry == 2); |
| 543 static_calls_target_table_.Add(Code::Handle()); | 544 static_calls_target_table_.Add(Code::Handle()); |
| 544 } | 545 } |
| 545 | 546 |
| 546 | 547 |
| 547 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, | 548 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, |
| 548 intptr_t token_pos) { | 549 intptr_t token_pos) { |
| 549 ASSERT(is_optimizing()); | 550 ASSERT(is_optimizing()); |
| 551 ASSERT(!intrinsic_mode()); | |
| 550 CompilerDeoptInfo* info = | 552 CompilerDeoptInfo* info = |
| 551 new CompilerDeoptInfo(deopt_id, | 553 new CompilerDeoptInfo(deopt_id, |
| 552 ICData::kDeoptAtCall, | 554 ICData::kDeoptAtCall, |
| 553 pending_deoptimization_env_); | 555 pending_deoptimization_env_); |
| 554 info->set_pc_offset(assembler()->CodeSize()); | 556 info->set_pc_offset(assembler()->CodeSize()); |
| 555 deopt_infos_.Add(info); | 557 deopt_infos_.Add(info); |
| 556 } | 558 } |
| 557 | 559 |
| 558 | 560 |
| 559 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters | 561 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 cpu_reg_slots); | 722 cpu_reg_slots); |
| 721 } | 723 } |
| 722 } | 724 } |
| 723 } | 725 } |
| 724 return env; | 726 return env; |
| 725 } | 727 } |
| 726 | 728 |
| 727 | 729 |
| 728 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, | 730 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
| 729 ICData::DeoptReasonId reason) { | 731 ICData::DeoptReasonId reason) { |
| 732 if (intrinsic_mode()) return &intrinsic_deopt_label_; | |
|
zra
2014/09/05 20:26:50
Please use curly braces.
Florian Schneider
2014/09/08 11:12:39
Done.
| |
| 733 | |
| 730 ASSERT(is_optimizing_); | 734 ASSERT(is_optimizing_); |
| 731 CompilerDeoptInfoWithStub* stub = | 735 CompilerDeoptInfoWithStub* stub = |
| 732 new CompilerDeoptInfoWithStub(deopt_id, | 736 new CompilerDeoptInfoWithStub(deopt_id, |
| 733 reason, | 737 reason, |
| 734 pending_deoptimization_env_); | 738 pending_deoptimization_env_); |
| 735 deopt_infos_.Add(stub); | 739 deopt_infos_.Add(stub); |
| 736 return stub->entry_label(); | 740 return stub->entry_label(); |
| 737 } | 741 } |
| 738 | 742 |
| 739 | 743 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 ASSERT(sequence_node.NodeAt(0)->IsStoreInstanceFieldNode()); | 852 ASSERT(sequence_node.NodeAt(0)->IsStoreInstanceFieldNode()); |
| 849 ASSERT(sequence_node.NodeAt(1)->IsReturnNode()); | 853 ASSERT(sequence_node.NodeAt(1)->IsReturnNode()); |
| 850 const StoreInstanceFieldNode& store_node = | 854 const StoreInstanceFieldNode& store_node = |
| 851 *sequence_node.NodeAt(0)->AsStoreInstanceFieldNode(); | 855 *sequence_node.NodeAt(0)->AsStoreInstanceFieldNode(); |
| 852 if (store_node.field().guarded_cid() == kDynamicCid) { | 856 if (store_node.field().guarded_cid() == kDynamicCid) { |
| 853 GenerateInlinedSetter(store_node.field().Offset()); | 857 GenerateInlinedSetter(store_node.field().Offset()); |
| 854 return; | 858 return; |
| 855 } | 859 } |
| 856 } | 860 } |
| 857 } | 861 } |
| 858 // Even if an intrinsified version of the function was successfully | 862 |
| 859 // generated, it may fall through to the non-intrinsified method body. | 863 EnterIntrinsicMode(); |
| 860 Intrinsifier::Intrinsify(parsed_function().function(), assembler()); | 864 |
| 865 Intrinsifier::Intrinsify(parsed_function(), this); | |
| 866 | |
| 867 ExitIntrinsicMode(); | |
| 868 // "Deoptimization" from intrinsic continues here. | |
| 869 ASSERT(!intrinsic_deopt_label_.IsBound()); | |
| 870 assembler()->Bind(&intrinsic_deopt_label_); | |
| 861 } | 871 } |
| 862 | 872 |
| 863 | 873 |
| 864 void FlowGraphCompiler::GenerateInstanceCall( | 874 void FlowGraphCompiler::GenerateInstanceCall( |
| 865 intptr_t deopt_id, | 875 intptr_t deopt_id, |
| 866 intptr_t token_pos, | 876 intptr_t token_pos, |
| 867 intptr_t argument_count, | 877 intptr_t argument_count, |
| 868 LocationSummary* locs, | 878 LocationSummary* locs, |
| 869 const ICData& ic_data) { | 879 const ICData& ic_data) { |
| 870 ASSERT(!ic_data.IsNull()); | 880 ASSERT(!ic_data.IsNull()); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1361 : resolver_(resolver), | 1371 : resolver_(resolver), |
| 1362 reg_(kNoRegister), | 1372 reg_(kNoRegister), |
| 1363 spilled_(false) { | 1373 spilled_(false) { |
| 1364 uword blocked_mask = MaskBit(blocked) | 1374 uword blocked_mask = MaskBit(blocked) |
| 1365 | MaskBit(CTX) | 1375 | MaskBit(CTX) |
| 1366 | MaskBit(SPREG) | 1376 | MaskBit(SPREG) |
| 1367 | MaskBit(FPREG) | 1377 | MaskBit(FPREG) |
| 1368 | MaskBit(TMP) | 1378 | MaskBit(TMP) |
| 1369 | MaskBit(TMP2) | 1379 | MaskBit(TMP2) |
| 1370 | MaskBit(PP); | 1380 | MaskBit(PP); |
| 1381 if (resolver->compiler_->intrinsic_mode()) { | |
| 1382 // Block additional registers that must be preserved for intrinsics. | |
| 1383 blocked_mask |= MaskBit(ARGS_DESC_REG); | |
| 1384 } | |
| 1371 reg_ = static_cast<Register>( | 1385 reg_ = static_cast<Register>( |
| 1372 resolver_->AllocateScratchRegister(Location::kRegister, | 1386 resolver_->AllocateScratchRegister(Location::kRegister, |
| 1373 blocked_mask, | 1387 blocked_mask, |
| 1374 kFirstFreeCpuRegister, | 1388 kFirstFreeCpuRegister, |
| 1375 kLastFreeCpuRegister, | 1389 kLastFreeCpuRegister, |
| 1376 &spilled_)); | 1390 &spilled_)); |
| 1377 | 1391 |
| 1378 if (spilled_) { | 1392 if (spilled_) { |
| 1379 resolver->SpillScratch(reg_); | 1393 resolver->SpillScratch(reg_); |
| 1380 } | 1394 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1464 threshold = FLAG_optimization_counter_scale * basic_blocks + | 1478 threshold = FLAG_optimization_counter_scale * basic_blocks + |
| 1465 FLAG_min_optimization_counter_threshold; | 1479 FLAG_min_optimization_counter_threshold; |
| 1466 if (threshold > FLAG_optimization_counter_threshold) { | 1480 if (threshold > FLAG_optimization_counter_threshold) { |
| 1467 threshold = FLAG_optimization_counter_threshold; | 1481 threshold = FLAG_optimization_counter_threshold; |
| 1468 } | 1482 } |
| 1469 } | 1483 } |
| 1470 return threshold; | 1484 return threshold; |
| 1471 } | 1485 } |
| 1472 | 1486 |
| 1473 } // namespace dart | 1487 } // namespace dart |
| OLD | NEW |