| 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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 const Function& function = parsed_function().function(); | 1028 const Function& function = parsed_function().function(); |
| 1029 | 1029 |
| 1030 const int num_fixed_params = function.num_fixed_parameters(); | 1030 const int num_fixed_params = function.num_fixed_parameters(); |
| 1031 const int num_copied_params = parsed_function().num_copied_params(); | 1031 const int num_copied_params = parsed_function().num_copied_params(); |
| 1032 const int num_locals = parsed_function().num_stack_locals(); | 1032 const int num_locals = parsed_function().num_stack_locals(); |
| 1033 | 1033 |
| 1034 // We check the number of passed arguments when we have to copy them due to | 1034 // We check the number of passed arguments when we have to copy them due to |
| 1035 // the presence of optional parameters. | 1035 // the presence of optional parameters. |
| 1036 // No such checking code is generated if only fixed parameters are declared, | 1036 // No such checking code is generated if only fixed parameters are declared, |
| 1037 // unless we are in debug mode or unless we are compiling a closure. | 1037 // unless we are in debug mode or unless we are compiling a closure. |
| 1038 LocalVariable* saved_args_desc_var = | |
| 1039 parsed_function().GetSavedArgumentsDescriptorVar(); | |
| 1040 if (num_copied_params == 0) { | 1038 if (num_copied_params == 0) { |
| 1041 #ifdef DEBUG | 1039 #ifdef DEBUG |
| 1042 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1040 ASSERT(!parsed_function().function().HasOptionalParameters()); |
| 1043 const bool check_arguments = true; | 1041 const bool check_arguments = true; |
| 1044 #else | 1042 #else |
| 1045 const bool check_arguments = | 1043 const bool check_arguments = |
| 1046 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); | 1044 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); |
| 1047 #endif | 1045 #endif |
| 1048 if (check_arguments) { | 1046 if (check_arguments) { |
| 1049 __ Comment("Check argument count"); | 1047 __ Comment("Check argument count"); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1071 __ LoadObject(R5, ic_data); | 1069 __ LoadObject(R5, ic_data); |
| 1072 __ LeaveDartFrame(); // The arguments are still on the stack. | 1070 __ LeaveDartFrame(); // The arguments are still on the stack. |
| 1073 __ Branch(&StubCode::CallNoSuchMethodFunctionLabel()); | 1071 __ Branch(&StubCode::CallNoSuchMethodFunctionLabel()); |
| 1074 // The noSuchMethod call may return to the caller, but not here. | 1072 // The noSuchMethod call may return to the caller, but not here. |
| 1075 __ bkpt(0); | 1073 __ bkpt(0); |
| 1076 } else { | 1074 } else { |
| 1077 __ Stop("Wrong number of arguments"); | 1075 __ Stop("Wrong number of arguments"); |
| 1078 } | 1076 } |
| 1079 __ Bind(&correct_num_arguments); | 1077 __ Bind(&correct_num_arguments); |
| 1080 } | 1078 } |
| 1081 // The arguments descriptor is never saved in the absence of optional | |
| 1082 // parameters, since any argument definition test would always yield true. | |
| 1083 ASSERT(saved_args_desc_var == NULL); | |
| 1084 } else { | 1079 } else { |
| 1085 if (saved_args_desc_var != NULL) { | |
| 1086 __ Comment("Save arguments descriptor"); | |
| 1087 const Register kArgumentsDescriptorReg = R4; | |
| 1088 // The saved_args_desc_var is allocated one slot before the first local. | |
| 1089 const intptr_t slot = parsed_function().first_stack_local_index() + 1; | |
| 1090 // If the saved_args_desc_var is captured, it is first moved to the stack | |
| 1091 // and later to the context, once the context is allocated. | |
| 1092 ASSERT(saved_args_desc_var->is_captured() || | |
| 1093 (saved_args_desc_var->index() == slot)); | |
| 1094 __ str(kArgumentsDescriptorReg, Address(FP, slot * kWordSize)); | |
| 1095 } | |
| 1096 CopyParameters(); | 1080 CopyParameters(); |
| 1097 } | 1081 } |
| 1098 | 1082 |
| 1099 // In unoptimized code, initialize (non-argument) stack allocated slots to | 1083 // In unoptimized code, initialize (non-argument) stack allocated slots to |
| 1100 // null. This does not cover the saved_args_desc_var slot. | 1084 // null. |
| 1101 if (!is_optimizing() && (num_locals > 0)) { | 1085 if (!is_optimizing() && (num_locals > 0)) { |
| 1102 __ Comment("Initialize spill slots"); | 1086 __ Comment("Initialize spill slots"); |
| 1103 const intptr_t slot_base = parsed_function().first_stack_local_index(); | 1087 const intptr_t slot_base = parsed_function().first_stack_local_index(); |
| 1104 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); | 1088 __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null())); |
| 1105 for (intptr_t i = 0; i < num_locals; ++i) { | 1089 for (intptr_t i = 0; i < num_locals; ++i) { |
| 1106 // Subtract index i (locals lie at lower addresses than FP). | 1090 // Subtract index i (locals lie at lower addresses than FP). |
| 1107 __ str(R0, Address(FP, (slot_base - i) * kWordSize)); | 1091 __ str(R0, Address(FP, (slot_base - i) * kWordSize)); |
| 1108 } | 1092 } |
| 1109 } | 1093 } |
| 1110 | 1094 |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1746 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1763 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); | 1747 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1764 } | 1748 } |
| 1765 | 1749 |
| 1766 | 1750 |
| 1767 #undef __ | 1751 #undef __ |
| 1768 | 1752 |
| 1769 } // namespace dart | 1753 } // namespace dart |
| 1770 | 1754 |
| 1771 #endif // defined TARGET_ARCH_ARM | 1755 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |