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

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

Issue 17857008: Fix and simplify invocation of noSuchMethod on all platforms after the wrong (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 __ sw(T3, Address(FP, computed_param_pos * kWordSize)); 913 __ sw(T3, Address(FP, computed_param_pos * kWordSize));
914 __ Bind(&next_parameter); 914 __ Bind(&next_parameter);
915 } 915 }
916 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); 916 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
917 __ SmiUntag(T1); 917 __ SmiUntag(T1);
918 // Check that T2 equals T1, i.e. no named arguments passed. 918 // Check that T2 equals T1, i.e. no named arguments passed.
919 __ beq(T2, T1, &all_arguments_processed); 919 __ beq(T2, T1, &all_arguments_processed);
920 } 920 }
921 921
922 __ Bind(&wrong_num_arguments); 922 __ Bind(&wrong_num_arguments);
923 if (StackSize() != 0) {
924 // We need to unwind the space we reserved for locals and copied parameters.
925 // The NoSuchMethodFunction stub does not expect to see that area on the
926 // stack.
927 __ AddImmediate(SP, StackSize() * kWordSize);
928 }
929 // The call below has an empty stackmap because we have just
930 // dropped the spill slots.
931 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
932
933 // Invoke noSuchMethod function passing the original name of the function. 923 // Invoke noSuchMethod function passing the original name of the function.
934 // If the function is a closure function, use "call" as the original name. 924 // If the function is a closure function, use "call" as the original name.
935 const String& name = String::Handle( 925 const String& name = String::Handle(
936 function.IsClosureFunction() ? Symbols::Call().raw() : function.name()); 926 function.IsClosureFunction() ? Symbols::Call().raw() : function.name());
937 const int kNumArgsChecked = 1; 927 const int kNumArgsChecked = 1;
938 const ICData& ic_data = ICData::ZoneHandle( 928 const ICData& ic_data = ICData::ZoneHandle(
939 ICData::New(function, name, Object::null_array(), 929 ICData::New(function, name, Object::null_array(),
940 Isolate::kNoDeoptId, kNumArgsChecked)); 930 Isolate::kNoDeoptId, kNumArgsChecked));
941 __ LoadObject(S5, ic_data); 931 __ LoadObject(S5, ic_data);
942 // FP - 4 : saved PP, object pool pointer of caller. 932 __ LeaveDartFrame(); // The arguments are still on the stack.
943 // FP + 0 : previous frame pointer. 933 __ Branch(&StubCode::CallNoSuchMethodFunctionLabel());
944 // FP + 4 : return address. 934 // The noSuchMethod call may return to the caller, but not here.
945 // FP + 8 : PC marker, for easy identification of RawInstruction obj. 935 __ break_(0);
946 // FP + 12: last argument (arg n-1).
947 // SP + 0 : saved PP.
948 // SP + 16 + 4*(n-1) : first argument (arg 0).
949 // S5 : ic-data.
950 // S4 : arguments descriptor array.
951 __ BranchLink(&StubCode::CallNoSuchMethodFunctionLabel());
952 // Emit descriptors in order to provide correct postion in stacktrace.
953 AddCurrentDescriptor(PcDescriptors::kOther, -1, function.token_pos());
954 if (is_optimizing()) {
955 stackmap_table_builder_->AddEntry(assembler()->CodeSize(),
956 empty_stack_bitmap,
957 0); // No registers.
958 }
959 // The noSuchMethod call may return.
960 __ LeaveDartFrameAndReturn();
961 936
962 __ Bind(&all_arguments_processed); 937 __ Bind(&all_arguments_processed);
963 // Nullify originally passed arguments only after they have been copied and 938 // Nullify originally passed arguments only after they have been copied and
964 // checked, otherwise noSuchMethod would not see their original values. 939 // checked, otherwise noSuchMethod would not see their original values.
965 // This step can be skipped in case we decide that formal parameters are 940 // This step can be skipped in case we decide that formal parameters are
966 // implicitly final, since garbage collecting the unmodified value is not 941 // implicitly final, since garbage collecting the unmodified value is not
967 // an issue anymore. 942 // an issue anymore.
968 943
969 // S4 : arguments descriptor array. 944 // S4 : arguments descriptor array.
970 __ lw(T2, FieldAddress(S4, ArgumentsDescriptor::count_offset())); 945 __ lw(T2, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 Label correct_num_arguments, wrong_num_arguments; 1102 Label correct_num_arguments, wrong_num_arguments;
1128 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); 1103 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
1129 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), 1104 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params),
1130 &wrong_num_arguments); 1105 &wrong_num_arguments);
1131 1106
1132 __ lw(T1, FieldAddress(S4, 1107 __ lw(T1, FieldAddress(S4,
1133 ArgumentsDescriptor::positional_count_offset())); 1108 ArgumentsDescriptor::positional_count_offset()));
1134 __ beq(T0, T1, &correct_num_arguments); 1109 __ beq(T0, T1, &correct_num_arguments);
1135 __ Bind(&wrong_num_arguments); 1110 __ Bind(&wrong_num_arguments);
1136 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { 1111 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) {
1137 if (StackSize() != 0) {
1138 // We need to unwind the space we reserved for locals and copied
1139 // parameters. The NoSuchMethodFunction stub does not expect to see
1140 // that area on the stack.
1141 __ AddImmediate(SP, StackSize() * kWordSize);
1142 }
1143 // The call below has an empty stackmap because we have just
1144 // dropped the spill slots.
1145 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
1146
1147 // Invoke noSuchMethod function passing the original function name. 1112 // Invoke noSuchMethod function passing the original function name.
1148 // For closure functions, use "call" as the original name. 1113 // For closure functions, use "call" as the original name.
1149 const String& name = 1114 const String& name =
1150 String::Handle(function.IsClosureFunction() 1115 String::Handle(function.IsClosureFunction()
1151 ? Symbols::Call().raw() 1116 ? Symbols::Call().raw()
1152 : function.name()); 1117 : function.name());
1153 const int kNumArgsChecked = 1; 1118 const int kNumArgsChecked = 1;
1154 const ICData& ic_data = ICData::ZoneHandle( 1119 const ICData& ic_data = ICData::ZoneHandle(
1155 ICData::New(function, name, Object::null_array(), 1120 ICData::New(function, name, Object::null_array(),
1156 Isolate::kNoDeoptId, kNumArgsChecked)); 1121 Isolate::kNoDeoptId, kNumArgsChecked));
1157 __ LoadObject(S5, ic_data); 1122 __ LoadObject(S5, ic_data);
1158 // FP - 4 : saved PP, object pool pointer of caller. 1123 __ LeaveDartFrame(); // The arguments are still on the stack.
1159 // FP + 0 : previous frame pointer. 1124 __ Branch(&StubCode::CallNoSuchMethodFunctionLabel());
1160 // FP + 4 : return address. 1125 // The noSuchMethod call may return to the caller, but not here.
1161 // FP + 8 : PC marker, for easy identification of RawInstruction obj. 1126 __ break_(0);
1162 // FP + 12: last argument (arg n-1).
1163 // SP + 0 : saved PP.
1164 // SP + 16 + 4*(n-1) : first argument (arg 0).
1165 // S5 : ic-data.
1166 // S4 : arguments descriptor array.
1167 __ BranchLink(&StubCode::CallNoSuchMethodFunctionLabel());
1168 // Emit descriptors in order to provide correct postion in stacktrace.
1169 AddCurrentDescriptor(PcDescriptors::kOther, -1, function.token_pos());
1170 if (is_optimizing()) {
1171 stackmap_table_builder_->AddEntry(assembler()->CodeSize(),
1172 empty_stack_bitmap,
1173 0); // No registers.
1174 }
1175 // The noSuchMethod call may return.
1176 __ LeaveDartFrameAndReturn();
1177 } else { 1127 } else {
1178 __ Stop("Wrong number of arguments"); 1128 __ Stop("Wrong number of arguments");
1179 } 1129 }
1180 __ Bind(&correct_num_arguments); 1130 __ Bind(&correct_num_arguments);
1181 } 1131 }
1182 // The arguments descriptor is never saved in the absence of optional 1132 // The arguments descriptor is never saved in the absence of optional
1183 // parameters, since any argument definition test would always yield true. 1133 // parameters, since any argument definition test would always yield true.
1184 ASSERT(saved_args_desc_var == NULL); 1134 ASSERT(saved_args_desc_var == NULL);
1185 } else { 1135 } else {
1186 if (saved_args_desc_var != NULL) { 1136 if (saved_args_desc_var != NULL) {
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 __ AddImmediate(SP, kDoubleSize); 1909 __ AddImmediate(SP, kDoubleSize);
1960 } 1910 }
1961 1911
1962 1912
1963 #undef __ 1913 #undef __
1964 1914
1965 1915
1966 } // namespace dart 1916 } // namespace dart
1967 1917
1968 #endif // defined TARGET_ARCH_MIPS 1918 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698