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

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

Issue 517383005: VM: Clean up generated code for NoSuchMethod invocation of closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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_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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 __ ldr(R7, FieldAddress(R4, ArgumentsDescriptor::count_offset())); 888 __ ldr(R7, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
889 __ SmiUntag(R7); 889 __ SmiUntag(R7);
890 // Check that R8 equals R7, i.e. no named arguments passed. 890 // Check that R8 equals R7, i.e. no named arguments passed.
891 __ cmp(R8, Operand(R7)); 891 __ cmp(R8, Operand(R7));
892 __ b(&all_arguments_processed, EQ); 892 __ b(&all_arguments_processed, EQ);
893 } 893 }
894 } 894 }
895 895
896 __ Bind(&wrong_num_arguments); 896 __ Bind(&wrong_num_arguments);
897 if (function.IsClosureFunction()) { 897 if (function.IsClosureFunction()) {
898 // Invoke noSuchMethod function passing "call" as the original name.
899 StubCode* stub_code = isolate()->stub_code();
900 const int kNumArgsChecked = 1;
901 const ICData& ic_data = ICData::ZoneHandle(
902 ICData::New(function, Symbols::Call(), Object::empty_array(),
903 Isolate::kNoDeoptId, kNumArgsChecked));
904 __ LoadObject(R5, ic_data);
905 __ LeaveDartFrame(); // The arguments are still on the stack. 898 __ LeaveDartFrame(); // The arguments are still on the stack.
906 __ Branch(&stub_code->CallNoSuchMethodFunctionLabel()); 899 __ Branch(&isolate()->stub_code()->CallNoSuchMethodFunctionLabel());
907 // The noSuchMethod call may return to the caller, but not here. 900 // The noSuchMethod call may return to the caller, but not here.
908 __ bkpt(0);
909 } else if (check_correct_named_args) { 901 } else if (check_correct_named_args) {
910 __ Stop("Wrong arguments"); 902 __ Stop("Wrong arguments");
911 } 903 }
912 904
913 __ Bind(&all_arguments_processed); 905 __ Bind(&all_arguments_processed);
914 // Nullify originally passed arguments only after they have been copied and 906 // Nullify originally passed arguments only after they have been copied and
915 // checked, otherwise noSuchMethod would not see their original values. 907 // checked, otherwise noSuchMethod would not see their original values.
916 // This step can be skipped in case we decide that formal parameters are 908 // This step can be skipped in case we decide that formal parameters are
917 // implicitly final, since garbage collecting the unmodified value is not 909 // implicitly final, since garbage collecting the unmodified value is not
918 // an issue anymore. 910 // an issue anymore.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 Label correct_num_arguments, wrong_num_arguments; 1042 Label correct_num_arguments, wrong_num_arguments;
1051 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); 1043 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
1052 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); 1044 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
1053 __ b(&wrong_num_arguments, NE); 1045 __ b(&wrong_num_arguments, NE);
1054 __ ldr(R1, FieldAddress(R4, 1046 __ ldr(R1, FieldAddress(R4,
1055 ArgumentsDescriptor::positional_count_offset())); 1047 ArgumentsDescriptor::positional_count_offset()));
1056 __ cmp(R0, Operand(R1)); 1048 __ cmp(R0, Operand(R1));
1057 __ b(&correct_num_arguments, EQ); 1049 __ b(&correct_num_arguments, EQ);
1058 __ Bind(&wrong_num_arguments); 1050 __ Bind(&wrong_num_arguments);
1059 if (function.IsClosureFunction()) { 1051 if (function.IsClosureFunction()) {
1060 // Invoke noSuchMethod function passing the original function name.
1061 // For closure functions, use "call" as the original name.
1062 const String& name =
1063 String::Handle(function.IsClosureFunction()
1064 ? Symbols::Call().raw()
1065 : function.name());
1066 const int kNumArgsChecked = 1;
1067 const ICData& ic_data = ICData::ZoneHandle(
1068 ICData::New(function, name, Object::empty_array(),
1069 Isolate::kNoDeoptId, kNumArgsChecked));
1070 __ LoadObject(R5, ic_data);
1071 __ LeaveDartFrame(); // The arguments are still on the stack. 1052 __ LeaveDartFrame(); // The arguments are still on the stack.
1072 __ Branch(&stub_code->CallNoSuchMethodFunctionLabel()); 1053 __ Branch(&isolate()->stub_code()->CallNoSuchMethodFunctionLabel());
1073 // The noSuchMethod call may return to the caller, but not here. 1054 // The noSuchMethod call may return to the caller, but not here.
1074 __ bkpt(0);
1075 } else { 1055 } else {
1076 __ Stop("Wrong number of arguments"); 1056 __ Stop("Wrong number of arguments");
1077 } 1057 }
1078 __ Bind(&correct_num_arguments); 1058 __ Bind(&correct_num_arguments);
1079 } 1059 }
1080 } else if (!flow_graph().IsCompiledForOsr()) { 1060 } else if (!flow_graph().IsCompiledForOsr()) {
1081 CopyParameters(); 1061 CopyParameters();
1082 } 1062 }
1083 1063
1084 // In unoptimized code, initialize (non-argument) stack allocated slots to 1064 // In unoptimized code, initialize (non-argument) stack allocated slots to
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 DRegister dreg = EvenDRegisterOf(reg); 1765 DRegister dreg = EvenDRegisterOf(reg);
1786 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1766 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1787 } 1767 }
1788 1768
1789 1769
1790 #undef __ 1770 #undef __
1791 1771
1792 } // namespace dart 1772 } // namespace dart
1793 1773
1794 #endif // defined TARGET_ARCH_ARM 1774 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698