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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.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: 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
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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = !flow_graph().IsCompiledForOsr(); 1126 const bool check_arguments = !flow_graph().IsCompiledForOsr();
1127 #else 1127 #else
1128 const bool check_arguments = 1128 const bool check_arguments =
1129 (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) && 1129 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr();
1130 !flow_graph().IsCompiledForOsr();
1131 #endif 1130 #endif
1132 if (check_arguments) { 1131 if (check_arguments) {
1133 __ Comment("Check argument count"); 1132 __ Comment("Check argument count");
1134 // Check that exactly num_fixed arguments are passed in. 1133 // Check that exactly num_fixed arguments are passed in.
1135 Label correct_num_arguments, wrong_num_arguments; 1134 Label correct_num_arguments, wrong_num_arguments;
1136 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1135 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1137 __ cmpq(RAX, Immediate(Smi::RawValue(num_fixed_params))); 1136 __ cmpq(RAX, Immediate(Smi::RawValue(num_fixed_params)));
1138 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); 1137 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump);
1139 __ cmpq(RAX, 1138 __ cmpq(RAX,
1140 FieldAddress(R10, 1139 FieldAddress(R10,
1141 ArgumentsDescriptor::positional_count_offset())); 1140 ArgumentsDescriptor::positional_count_offset()));
1142 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); 1141 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump);
1143 1142
1144 __ Bind(&wrong_num_arguments); 1143 __ Bind(&wrong_num_arguments);
1145 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { 1144 if (function.IsClosureFunction()) {
1146 // Invoke noSuchMethod function passing the original function name. 1145 // Invoke noSuchMethod function passing the original function name.
1147 // For closure functions, use "call" as the original name. 1146 // For closure functions, use "call" as the original name.
1148 const String& name = 1147 const String& name =
1149 String::Handle(function.IsClosureFunction() 1148 String::Handle(function.IsClosureFunction()
1150 ? Symbols::Call().raw() 1149 ? Symbols::Call().raw()
1151 : function.name()); 1150 : function.name());
1152 const int kNumArgsChecked = 1; 1151 const int kNumArgsChecked = 1;
1153 const ICData& ic_data = ICData::ZoneHandle( 1152 const ICData& ic_data = ICData::ZoneHandle(
1154 ICData::New(function, name, Object::null_array(), 1153 ICData::New(function, name, Object::null_array(),
1155 Isolate::kNoDeoptId, kNumArgsChecked)); 1154 Isolate::kNoDeoptId, kNumArgsChecked));
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 __ movups(reg, Address(RSP, 0)); 1885 __ movups(reg, Address(RSP, 0));
1887 __ addq(RSP, Immediate(kFpuRegisterSize)); 1886 __ addq(RSP, Immediate(kFpuRegisterSize));
1888 } 1887 }
1889 1888
1890 1889
1891 #undef __ 1890 #undef __
1892 1891
1893 } // namespace dart 1892 } // namespace dart
1894 1893
1895 #endif // defined TARGET_ARCH_X64 1894 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698