| 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_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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 const Function& function = parsed_function().function(); | 1054 const Function& function = parsed_function().function(); |
| 1055 | 1055 |
| 1056 const int num_fixed_params = function.num_fixed_parameters(); | 1056 const int num_fixed_params = function.num_fixed_parameters(); |
| 1057 const int num_copied_params = parsed_function().num_copied_params(); | 1057 const int num_copied_params = parsed_function().num_copied_params(); |
| 1058 const int num_locals = parsed_function().num_stack_locals(); | 1058 const int num_locals = parsed_function().num_stack_locals(); |
| 1059 | 1059 |
| 1060 // We check the number of passed arguments when we have to copy them due to | 1060 // We check the number of passed arguments when we have to copy them due to |
| 1061 // the presence of optional parameters. | 1061 // the presence of optional parameters. |
| 1062 // No such checking code is generated if only fixed parameters are declared, | 1062 // No such checking code is generated if only fixed parameters are declared, |
| 1063 // unless we are in debug mode or unless we are compiling a closure. | 1063 // unless we are in debug mode or unless we are compiling a closure. |
| 1064 LocalVariable* saved_args_desc_var = | |
| 1065 parsed_function().GetSavedArgumentsDescriptorVar(); | |
| 1066 if (num_copied_params == 0) { | 1064 if (num_copied_params == 0) { |
| 1067 #ifdef DEBUG | 1065 #ifdef DEBUG |
| 1068 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1066 ASSERT(!parsed_function().function().HasOptionalParameters()); |
| 1069 const bool check_arguments = true; | 1067 const bool check_arguments = true; |
| 1070 #else | 1068 #else |
| 1071 const bool check_arguments = | 1069 const bool check_arguments = |
| 1072 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); | 1070 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); |
| 1073 #endif | 1071 #endif |
| 1074 if (check_arguments) { | 1072 if (check_arguments) { |
| 1075 __ Comment("Check argument count"); | 1073 __ Comment("Check argument count"); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 0); // No registers. | 1121 0); // No registers. |
| 1124 } | 1122 } |
| 1125 // The noSuchMethod call may return. | 1123 // The noSuchMethod call may return. |
| 1126 __ LeaveDartFrame(); | 1124 __ LeaveDartFrame(); |
| 1127 __ Ret(); | 1125 __ Ret(); |
| 1128 } else { | 1126 } else { |
| 1129 __ Stop("Wrong number of arguments"); | 1127 __ Stop("Wrong number of arguments"); |
| 1130 } | 1128 } |
| 1131 __ Bind(&correct_num_arguments); | 1129 __ Bind(&correct_num_arguments); |
| 1132 } | 1130 } |
| 1133 // The arguments descriptor is never saved in the absence of optional | |
| 1134 // parameters, since any argument definition test would always yield true. | |
| 1135 ASSERT(saved_args_desc_var == NULL); | |
| 1136 } else { | 1131 } else { |
| 1137 if (saved_args_desc_var != NULL) { | |
| 1138 __ Comment("Save arguments descriptor"); | |
| 1139 const Register kArgumentsDescriptorReg = R4; | |
| 1140 // The saved_args_desc_var is allocated one slot before the first local. | |
| 1141 const intptr_t slot = parsed_function().first_stack_local_index() + 1; | |
| 1142 // If the saved_args_desc_var is captured, it is first moved to the stack | |
| 1143 // and later to the context, once the context is allocated. | |
| 1144 ASSERT(saved_args_desc_var->is_captured() || | |
| 1145 (saved_args_desc_var->index() == slot)); | |
| 1146 __ str(kArgumentsDescriptorReg, Address(FP, slot * kWordSize)); | |
| 1147 } | |
| 1148 CopyParameters(); | 1132 CopyParameters(); |
| 1149 } | 1133 } |
| 1150 | 1134 |
| 1151 // In unoptimized code, initialize (non-argument) stack allocated slots to | 1135 // In unoptimized code, initialize (non-argument) stack allocated slots to |
| 1152 // null. This does not cover the saved_args_desc_var slot. | 1136 // null. |
| 1153 if (!is_optimizing() && (num_locals > 0)) { | 1137 if (!is_optimizing() && (num_locals > 0)) { |
| 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 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); | 1140 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); |
| 1157 for (intptr_t i = 0; i < num_locals; ++i) { | 1141 for (intptr_t i = 0; i < num_locals; ++i) { |
| 1158 // Subtract index i (locals lie at lower addresses than FP). | 1142 // Subtract index i (locals lie at lower addresses than FP). |
| 1159 __ str(R0, Address(FP, (slot_base - i) * kWordSize)); | 1143 __ str(R0, Address(FP, (slot_base - i) * kWordSize)); |
| 1160 } | 1144 } |
| 1161 } | 1145 } |
| 1162 | 1146 |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1798 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1815 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); | 1799 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1816 } | 1800 } |
| 1817 | 1801 |
| 1818 | 1802 |
| 1819 #undef __ | 1803 #undef __ |
| 1820 | 1804 |
| 1821 } // namespace dart | 1805 } // namespace dart |
| 1822 | 1806 |
| 1823 #endif // defined TARGET_ARCH_ARM | 1807 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |