| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 // No such checking code is generated if only fixed parameters are declared, | 1143 // No such checking code is generated if only fixed parameters are declared, |
| 1144 // unless we are in debug mode or unless we are compiling a closure. | 1144 // unless we are in debug mode or unless we are compiling a closure. |
| 1145 LocalVariable* saved_args_desc_var = | 1145 LocalVariable* saved_args_desc_var = |
| 1146 parsed_function().GetSavedArgumentsDescriptorVar(); | 1146 parsed_function().GetSavedArgumentsDescriptorVar(); |
| 1147 if (num_copied_params == 0) { | 1147 if (num_copied_params == 0) { |
| 1148 #ifdef DEBUG | 1148 #ifdef DEBUG |
| 1149 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1149 ASSERT(!parsed_function().function().HasOptionalParameters()); |
| 1150 const bool check_arguments = !flow_graph().IsCompiledForOsr(); | 1150 const bool check_arguments = !flow_graph().IsCompiledForOsr(); |
| 1151 #else | 1151 #else |
| 1152 const bool check_arguments = | 1152 const bool check_arguments = |
| 1153 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); | 1153 (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) && |
| 1154 !flow_graph().IsCompiledForOsr(); |
| 1154 #endif | 1155 #endif |
| 1155 if (check_arguments) { | 1156 if (check_arguments) { |
| 1156 __ Comment("Check argument count"); | 1157 __ Comment("Check argument count"); |
| 1157 // Check that exactly num_fixed arguments are passed in. | 1158 // Check that exactly num_fixed arguments are passed in. |
| 1158 Label correct_num_arguments, wrong_num_arguments; | 1159 Label correct_num_arguments, wrong_num_arguments; |
| 1159 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); | 1160 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); |
| 1160 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params))); | 1161 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params))); |
| 1161 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); | 1162 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); |
| 1162 __ cmpl(EAX, | 1163 __ cmpl(EAX, |
| 1163 FieldAddress(EDX, | 1164 FieldAddress(EDX, |
| 1164 ArgumentsDescriptor::positional_count_offset())); | 1165 ArgumentsDescriptor::positional_count_offset())); |
| 1165 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); | 1166 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); |
| 1166 | 1167 |
| 1167 __ Bind(&wrong_num_arguments); | 1168 __ Bind(&wrong_num_arguments); |
| 1168 if (function.IsClosureFunction()) { | 1169 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { |
| 1169 if (StackSize() != 0) { | 1170 if (StackSize() != 0) { |
| 1170 // We need to unwind the space we reserved for locals and copied | 1171 // We need to unwind the space we reserved for locals and copied |
| 1171 // parameters. The NoSuchMethodFunction stub does not expect to see | 1172 // parameters. The NoSuchMethodFunction stub does not expect to see |
| 1172 // that area on the stack. | 1173 // that area on the stack. |
| 1173 __ addl(ESP, Immediate(StackSize() * kWordSize)); | 1174 __ addl(ESP, Immediate(StackSize() * kWordSize)); |
| 1174 } | 1175 } |
| 1175 // The call below has an empty stackmap because we have just | 1176 // The call below has an empty stackmap because we have just |
| 1176 // dropped the spill slots. | 1177 // dropped the spill slots. |
| 1177 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 1178 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); |
| 1178 | 1179 |
| 1179 // Invoke noSuchMethod function passing "call" as the function name. | 1180 // Invoke noSuchMethod function passing the original function name. |
| 1181 // For closure functions, use "call" as the original name. |
| 1182 const String& name = |
| 1183 String::Handle(function.IsClosureFunction() |
| 1184 ? Symbols::Call().raw() |
| 1185 : function.name()); |
| 1180 const int kNumArgsChecked = 1; | 1186 const int kNumArgsChecked = 1; |
| 1181 const ICData& ic_data = ICData::ZoneHandle( | 1187 const ICData& ic_data = ICData::ZoneHandle( |
| 1182 ICData::New(function, Symbols::Call(), Object::null_array(), | 1188 ICData::New(function, name, Object::null_array(), |
| 1183 Isolate::kNoDeoptId, kNumArgsChecked)); | 1189 Isolate::kNoDeoptId, kNumArgsChecked)); |
| 1184 __ LoadObject(ECX, ic_data); | 1190 __ LoadObject(ECX, ic_data); |
| 1185 // EBP - 4 : PC marker, for easy identification of RawInstruction obj. | 1191 // EBP - 4 : PC marker, for easy identification of RawInstruction obj. |
| 1186 // EBP : points to previous frame pointer. | 1192 // EBP : points to previous frame pointer. |
| 1187 // EBP + 4 : points to return address. | 1193 // EBP + 4 : points to return address. |
| 1188 // EBP + 8 : address of last argument (arg n-1). | 1194 // EBP + 8 : address of last argument (arg n-1). |
| 1189 // ESP + 8 + 4*(n-1) : address of first argument (arg 0). | 1195 // ESP + 8 + 4*(n-1) : address of first argument (arg 0). |
| 1190 // ECX : ic-data. | 1196 // ECX : ic-data. |
| 1191 // EDX : arguments descriptor array. | 1197 // EDX : arguments descriptor array. |
| 1192 __ call(&StubCode::CallNoSuchMethodFunctionLabel()); | 1198 __ call(&StubCode::CallNoSuchMethodFunctionLabel()); |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 __ movups(reg, Address(ESP, 0)); | 1930 __ movups(reg, Address(ESP, 0)); |
| 1925 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1931 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1926 } | 1932 } |
| 1927 | 1933 |
| 1928 | 1934 |
| 1929 #undef __ | 1935 #undef __ |
| 1930 | 1936 |
| 1931 } // namespace dart | 1937 } // namespace dart |
| 1932 | 1938 |
| 1933 #endif // defined TARGET_ARCH_IA32 | 1939 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |