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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = | 1113 LocalVariable* saved_args_desc_var = |
1114 parsed_function().GetSavedArgumentsDescriptorVar(); | 1114 parsed_function().GetSavedArgumentsDescriptorVar(); |
1115 if (num_copied_params == 0) { | 1115 if (num_copied_params == 0) { |
1116 #ifdef DEBUG | 1116 #ifdef DEBUG |
1117 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1117 ASSERT(!parsed_function().function().HasOptionalParameters()); |
1118 const bool check_arguments = true; | 1118 const bool check_arguments = true; |
1119 #else | 1119 #else |
1120 const bool check_arguments = | 1120 const bool check_arguments = function.IsClosureFunction(); |
1121 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); | |
1122 #endif | 1121 #endif |
1123 if (check_arguments) { | 1122 if (check_arguments) { |
1124 __ TraceSimMsg("Check argument count"); | 1123 __ TraceSimMsg("Check argument count"); |
1125 __ Comment("Check argument count"); | 1124 __ Comment("Check argument count"); |
1126 // Check that exactly num_fixed arguments are passed in. | 1125 // Check that exactly num_fixed arguments are passed in. |
1127 Label correct_num_arguments, wrong_num_arguments; | 1126 Label correct_num_arguments, wrong_num_arguments; |
1128 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | 1127 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); |
1129 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), | 1128 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), |
1130 &wrong_num_arguments); | 1129 &wrong_num_arguments); |
1131 | 1130 |
1132 __ lw(T1, FieldAddress(S4, | 1131 __ lw(T1, FieldAddress(S4, |
1133 ArgumentsDescriptor::positional_count_offset())); | 1132 ArgumentsDescriptor::positional_count_offset())); |
1134 __ beq(T0, T1, &correct_num_arguments); | 1133 __ beq(T0, T1, &correct_num_arguments); |
1135 __ Bind(&wrong_num_arguments); | 1134 __ Bind(&wrong_num_arguments); |
1136 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { | 1135 if (function.IsClosureFunction()) { |
1137 if (StackSize() != 0) { | 1136 if (StackSize() != 0) { |
1138 // We need to unwind the space we reserved for locals and copied | 1137 // We need to unwind the space we reserved for locals and copied |
1139 // parameters. The NoSuchMethodFunction stub does not expect to see | 1138 // parameters. The NoSuchMethodFunction stub does not expect to see |
1140 // that area on the stack. | 1139 // that area on the stack. |
1141 __ AddImmediate(SP, StackSize() * kWordSize); | 1140 __ AddImmediate(SP, StackSize() * kWordSize); |
1142 } | 1141 } |
1143 // The call below has an empty stackmap because we have just | 1142 // The call below has an empty stackmap because we have just |
1144 // dropped the spill slots. | 1143 // dropped the spill slots. |
1145 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 1144 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); |
1146 | 1145 |
1147 // Invoke noSuchMethod function passing the original function name. | 1146 // Invoke noSuchMethod function passing "call" as the function name. |
1148 // For closure functions, use "call" as the original name. | |
1149 const String& name = | |
1150 String::Handle(function.IsClosureFunction() | |
1151 ? Symbols::Call().raw() | |
1152 : function.name()); | |
1153 const int kNumArgsChecked = 1; | 1147 const int kNumArgsChecked = 1; |
1154 const ICData& ic_data = ICData::ZoneHandle( | 1148 const ICData& ic_data = ICData::ZoneHandle( |
1155 ICData::New(function, name, Object::null_array(), | 1149 ICData::New(function, Symbols::Call(), Object::null_array(), |
1156 Isolate::kNoDeoptId, kNumArgsChecked)); | 1150 Isolate::kNoDeoptId, kNumArgsChecked)); |
1157 __ LoadObject(S5, ic_data); | 1151 __ LoadObject(S5, ic_data); |
1158 // FP - 4 : saved PP, object pool pointer of caller. | 1152 // FP - 4 : saved PP, object pool pointer of caller. |
1159 // FP + 0 : previous frame pointer. | 1153 // FP + 0 : previous frame pointer. |
1160 // FP + 4 : return address. | 1154 // FP + 4 : return address. |
1161 // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 1155 // FP + 8 : PC marker, for easy identification of RawInstruction obj. |
1162 // FP + 12: last argument (arg n-1). | 1156 // FP + 12: last argument (arg n-1). |
1163 // SP + 0 : saved PP. | 1157 // SP + 0 : saved PP. |
1164 // SP + 16 + 4*(n-1) : first argument (arg 0). | 1158 // SP + 16 + 4*(n-1) : first argument (arg 0). |
1165 // S5 : ic-data. | 1159 // S5 : ic-data. |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 __ AddImmediate(SP, kDoubleSize); | 1927 __ AddImmediate(SP, kDoubleSize); |
1934 } | 1928 } |
1935 | 1929 |
1936 | 1930 |
1937 #undef __ | 1931 #undef __ |
1938 | 1932 |
1939 | 1933 |
1940 } // namespace dart | 1934 } // namespace dart |
1941 | 1935 |
1942 #endif // defined TARGET_ARCH_MIPS | 1936 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |