Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: runtime/vm/flow_graph_compiler.cc

Issue 19774007: Collect both arguments for math's min/max static functions. Later that information will be used to … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 if (is_optimizing()) { 623 if (is_optimizing()) {
624 EmitOptimizedStaticCall(function, arguments_descriptor, argument_count, 624 EmitOptimizedStaticCall(function, arguments_descriptor, argument_count,
625 deopt_id, token_pos, locs); 625 deopt_id, token_pos, locs);
626 } else { 626 } else {
627 EmitUnoptimizedStaticCall(function, arguments_descriptor, argument_count, 627 EmitUnoptimizedStaticCall(function, arguments_descriptor, argument_count,
628 deopt_id, token_pos, locs); 628 deopt_id, token_pos, locs);
629 } 629 }
630 } 630 }
631 631
632 632
633 void FlowGraphCompiler::EmitUnoptimizedStaticCall(
634 const Function& target_function,
635 const Array& arguments_descriptor,
636 intptr_t argument_count,
637 intptr_t deopt_id,
638 intptr_t token_pos,
639 LocationSummary* locs) {
640 // TODO(srdjan): Improve performance of function recognition.
641 MethodRecognizer::Kind recognized_kind =
642 MethodRecognizer::RecognizeKind(target_function);
643 int num_args_checked = 0;
644 if ((recognized_kind == MethodRecognizer::kMathMin) ||
645 (recognized_kind == MethodRecognizer::kMathMax)) {
646 num_args_checked = 2;
647 }
648 const ICData& ic_data = ICData::ZoneHandle(
649 ICData::New(parsed_function().function(), // Caller function.
650 String::Handle(target_function.name()),
651 arguments_descriptor,
652 deopt_id,
653 num_args_checked)); // No arguments checked.
654 ic_data.AddTarget(target_function);
655 uword label_address = 0;
656 if (ic_data.num_args_tested() == 0) {
657 label_address = StubCode::ZeroArgsUnoptimizedStaticCallEntryPoint();
658 } else if (ic_data.num_args_tested() == 2) {
659 label_address = StubCode::TwoArgsUnoptimizedStaticCallEntryPoint();
660 } else {
661 UNIMPLEMENTED();
662 }
663 ExternalLabel target_label("StaticCallICStub", label_address);
664 assembler()->LoadObject(ICREG, ic_data);
665 GenerateDartCall(deopt_id,
666 token_pos,
667 &target_label,
668 PcDescriptors::kUnoptStaticCall,
669 locs);
670 assembler()->Drop(argument_count);
671 }
672
673
674
633 void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, 675 void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg,
634 const AbstractType& type, 676 const AbstractType& type,
635 Label* is_instance_lbl, 677 Label* is_instance_lbl,
636 Label* is_not_instance_lbl) { 678 Label* is_not_instance_lbl) {
637 assembler()->Comment("NumberTypeCheck"); 679 assembler()->Comment("NumberTypeCheck");
638 GrowableArray<intptr_t> args; 680 GrowableArray<intptr_t> args;
639 if (type.IsNumberType()) { 681 if (type.IsNumberType()) {
640 args.Add(kDoubleCid); 682 args.Add(kDoubleCid);
641 args.Add(kMintCid); 683 args.Add(kMintCid);
642 args.Add(kBigintCid); 684 args.Add(kBigintCid);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 1139
1098 for (int i = 0; i < len; i++) { 1140 for (int i = 0; i < len; i++) {
1099 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), 1141 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i),
1100 &Function::ZoneHandle(ic_data.GetTargetAt(i)), 1142 &Function::ZoneHandle(ic_data.GetTargetAt(i)),
1101 ic_data.GetCountAt(i))); 1143 ic_data.GetCountAt(i)));
1102 } 1144 }
1103 sorted->Sort(HighestCountFirst); 1145 sorted->Sort(HighestCountFirst);
1104 } 1146 }
1105 1147
1106 } // namespace dart 1148 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698