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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 // We check the number of passed arguments when we have to copy them due to | 1124 // We check the number of passed arguments when we have to copy them due to |
1125 // the presence of optional parameters. | 1125 // the presence of optional parameters. |
1126 // No such checking code is generated if only fixed parameters are declared, | 1126 // No such checking code is generated if only fixed parameters are declared, |
1127 // unless we are in debug mode or unless we are compiling a closure. | 1127 // unless we are in debug mode or unless we are compiling a closure. |
1128 if (num_copied_params == 0) { | 1128 if (num_copied_params == 0) { |
1129 #ifdef DEBUG | 1129 #ifdef DEBUG |
1130 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1130 ASSERT(!parsed_function().function().HasOptionalParameters()); |
1131 const bool check_arguments = !flow_graph().IsCompiledForOsr(); | 1131 const bool check_arguments = !flow_graph().IsCompiledForOsr(); |
1132 #else | 1132 #else |
1133 const bool check_arguments = | 1133 const bool check_arguments = |
1134 (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) && | 1134 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); |
1135 !flow_graph().IsCompiledForOsr(); | |
1136 #endif | 1135 #endif |
1137 if (check_arguments) { | 1136 if (check_arguments) { |
1138 __ Comment("Check argument count"); | 1137 __ Comment("Check argument count"); |
1139 // Check that exactly num_fixed arguments are passed in. | 1138 // Check that exactly num_fixed arguments are passed in. |
1140 Label correct_num_arguments, wrong_num_arguments; | 1139 Label correct_num_arguments, wrong_num_arguments; |
1141 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); | 1140 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); |
1142 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params))); | 1141 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params))); |
1143 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); | 1142 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); |
1144 __ cmpl(EAX, | 1143 __ cmpl(EAX, |
1145 FieldAddress(EDX, | 1144 FieldAddress(EDX, |
1146 ArgumentsDescriptor::positional_count_offset())); | 1145 ArgumentsDescriptor::positional_count_offset())); |
1147 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); | 1146 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); |
1148 | 1147 |
1149 __ Bind(&wrong_num_arguments); | 1148 __ Bind(&wrong_num_arguments); |
1150 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { | 1149 if (function.IsClosureFunction()) { |
1151 // Invoke noSuchMethod function passing the original function name. | 1150 // Invoke noSuchMethod function passing the original function name. |
1152 // For closure functions, use "call" as the original name. | 1151 // For closure functions, use "call" as the original name. |
1153 const String& name = | 1152 const String& name = |
1154 String::Handle(function.IsClosureFunction() | 1153 String::Handle(function.IsClosureFunction() |
1155 ? Symbols::Call().raw() | 1154 ? Symbols::Call().raw() |
1156 : function.name()); | 1155 : function.name()); |
1157 const int kNumArgsChecked = 1; | 1156 const int kNumArgsChecked = 1; |
1158 const ICData& ic_data = ICData::ZoneHandle( | 1157 const ICData& ic_data = ICData::ZoneHandle( |
1159 ICData::New(function, name, Object::null_array(), | 1158 ICData::New(function, name, Object::null_array(), |
1160 Isolate::kNoDeoptId, kNumArgsChecked)); | 1159 Isolate::kNoDeoptId, kNumArgsChecked)); |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 __ movups(reg, Address(ESP, 0)); | 1906 __ movups(reg, Address(ESP, 0)); |
1908 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1907 __ addl(ESP, Immediate(kFpuRegisterSize)); |
1909 } | 1908 } |
1910 | 1909 |
1911 | 1910 |
1912 #undef __ | 1911 #undef __ |
1913 | 1912 |
1914 } // namespace dart | 1913 } // namespace dart |
1915 | 1914 |
1916 #endif // defined TARGET_ARCH_IA32 | 1915 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |