| OLD | NEW |
| 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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 const Function& function = parsed_function().function(); | 1078 const Function& function = parsed_function().function(); |
| 1079 | 1079 |
| 1080 const int num_fixed_params = function.num_fixed_parameters(); | 1080 const int num_fixed_params = function.num_fixed_parameters(); |
| 1081 const int num_copied_params = parsed_function().num_copied_params(); | 1081 const int num_copied_params = parsed_function().num_copied_params(); |
| 1082 const int num_locals = parsed_function().num_stack_locals(); | 1082 const int num_locals = parsed_function().num_stack_locals(); |
| 1083 | 1083 |
| 1084 // We check the number of passed arguments when we have to copy them due to | 1084 // We check the number of passed arguments when we have to copy them due to |
| 1085 // the presence of optional parameters. | 1085 // the presence of optional parameters. |
| 1086 // No such checking code is generated if only fixed parameters are declared, | 1086 // No such checking code is generated if only fixed parameters are declared, |
| 1087 // unless we are in debug mode or unless we are compiling a closure. | 1087 // unless we are in debug mode or unless we are compiling a closure. |
| 1088 LocalVariable* saved_args_desc_var = | |
| 1089 parsed_function().GetSavedArgumentsDescriptorVar(); | |
| 1090 if (num_copied_params == 0) { | 1088 if (num_copied_params == 0) { |
| 1091 #ifdef DEBUG | 1089 #ifdef DEBUG |
| 1092 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1090 ASSERT(!parsed_function().function().HasOptionalParameters()); |
| 1093 const bool check_arguments = true; | 1091 const bool check_arguments = true; |
| 1094 #else | 1092 #else |
| 1095 const bool check_arguments = | 1093 const bool check_arguments = |
| 1096 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); | 1094 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); |
| 1097 #endif | 1095 #endif |
| 1098 if (check_arguments) { | 1096 if (check_arguments) { |
| 1099 __ TraceSimMsg("Check argument count"); | 1097 __ TraceSimMsg("Check argument count"); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1122 __ LoadObject(S5, ic_data); | 1120 __ LoadObject(S5, ic_data); |
| 1123 __ LeaveDartFrame(); // The arguments are still on the stack. | 1121 __ LeaveDartFrame(); // The arguments are still on the stack. |
| 1124 __ Branch(&StubCode::CallNoSuchMethodFunctionLabel()); | 1122 __ Branch(&StubCode::CallNoSuchMethodFunctionLabel()); |
| 1125 // The noSuchMethod call may return to the caller, but not here. | 1123 // The noSuchMethod call may return to the caller, but not here. |
| 1126 __ break_(0); | 1124 __ break_(0); |
| 1127 } else { | 1125 } else { |
| 1128 __ Stop("Wrong number of arguments"); | 1126 __ Stop("Wrong number of arguments"); |
| 1129 } | 1127 } |
| 1130 __ Bind(&correct_num_arguments); | 1128 __ Bind(&correct_num_arguments); |
| 1131 } | 1129 } |
| 1132 // The arguments descriptor is never saved in the absence of optional | |
| 1133 // parameters, since any argument definition test would always yield true. | |
| 1134 ASSERT(saved_args_desc_var == NULL); | |
| 1135 } else { | 1130 } else { |
| 1136 if (saved_args_desc_var != NULL) { | |
| 1137 __ Comment("Save arguments descriptor"); | |
| 1138 const Register kArgumentsDescriptorReg = S4; | |
| 1139 // The saved_args_desc_var is allocated one slot before the first local. | |
| 1140 const intptr_t slot = parsed_function().first_stack_local_index() + 1; | |
| 1141 // If the saved_args_desc_var is captured, it is first moved to the stack | |
| 1142 // and later to the context, once the context is allocated. | |
| 1143 ASSERT(saved_args_desc_var->is_captured() || | |
| 1144 (saved_args_desc_var->index() == slot)); | |
| 1145 __ sw(kArgumentsDescriptorReg, Address(FP, slot * kWordSize)); | |
| 1146 } | |
| 1147 CopyParameters(); | 1131 CopyParameters(); |
| 1148 } | 1132 } |
| 1149 | 1133 |
| 1150 // In unoptimized code, initialize (non-argument) stack allocated slots to | 1134 // In unoptimized code, initialize (non-argument) stack allocated slots to |
| 1151 // null. This does not cover the saved_args_desc_var slot. | 1135 // null. |
| 1152 if (!is_optimizing() && (num_locals > 0)) { | 1136 if (!is_optimizing() && (num_locals > 0)) { |
| 1153 __ TraceSimMsg("Initialize spill slots"); | 1137 __ TraceSimMsg("Initialize spill slots"); |
| 1154 __ Comment("Initialize spill slots"); | 1138 __ Comment("Initialize spill slots"); |
| 1155 const intptr_t slot_base = parsed_function().first_stack_local_index(); | 1139 const intptr_t slot_base = parsed_function().first_stack_local_index(); |
| 1156 for (intptr_t i = 0; i < num_locals; ++i) { | 1140 for (intptr_t i = 0; i < num_locals; ++i) { |
| 1157 // Subtract index i (locals lie at lower addresses than FP). | 1141 // Subtract index i (locals lie at lower addresses than FP). |
| 1158 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null())); | 1142 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(Object::null())); |
| 1159 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize)); | 1143 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize)); |
| 1160 } | 1144 } |
| 1161 } | 1145 } |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1909 __ AddImmediate(SP, kDoubleSize); | 1893 __ AddImmediate(SP, kDoubleSize); |
| 1910 } | 1894 } |
| 1911 | 1895 |
| 1912 | 1896 |
| 1913 #undef __ | 1897 #undef __ |
| 1914 | 1898 |
| 1915 | 1899 |
| 1916 } // namespace dart | 1900 } // namespace dart |
| 1917 | 1901 |
| 1918 #endif // defined TARGET_ARCH_MIPS | 1902 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |