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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm64.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
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/flow_graph_compiler_ia32.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) 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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset(), PP); 887 __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset(), PP);
888 __ SmiUntag(R7); 888 __ SmiUntag(R7);
889 // Check that R8 equals R7, i.e. no named arguments passed. 889 // Check that R8 equals R7, i.e. no named arguments passed.
890 __ CompareRegisters(R8, R7); 890 __ CompareRegisters(R8, R7);
891 __ b(&all_arguments_processed, EQ); 891 __ b(&all_arguments_processed, EQ);
892 } 892 }
893 } 893 }
894 894
895 __ Bind(&wrong_num_arguments); 895 __ Bind(&wrong_num_arguments);
896 if (function.IsClosureFunction()) { 896 if (function.IsClosureFunction()) {
897 // Invoke noSuchMethod function passing "call" as the original name.
898 StubCode* stub_code = isolate()->stub_code();
899 const int kNumArgsChecked = 1;
900 const ICData& ic_data = ICData::ZoneHandle(
901 ICData::New(function, Symbols::Call(), Object::empty_array(),
902 Isolate::kNoDeoptId, kNumArgsChecked));
903 __ LoadObject(R5, ic_data, PP);
904 __ LeaveDartFrame(); // The arguments are still on the stack. 897 __ LeaveDartFrame(); // The arguments are still on the stack.
905 __ BranchPatchable(&stub_code->CallNoSuchMethodFunctionLabel()); 898 __ BranchPatchable(
899 &isolate()->stub_code()->CallClosureNoSuchMethodLabel());
906 // The noSuchMethod call may return to the caller, but not here. 900 // The noSuchMethod call may return to the caller, but not here.
907 __ brk(0);
908 } else if (check_correct_named_args) { 901 } else if (check_correct_named_args) {
909 __ Stop("Wrong arguments"); 902 __ Stop("Wrong arguments");
910 } 903 }
911 904
912 __ Bind(&all_arguments_processed); 905 __ Bind(&all_arguments_processed);
913 // Nullify originally passed arguments only after they have been copied and 906 // Nullify originally passed arguments only after they have been copied and
914 // checked, otherwise noSuchMethod would not see their original values. 907 // checked, otherwise noSuchMethod would not see their original values.
915 // 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
916 // implicitly final, since garbage collecting the unmodified value is not 909 // implicitly final, since garbage collecting the unmodified value is not
917 // an issue anymore. 910 // an issue anymore.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 Label correct_num_arguments, wrong_num_arguments; 1050 Label correct_num_arguments, wrong_num_arguments;
1058 __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::count_offset(), PP); 1051 __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::count_offset(), PP);
1059 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params), PP); 1052 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params), PP);
1060 __ b(&wrong_num_arguments, NE); 1053 __ b(&wrong_num_arguments, NE);
1061 __ LoadFieldFromOffset(R1, R4, 1054 __ LoadFieldFromOffset(R1, R4,
1062 ArgumentsDescriptor::positional_count_offset(), PP); 1055 ArgumentsDescriptor::positional_count_offset(), PP);
1063 __ CompareRegisters(R0, R1); 1056 __ CompareRegisters(R0, R1);
1064 __ b(&correct_num_arguments, EQ); 1057 __ b(&correct_num_arguments, EQ);
1065 __ Bind(&wrong_num_arguments); 1058 __ Bind(&wrong_num_arguments);
1066 if (function.IsClosureFunction()) { 1059 if (function.IsClosureFunction()) {
1067 // Invoke noSuchMethod function passing the original function name.
1068 // For closure functions, use "call" as the original name.
1069 const String& name =
1070 String::Handle(function.IsClosureFunction()
1071 ? Symbols::Call().raw()
1072 : function.name());
1073 const int kNumArgsChecked = 1;
1074 const ICData& ic_data = ICData::ZoneHandle(
1075 ICData::New(function, name, Object::empty_array(),
1076 Isolate::kNoDeoptId, kNumArgsChecked));
1077 __ LoadObject(R5, ic_data, PP);
1078 __ LeaveDartFrame(); // The arguments are still on the stack. 1060 __ LeaveDartFrame(); // The arguments are still on the stack.
1079 __ BranchPatchable(&stub_code->CallNoSuchMethodFunctionLabel()); 1061 __ BranchPatchable(
1062 &isolate()->stub_code()->CallClosureNoSuchMethodLabel());
1080 // The noSuchMethod call may return to the caller, but not here. 1063 // The noSuchMethod call may return to the caller, but not here.
1081 __ brk(0);
1082 } else { 1064 } else {
1083 __ Stop("Wrong number of arguments"); 1065 __ Stop("Wrong number of arguments");
1084 } 1066 }
1085 __ Bind(&correct_num_arguments); 1067 __ Bind(&correct_num_arguments);
1086 } 1068 }
1087 } else if (!flow_graph().IsCompiledForOsr()) { 1069 } else if (!flow_graph().IsCompiledForOsr()) {
1088 CopyParameters(); 1070 CopyParameters();
1089 } 1071 }
1090 1072
1091 // In unoptimized code, initialize (non-argument) stack allocated slots to 1073 // In unoptimized code, initialize (non-argument) stack allocated slots to
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1719 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1738 UNIMPLEMENTED(); 1720 UNIMPLEMENTED();
1739 } 1721 }
1740 1722
1741 1723
1742 #undef __ 1724 #undef __
1743 1725
1744 } // namespace dart 1726 } // namespace dart
1745 1727
1746 #endif // defined TARGET_ARCH_ARM64 1728 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698