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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.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_mips.cc ('k') | runtime/vm/flow_graph_optimizer.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_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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 // No such checking code is generated if only fixed parameters are declared, 1137 // No such checking code is generated if only fixed parameters are declared,
1138 // unless we are in debug mode or unless we are compiling a closure. 1138 // unless we are in debug mode or unless we are compiling a closure.
1139 LocalVariable* saved_args_desc_var = 1139 LocalVariable* saved_args_desc_var =
1140 parsed_function().GetSavedArgumentsDescriptorVar(); 1140 parsed_function().GetSavedArgumentsDescriptorVar();
1141 if (num_copied_params == 0) { 1141 if (num_copied_params == 0) {
1142 #ifdef DEBUG 1142 #ifdef DEBUG
1143 ASSERT(!parsed_function().function().HasOptionalParameters()); 1143 ASSERT(!parsed_function().function().HasOptionalParameters());
1144 const bool check_arguments = !flow_graph().IsCompiledForOsr(); 1144 const bool check_arguments = !flow_graph().IsCompiledForOsr();
1145 #else 1145 #else
1146 const bool check_arguments = 1146 const bool check_arguments =
1147 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); 1147 (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) &&
1148 !flow_graph().IsCompiledForOsr();
1148 #endif 1149 #endif
1149 if (check_arguments) { 1150 if (check_arguments) {
1150 __ Comment("Check argument count"); 1151 __ Comment("Check argument count");
1151 // Check that exactly num_fixed arguments are passed in. 1152 // Check that exactly num_fixed arguments are passed in.
1152 Label correct_num_arguments, wrong_num_arguments; 1153 Label correct_num_arguments, wrong_num_arguments;
1153 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1154 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1154 __ cmpq(RAX, Immediate(Smi::RawValue(num_fixed_params))); 1155 __ cmpq(RAX, Immediate(Smi::RawValue(num_fixed_params)));
1155 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); 1156 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump);
1156 __ cmpq(RAX, 1157 __ cmpq(RAX,
1157 FieldAddress(R10, 1158 FieldAddress(R10,
1158 ArgumentsDescriptor::positional_count_offset())); 1159 ArgumentsDescriptor::positional_count_offset()));
1159 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); 1160 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump);
1160 1161
1161 __ Bind(&wrong_num_arguments); 1162 __ Bind(&wrong_num_arguments);
1162 if (function.IsClosureFunction()) { 1163 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) {
1163 if (StackSize() != 0) { 1164 if (StackSize() != 0) {
1164 // We need to unwind the space we reserved for locals and copied 1165 // We need to unwind the space we reserved for locals and copied
1165 // parameters. The NoSuchMethodFunction stub does not expect to see 1166 // parameters. The NoSuchMethodFunction stub does not expect to see
1166 // that area on the stack. 1167 // that area on the stack.
1167 __ addq(RSP, Immediate(StackSize() * kWordSize)); 1168 __ addq(RSP, Immediate(StackSize() * kWordSize));
1168 } 1169 }
1169 // The call below has an empty stackmap because we have just 1170 // The call below has an empty stackmap because we have just
1170 // dropped the spill slots. 1171 // dropped the spill slots.
1171 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); 1172 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
1172 1173
1173 // Invoke noSuchMethod function passing "call" as the function name. 1174 // Invoke noSuchMethod function passing the original function name.
1175 // For closure functions, use "call" as the original name.
1176 const String& name =
1177 String::Handle(function.IsClosureFunction()
1178 ? Symbols::Call().raw()
1179 : function.name());
1174 const int kNumArgsChecked = 1; 1180 const int kNumArgsChecked = 1;
1175 const ICData& ic_data = ICData::ZoneHandle( 1181 const ICData& ic_data = ICData::ZoneHandle(
1176 ICData::New(function, Symbols::Call(), 1182 ICData::New(function, name, Isolate::kNoDeoptId, kNumArgsChecked));
1177 Isolate::kNoDeoptId, kNumArgsChecked));
1178 __ LoadObject(RBX, ic_data); 1183 __ LoadObject(RBX, ic_data);
1179 // RBP - 8 : PC marker, for easy identification of RawInstruction obj. 1184 // RBP - 8 : PC marker, for easy identification of RawInstruction obj.
1180 // RBP : points to previous frame pointer. 1185 // RBP : points to previous frame pointer.
1181 // RBP + 8 : points to return address. 1186 // RBP + 8 : points to return address.
1182 // RBP + 16 : address of last argument (arg n-1). 1187 // RBP + 16 : address of last argument (arg n-1).
1183 // RSP + 16 + 8*(n-1) : address of first argument (arg 0). 1188 // RSP + 16 + 8*(n-1) : address of first argument (arg 0).
1184 // RBX : ic-data. 1189 // RBX : ic-data.
1185 // R10 : arguments descriptor array. 1190 // R10 : arguments descriptor array.
1186 __ call(&StubCode::CallNoSuchMethodFunctionLabel()); 1191 __ call(&StubCode::CallNoSuchMethodFunctionLabel());
1187 // Emit descriptors in order to provide correct postion in stacktrace. 1192 // Emit descriptors in order to provide correct postion in stacktrace.
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 __ movups(reg, Address(RSP, 0)); 1909 __ movups(reg, Address(RSP, 0));
1905 __ addq(RSP, Immediate(kFpuRegisterSize)); 1910 __ addq(RSP, Immediate(kFpuRegisterSize));
1906 } 1911 }
1907 1912
1908 1913
1909 #undef __ 1914 #undef __
1910 1915
1911 } // namespace dart 1916 } // namespace dart
1912 1917
1913 #endif // defined TARGET_ARCH_X64 1918 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698