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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 if (is_optimizing()) { | 626 if (is_optimizing()) { |
627 EmitOptimizedStaticCall(function, arguments_descriptor, argument_count, | 627 EmitOptimizedStaticCall(function, arguments_descriptor, argument_count, |
628 deopt_id, token_pos, locs); | 628 deopt_id, token_pos, locs); |
629 } else { | 629 } else { |
630 EmitUnoptimizedStaticCall(function, arguments_descriptor, argument_count, | 630 EmitUnoptimizedStaticCall(function, arguments_descriptor, argument_count, |
631 deopt_id, token_pos, locs); | 631 deopt_id, token_pos, locs); |
632 } | 632 } |
633 } | 633 } |
634 | 634 |
635 | 635 |
636 void FlowGraphCompiler::EmitUnoptimizedStaticCall( | |
637 const Function& target_function, | |
638 const Array& arguments_descriptor, | |
639 intptr_t argument_count, | |
640 intptr_t deopt_id, | |
641 intptr_t token_pos, | |
642 LocationSummary* locs) { | |
643 // TODO(srdjan): Improve performance of function recognition. | |
644 MethodRecognizer::Kind recognized_kind = | |
645 MethodRecognizer::RecognizeKind(target_function); | |
646 int num_args_checked = 0; | |
647 if ((recognized_kind == MethodRecognizer::kMathMin) || | |
648 (recognized_kind == MethodRecognizer::kMathMax)) { | |
649 num_args_checked = 2; | |
650 } | |
651 const ICData& ic_data = ICData::ZoneHandle( | |
652 ICData::New(parsed_function().function(), // Caller function. | |
653 String::Handle(target_function.name()), | |
654 arguments_descriptor, | |
655 deopt_id, | |
656 num_args_checked)); // No arguments checked. | |
657 ic_data.AddTarget(target_function); | |
658 uword label_address = 0; | |
659 if (ic_data.num_args_tested() == 0) { | |
660 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint(); | |
661 } else if (ic_data.num_args_tested() == 2) { | |
662 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint(); | |
663 } else { | |
664 UNIMPLEMENTED(); | |
665 } | |
666 ExternalLabel target_label("StaticCallICStub", label_address); | |
667 assembler()->LoadObject(ICREG, ic_data); | |
668 GenerateDartCall(deopt_id, | |
669 token_pos, | |
670 &target_label, | |
671 PcDescriptors::kUnoptStaticCall, | |
672 locs); | |
673 assembler()->Drop(argument_count); | |
674 } | |
675 | |
676 | |
677 | |
678 void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, | 636 void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, |
679 const AbstractType& type, | 637 const AbstractType& type, |
680 Label* is_instance_lbl, | 638 Label* is_instance_lbl, |
681 Label* is_not_instance_lbl) { | 639 Label* is_not_instance_lbl) { |
682 assembler()->Comment("NumberTypeCheck"); | 640 assembler()->Comment("NumberTypeCheck"); |
683 GrowableArray<intptr_t> args; | 641 GrowableArray<intptr_t> args; |
684 if (type.IsNumberType()) { | 642 if (type.IsNumberType()) { |
685 args.Add(kDoubleCid); | 643 args.Add(kDoubleCid); |
686 args.Add(kMintCid); | 644 args.Add(kMintCid); |
687 args.Add(kBigintCid); | 645 args.Add(kBigintCid); |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 | 1100 |
1143 for (int i = 0; i < len; i++) { | 1101 for (int i = 0; i < len; i++) { |
1144 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1102 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
1145 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1103 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
1146 ic_data.GetCountAt(i))); | 1104 ic_data.GetCountAt(i))); |
1147 } | 1105 } |
1148 sorted->Sort(HighestCountFirst); | 1106 sorted->Sort(HighestCountFirst); |
1149 } | 1107 } |
1150 | 1108 |
1151 } // namespace dart | 1109 } // namespace dart |
OLD | NEW |