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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 if (check_correct_named_args) { 850 if (check_correct_named_args) {
851 __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset()); 851 __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset());
852 __ SmiUntag(R7); 852 __ SmiUntag(R7);
853 // Check that R8 equals R7, i.e. no named arguments passed. 853 // Check that R8 equals R7, i.e. no named arguments passed.
854 __ CompareRegisters(R8, R7); 854 __ CompareRegisters(R8, R7);
855 __ b(&all_arguments_processed, EQ); 855 __ b(&all_arguments_processed, EQ);
856 } 856 }
857 } 857 }
858 858
859 __ Bind(&wrong_num_arguments); 859 __ Bind(&wrong_num_arguments);
860 if (function.IsClosureFunction()) { 860 if (function.IsClosureFunction() || function.IsConvertedClosureFunction()) {
861 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack. 861 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack.
862 __ BranchPatchable(*StubCode::CallClosureNoSuchMethod_entry()); 862 __ BranchPatchable(*StubCode::CallClosureNoSuchMethod_entry());
863 // The noSuchMethod call may return to the caller, but not here. 863 // The noSuchMethod call may return to the caller, but not here.
864 } else if (check_correct_named_args) { 864 } else if (check_correct_named_args) {
865 __ Stop("Wrong arguments"); 865 __ Stop("Wrong arguments");
866 } 866 }
867 867
868 __ Bind(&all_arguments_processed); 868 __ Bind(&all_arguments_processed);
869 // Nullify originally passed arguments only after they have been copied and 869 // Nullify originally passed arguments only after they have been copied and
870 // checked, otherwise noSuchMethod would not see their original values. 870 // checked, otherwise noSuchMethod would not see their original values.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 980
981 const int num_fixed_params = function.num_fixed_parameters(); 981 const int num_fixed_params = function.num_fixed_parameters();
982 const int num_copied_params = parsed_function().num_copied_params(); 982 const int num_copied_params = parsed_function().num_copied_params();
983 const int num_locals = parsed_function().num_stack_locals(); 983 const int num_locals = parsed_function().num_stack_locals();
984 984
985 // We check the number of passed arguments when we have to copy them due to 985 // We check the number of passed arguments when we have to copy them due to
986 // the presence of optional parameters. 986 // the presence of optional parameters.
987 // No such checking code is generated if only fixed parameters are declared, 987 // No such checking code is generated if only fixed parameters are declared,
988 // unless we are in debug mode or unless we are compiling a closure. 988 // unless we are in debug mode or unless we are compiling a closure.
989 if (num_copied_params == 0) { 989 if (num_copied_params == 0) {
990 const bool check_arguments = 990 const bool check_arguments = (function.IsClosureFunction() ||
991 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); 991 function.IsConvertedClosureFunction()) &&
992 !flow_graph().IsCompiledForOsr();
992 if (check_arguments) { 993 if (check_arguments) {
993 __ Comment("Check argument count"); 994 __ Comment("Check argument count");
994 // Check that exactly num_fixed arguments are passed in. 995 // Check that exactly num_fixed arguments are passed in.
995 Label correct_num_arguments, wrong_num_arguments; 996 Label correct_num_arguments, wrong_num_arguments;
996 __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::count_offset()); 997 __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::count_offset());
997 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); 998 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
998 __ b(&wrong_num_arguments, NE); 999 __ b(&wrong_num_arguments, NE);
999 __ LoadFieldFromOffset(R1, R4, 1000 __ LoadFieldFromOffset(R1, R4,
1000 ArgumentsDescriptor::positional_count_offset()); 1001 ArgumentsDescriptor::positional_count_offset());
1001 __ CompareRegisters(R0, R1); 1002 __ CompareRegisters(R0, R1);
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 1742
1742 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1743 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1743 __ PopDouble(reg); 1744 __ PopDouble(reg);
1744 } 1745 }
1745 1746
1746 #undef __ 1747 #undef __
1747 1748
1748 } // namespace dart 1749 } // namespace dart
1749 1750
1750 #endif // defined TARGET_ARCH_ARM64 1751 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698