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

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

Issue 14556002: Uses slt and sltu for signed vs. unsigned comparison by the MIPS assembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « runtime/vm/assembler_mips.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 ASSERT(parsed_function().first_parameter_index() == kFirstLocalSlotIndex); 594 ASSERT(parsed_function().first_parameter_index() == kFirstLocalSlotIndex);
595 595
596 // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args, 596 // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args,
597 // where num_pos_args is the number of positional arguments passed in. 597 // where num_pos_args is the number of positional arguments passed in.
598 const int min_num_pos_args = num_fixed_params; 598 const int min_num_pos_args = num_fixed_params;
599 const int max_num_pos_args = num_fixed_params + num_opt_pos_params; 599 const int max_num_pos_args = num_fixed_params + num_opt_pos_params;
600 600
601 __ lw(T2, FieldAddress(S4, ArgumentsDescriptor::positional_count_offset())); 601 __ lw(T2, FieldAddress(S4, ArgumentsDescriptor::positional_count_offset()));
602 // Check that min_num_pos_args <= num_pos_args. 602 // Check that min_num_pos_args <= num_pos_args.
603 Label wrong_num_arguments; 603 Label wrong_num_arguments;
604 __ BranchLess(T2, Smi::RawValue(min_num_pos_args), &wrong_num_arguments); 604 __ BranchSignedLess(T2, Smi::RawValue(min_num_pos_args),
605 &wrong_num_arguments);
605 606
606 // Check that num_pos_args <= max_num_pos_args. 607 // Check that num_pos_args <= max_num_pos_args.
607 __ BranchGreater(T2, Smi::RawValue(max_num_pos_args), &wrong_num_arguments); 608 __ BranchSignedGreater(T2, Smi::RawValue(max_num_pos_args),
609 &wrong_num_arguments);
608 610
609 // Copy positional arguments. 611 // Copy positional arguments.
610 // Argument i passed at fp[kLastParamSlotIndex + num_args - 1 - i] is copied 612 // Argument i passed at fp[kLastParamSlotIndex + num_args - 1 - i] is copied
611 // to fp[kFirstLocalSlotIndex - i]. 613 // to fp[kFirstLocalSlotIndex - i].
612 614
613 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); 615 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
614 // Since T1 and T2 are Smi, use sll 1 instead of sll 2. 616 // Since T1 and T2 are Smi, use sll 1 instead of sll 2.
615 // Let T1 point to the last passed positional argument, i.e. to 617 // Let T1 point to the last passed positional argument, i.e. to
616 // fp[kLastParamSlotIndex + num_args - 1 - (num_pos_args - 1)]. 618 // fp[kLastParamSlotIndex + num_args - 1 - (num_pos_args - 1)].
617 __ subu(T1, T1, T2); 619 __ subu(T1, T1, T2);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 ASSERT(num_opt_pos_params > 0); 719 ASSERT(num_opt_pos_params > 0);
718 __ lw(T2, 720 __ lw(T2,
719 FieldAddress(S4, ArgumentsDescriptor::positional_count_offset())); 721 FieldAddress(S4, ArgumentsDescriptor::positional_count_offset()));
720 __ SmiUntag(T2); 722 __ SmiUntag(T2);
721 for (int i = 0; i < num_opt_pos_params; i++) { 723 for (int i = 0; i < num_opt_pos_params; i++) {
722 Label next_parameter; 724 Label next_parameter;
723 // Handle this optional positional parameter only if k or fewer positional 725 // Handle this optional positional parameter only if k or fewer positional
724 // arguments have been passed, where k is param_pos, the position of this 726 // arguments have been passed, where k is param_pos, the position of this
725 // optional parameter in the formal parameter list. 727 // optional parameter in the formal parameter list.
726 const int param_pos = num_fixed_params + i; 728 const int param_pos = num_fixed_params + i;
727 __ BranchGreater(T2, param_pos, &next_parameter); 729 __ BranchSignedGreater(T2, param_pos, &next_parameter);
728 // Load T3 with default argument. 730 // Load T3 with default argument.
729 const Object& value = Object::ZoneHandle( 731 const Object& value = Object::ZoneHandle(
730 parsed_function().default_parameter_values().At(i)); 732 parsed_function().default_parameter_values().At(i));
731 __ LoadObject(T3, value); 733 __ LoadObject(T3, value);
732 // Assign T3 to fp[kFirstLocalSlotIndex - param_pos]. 734 // Assign T3 to fp[kFirstLocalSlotIndex - param_pos].
733 // We do not use the final allocation index of the variable here, i.e. 735 // We do not use the final allocation index of the variable here, i.e.
734 // scope->VariableAt(i)->index(), because captured variables still need 736 // scope->VariableAt(i)->index(), because captured variables still need
735 // to be copied to the context that is not yet allocated. 737 // to be copied to the context that is not yet allocated.
736 const intptr_t computed_param_pos = kFirstLocalSlotIndex - param_pos; 738 const intptr_t computed_param_pos = kFirstLocalSlotIndex - param_pos;
737 __ sw(T3, Address(FP, computed_param_pos * kWordSize)); 739 __ sw(T3, Address(FP, computed_param_pos * kWordSize));
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 __ addiu(T1, T1, Immediate(1)); 880 __ addiu(T1, T1, Immediate(1));
879 __ sw(T1, FieldAddress(function_reg, 881 __ sw(T1, FieldAddress(function_reg,
880 Function::usage_counter_offset())); 882 Function::usage_counter_offset()));
881 } else { 883 } else {
882 __ lw(T1, FieldAddress(function_reg, 884 __ lw(T1, FieldAddress(function_reg,
883 Function::usage_counter_offset())); 885 Function::usage_counter_offset()));
884 } 886 }
885 887
886 // Skip Branch if T1 is less than the threshold. 888 // Skip Branch if T1 is less than the threshold.
887 Label dont_branch; 889 Label dont_branch;
888 __ BranchLess(T1, FLAG_optimization_counter_threshold, &dont_branch); 890 __ BranchSignedLess(T1, FLAG_optimization_counter_threshold,
891 &dont_branch);
889 892
890 ASSERT(function_reg == T0); 893 ASSERT(function_reg == T0);
891 __ Branch(&StubCode::OptimizeFunctionLabel()); 894 __ Branch(&StubCode::OptimizeFunctionLabel());
892 895
893 __ Bind(&dont_branch); 896 __ Bind(&dont_branch);
894 } 897 }
895 } else { 898 } else {
896 AddCurrentDescriptor(PcDescriptors::kEntryPatch, 899 AddCurrentDescriptor(PcDescriptors::kEntryPatch,
897 Isolate::kNoDeoptId, 900 Isolate::kNoDeoptId,
898 0); // No token position. 901 0); // No token position.
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 __ AddImmediate(SP, kDoubleSize); 1561 __ AddImmediate(SP, kDoubleSize);
1559 } 1562 }
1560 1563
1561 1564
1562 #undef __ 1565 #undef __
1563 1566
1564 1567
1565 } // namespace dart 1568 } // namespace dart
1566 1569
1567 #endif // defined TARGET_ARCH_MIPS 1570 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/assembler_mips.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698