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

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

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

Powered by Google App Engine
This is Rietveld 408576698