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

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

Issue 17977002: - Remove arguments definition test from the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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_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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 const Function& function = parsed_function().function(); 1103 const Function& function = parsed_function().function();
1104 1104
1105 const int num_fixed_params = function.num_fixed_parameters(); 1105 const int num_fixed_params = function.num_fixed_parameters();
1106 const int num_copied_params = parsed_function().num_copied_params(); 1106 const int num_copied_params = parsed_function().num_copied_params();
1107 const int num_locals = parsed_function().num_stack_locals(); 1107 const int num_locals = parsed_function().num_stack_locals();
1108 1108
1109 // We check the number of passed arguments when we have to copy them due to 1109 // We check the number of passed arguments when we have to copy them due to
1110 // the presence of optional parameters. 1110 // the presence of optional parameters.
1111 // No such checking code is generated if only fixed parameters are declared, 1111 // No such checking code is generated if only fixed parameters are declared,
1112 // unless we are in debug mode or unless we are compiling a closure. 1112 // unless we are in debug mode or unless we are compiling a closure.
1113 LocalVariable* saved_args_desc_var =
1114 parsed_function().GetSavedArgumentsDescriptorVar();
1115 if (num_copied_params == 0) { 1113 if (num_copied_params == 0) {
1116 #ifdef DEBUG 1114 #ifdef DEBUG
1117 ASSERT(!parsed_function().function().HasOptionalParameters()); 1115 ASSERT(!parsed_function().function().HasOptionalParameters());
1118 const bool check_arguments = true; 1116 const bool check_arguments = true;
1119 #else 1117 #else
1120 const bool check_arguments = 1118 const bool check_arguments =
1121 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); 1119 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher();
1122 #endif 1120 #endif
1123 if (check_arguments) { 1121 if (check_arguments) {
1124 __ TraceSimMsg("Check argument count"); 1122 __ TraceSimMsg("Check argument count");
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 empty_stack_bitmap, 1170 empty_stack_bitmap,
1173 0); // No registers. 1171 0); // No registers.
1174 } 1172 }
1175 // The noSuchMethod call may return. 1173 // The noSuchMethod call may return.
1176 __ LeaveDartFrameAndReturn(); 1174 __ LeaveDartFrameAndReturn();
1177 } else { 1175 } else {
1178 __ Stop("Wrong number of arguments"); 1176 __ Stop("Wrong number of arguments");
1179 } 1177 }
1180 __ Bind(&correct_num_arguments); 1178 __ Bind(&correct_num_arguments);
1181 } 1179 }
1182 // The arguments descriptor is never saved in the absence of optional
1183 // parameters, since any argument definition test would always yield true.
1184 ASSERT(saved_args_desc_var == NULL);
1185 } else { 1180 } else {
1186 if (saved_args_desc_var != NULL) {
1187 __ Comment("Save arguments descriptor");
1188 const Register kArgumentsDescriptorReg = S4;
1189 // The saved_args_desc_var is allocated one slot before the first local.
1190 const intptr_t slot = parsed_function().first_stack_local_index() + 1;
1191 // If the saved_args_desc_var is captured, it is first moved to the stack
1192 // and later to the context, once the context is allocated.
1193 ASSERT(saved_args_desc_var->is_captured() ||
1194 (saved_args_desc_var->index() == slot));
1195 __ sw(kArgumentsDescriptorReg, Address(FP, slot * kWordSize));
1196 }
1197 CopyParameters(); 1181 CopyParameters();
1198 } 1182 }
1199 1183
1200 // In unoptimized code, initialize (non-argument) stack allocated slots to 1184 // In unoptimized code, initialize (non-argument) stack allocated slots to
1201 // null. This does not cover the saved_args_desc_var slot. 1185 // null.
1202 if (!is_optimizing() && (num_locals > 0)) { 1186 if (!is_optimizing() && (num_locals > 0)) {
1203 __ TraceSimMsg("Initialize spill slots"); 1187 __ TraceSimMsg("Initialize spill slots");
1204 __ Comment("Initialize spill slots"); 1188 __ Comment("Initialize spill slots");
1205 const intptr_t slot_base = parsed_function().first_stack_local_index(); 1189 const intptr_t slot_base = parsed_function().first_stack_local_index();
1206 for (intptr_t i = 0; i < num_locals; ++i) { 1190 for (intptr_t i = 0; i < num_locals; ++i) {
1207 // Subtract index i (locals lie at lower addresses than FP). 1191 // Subtract index i (locals lie at lower addresses than FP).
1208 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null())); 1192 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null()));
1209 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize)); 1193 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize));
1210 } 1194 }
1211 } 1195 }
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 __ AddImmediate(SP, kDoubleSize); 1943 __ AddImmediate(SP, kDoubleSize);
1960 } 1944 }
1961 1945
1962 1946
1963 #undef __ 1947 #undef __
1964 1948
1965 1949
1966 } // namespace dart 1950 } // namespace dart
1967 1951
1968 #endif // defined TARGET_ARCH_MIPS 1952 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698