Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.cc

Issue 18209024: Correct handling of named optional parameters with noSuchMethod invocations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1118
1119 // We check the number of passed arguments when we have to copy them due to 1119 // We check the number of passed arguments when we have to copy them due to
1120 // the presence of optional parameters. 1120 // the presence of optional parameters.
1121 // No such checking code is generated if only fixed parameters are declared, 1121 // No such checking code is generated if only fixed parameters are declared,
1122 // unless we are in debug mode or unless we are compiling a closure. 1122 // unless we are in debug mode or unless we are compiling a closure.
1123 if (num_copied_params == 0) { 1123 if (num_copied_params == 0) {
1124 #ifdef DEBUG 1124 #ifdef DEBUG
1125 ASSERT(!parsed_function().function().HasOptionalParameters()); 1125 ASSERT(!parsed_function().function().HasOptionalParameters());
1126 const bool check_arguments = true; 1126 const bool check_arguments = true;
1127 #else 1127 #else
1128 const bool check_arguments = 1128 const bool check_arguments = function.IsClosureFunction();
1129 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher();
1130 #endif 1129 #endif
1131 if (check_arguments) { 1130 if (check_arguments) {
1132 __ Comment("Check argument count"); 1131 __ Comment("Check argument count");
1133 // Check that exactly num_fixed arguments are passed in. 1132 // Check that exactly num_fixed arguments are passed in.
1134 Label correct_num_arguments, wrong_num_arguments; 1133 Label correct_num_arguments, wrong_num_arguments;
1135 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); 1134 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
1136 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); 1135 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
1137 __ b(&wrong_num_arguments, NE); 1136 __ b(&wrong_num_arguments, NE);
1138 __ ldr(R1, FieldAddress(R4, 1137 __ ldr(R1, FieldAddress(R4,
1139 ArgumentsDescriptor::positional_count_offset())); 1138 ArgumentsDescriptor::positional_count_offset()));
1140 __ cmp(R0, ShifterOperand(R1)); 1139 __ cmp(R0, ShifterOperand(R1));
1141 __ b(&correct_num_arguments, EQ); 1140 __ b(&correct_num_arguments, EQ);
1142 __ Bind(&wrong_num_arguments); 1141 __ Bind(&wrong_num_arguments);
1143 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { 1142 if (function.IsClosureFunction()) {
1144 // Invoke noSuchMethod function passing the original function name. 1143 // Invoke noSuchMethod function passing the original function name.
1145 // For closure functions, use "call" as the original name. 1144 // For closure functions, use "call" as the original name.
1146 const String& name = 1145 const String& name =
1147 String::Handle(function.IsClosureFunction() 1146 String::Handle(function.IsClosureFunction()
1148 ? Symbols::Call().raw() 1147 ? Symbols::Call().raw()
1149 : function.name()); 1148 : function.name());
1150 const int kNumArgsChecked = 1; 1149 const int kNumArgsChecked = 1;
1151 const ICData& ic_data = ICData::ZoneHandle( 1150 const ICData& ic_data = ICData::ZoneHandle(
1152 ICData::New(function, name, Object::null_array(), 1151 ICData::New(function, name, Object::null_array(),
1153 Isolate::kNoDeoptId, kNumArgsChecked)); 1152 Isolate::kNoDeoptId, kNumArgsChecked));
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1838 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1840 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); 1839 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex));
1841 } 1840 }
1842 1841
1843 1842
1844 #undef __ 1843 #undef __
1845 1844
1846 } // namespace dart 1845 } // namespace dart
1847 1846
1848 #endif // defined TARGET_ARCH_ARM 1847 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698