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

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

Issue 3000333002: Fix several bugs in closure conversion. (Closed)
Patch Set: Fix bugs. Created 3 years, 4 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
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 if (check_correct_named_args) { 866 if (check_correct_named_args) {
867 __ ldr(NOTFP, FieldAddress(R4, ArgumentsDescriptor::count_offset())); 867 __ ldr(NOTFP, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
868 __ SmiUntag(NOTFP); 868 __ SmiUntag(NOTFP);
869 // Check that R6 equals NOTFP, i.e. no named arguments passed. 869 // Check that R6 equals NOTFP, i.e. no named arguments passed.
870 __ cmp(R6, Operand(NOTFP)); 870 __ cmp(R6, Operand(NOTFP));
871 __ b(&all_arguments_processed, EQ); 871 __ b(&all_arguments_processed, EQ);
872 } 872 }
873 } 873 }
874 874
875 __ Bind(&wrong_num_arguments); 875 __ Bind(&wrong_num_arguments);
876 if (function.IsClosureFunction()) { 876 if (function.IsClosureFunction() || function.IsConvertedClosureFunction()) {
877 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack. 877 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack.
878 __ Branch(*StubCode::CallClosureNoSuchMethod_entry()); 878 __ Branch(*StubCode::CallClosureNoSuchMethod_entry());
879 // The noSuchMethod call may return to the caller, but not here. 879 // The noSuchMethod call may return to the caller, but not here.
880 } else if (check_correct_named_args) { 880 } else if (check_correct_named_args) {
881 __ Stop("Wrong arguments"); 881 __ Stop("Wrong arguments");
882 } 882 }
883 883
884 __ Bind(&all_arguments_processed); 884 __ Bind(&all_arguments_processed);
885 // Nullify originally passed arguments only after they have been copied and 885 // Nullify originally passed arguments only after they have been copied and
886 // checked, otherwise noSuchMethod would not see their original values. 886 // checked, otherwise noSuchMethod would not see their original values.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 990
991 const int num_fixed_params = function.num_fixed_parameters(); 991 const int num_fixed_params = function.num_fixed_parameters();
992 const int num_copied_params = parsed_function().num_copied_params(); 992 const int num_copied_params = parsed_function().num_copied_params();
993 const int num_locals = parsed_function().num_stack_locals(); 993 const int num_locals = parsed_function().num_stack_locals();
994 994
995 // We check the number of passed arguments when we have to copy them due to 995 // We check the number of passed arguments when we have to copy them due to
996 // the presence of optional parameters. 996 // the presence of optional parameters.
997 // No such checking code is generated if only fixed parameters are declared, 997 // No such checking code is generated if only fixed parameters are declared,
998 // unless we are in debug mode or unless we are compiling a closure. 998 // unless we are in debug mode or unless we are compiling a closure.
999 if (num_copied_params == 0) { 999 if (num_copied_params == 0) {
1000 const bool check_arguments = 1000 const bool check_arguments = (function.IsClosureFunction() ||
1001 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); 1001 function.IsConvertedClosureFunction()) &&
1002 !flow_graph().IsCompiledForOsr();
1002 if (check_arguments) { 1003 if (check_arguments) {
1003 __ Comment("Check argument count"); 1004 __ Comment("Check argument count");
1004 // Check that exactly num_fixed arguments are passed in. 1005 // Check that exactly num_fixed arguments are passed in.
1005 Label correct_num_arguments, wrong_num_arguments; 1006 Label correct_num_arguments, wrong_num_arguments;
1006 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); 1007 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
1007 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); 1008 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
1008 __ b(&wrong_num_arguments, NE); 1009 __ b(&wrong_num_arguments, NE);
1009 __ ldr(R1, 1010 __ ldr(R1,
1010 FieldAddress(R4, ArgumentsDescriptor::positional_count_offset())); 1011 FieldAddress(R4, ArgumentsDescriptor::positional_count_offset()));
1011 __ cmp(R0, Operand(R1)); 1012 __ cmp(R0, Operand(R1));
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1801 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1801 DRegister dreg = EvenDRegisterOf(reg); 1802 DRegister dreg = EvenDRegisterOf(reg);
1802 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1803 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1803 } 1804 }
1804 1805
1805 #undef __ 1806 #undef __
1806 1807
1807 } // namespace dart 1808 } // namespace dart
1808 1809
1809 #endif // defined TARGET_ARCH_ARM 1810 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698