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

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

Issue 17571010: Reland: Optimizing noSuchMethod invocation with no arguments. (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
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 // the presence of optional parameters. 1110 // the presence of optional parameters.
1111 // No such checking code is generated if only fixed parameters are declared, 1111 // No such checking code is generated if only fixed parameters are declared,
1112 // unless we are in debug mode or unless we are compiling a closure. 1112 // unless we are in debug mode or unless we are compiling a closure.
1113 LocalVariable* saved_args_desc_var = 1113 LocalVariable* saved_args_desc_var =
1114 parsed_function().GetSavedArgumentsDescriptorVar(); 1114 parsed_function().GetSavedArgumentsDescriptorVar();
1115 if (num_copied_params == 0) { 1115 if (num_copied_params == 0) {
1116 #ifdef DEBUG 1116 #ifdef DEBUG
1117 ASSERT(!parsed_function().function().HasOptionalParameters()); 1117 ASSERT(!parsed_function().function().HasOptionalParameters());
1118 const bool check_arguments = true; 1118 const bool check_arguments = true;
1119 #else 1119 #else
1120 const bool check_arguments = function.IsClosureFunction(); 1120 const bool check_arguments =
1121 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher();
1121 #endif 1122 #endif
1122 if (check_arguments) { 1123 if (check_arguments) {
1123 __ TraceSimMsg("Check argument count"); 1124 __ TraceSimMsg("Check argument count");
1124 __ Comment("Check argument count"); 1125 __ Comment("Check argument count");
1125 // Check that exactly num_fixed arguments are passed in. 1126 // Check that exactly num_fixed arguments are passed in.
1126 Label correct_num_arguments, wrong_num_arguments; 1127 Label correct_num_arguments, wrong_num_arguments;
1127 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); 1128 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
1128 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), 1129 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params),
1129 &wrong_num_arguments); 1130 &wrong_num_arguments);
1130 1131
1131 __ lw(T1, FieldAddress(S4, 1132 __ lw(T1, FieldAddress(S4,
1132 ArgumentsDescriptor::positional_count_offset())); 1133 ArgumentsDescriptor::positional_count_offset()));
1133 __ beq(T0, T1, &correct_num_arguments); 1134 __ beq(T0, T1, &correct_num_arguments);
1134 __ Bind(&wrong_num_arguments); 1135 __ Bind(&wrong_num_arguments);
1135 if (function.IsClosureFunction()) { 1136 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) {
1136 if (StackSize() != 0) { 1137 if (StackSize() != 0) {
1137 // We need to unwind the space we reserved for locals and copied 1138 // We need to unwind the space we reserved for locals and copied
1138 // parameters. The NoSuchMethodFunction stub does not expect to see 1139 // parameters. The NoSuchMethodFunction stub does not expect to see
1139 // that area on the stack. 1140 // that area on the stack.
1140 __ AddImmediate(SP, StackSize() * kWordSize); 1141 __ AddImmediate(SP, StackSize() * kWordSize);
1141 } 1142 }
1142 // The call below has an empty stackmap because we have just 1143 // The call below has an empty stackmap because we have just
1143 // dropped the spill slots. 1144 // dropped the spill slots.
1144 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); 1145 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
1145 1146
1146 // Invoke noSuchMethod function passing "call" as the function name. 1147 // Invoke noSuchMethod function passing the original function name.
1148 // For closure functions, use "call" as the original name.
1149 const String& name =
1150 String::Handle(function.IsClosureFunction()
1151 ? Symbols::Call().raw()
1152 : function.name());
1147 const int kNumArgsChecked = 1; 1153 const int kNumArgsChecked = 1;
1148 const ICData& ic_data = ICData::ZoneHandle( 1154 const ICData& ic_data = ICData::ZoneHandle(
1149 ICData::New(function, Symbols::Call(), Object::null_array(), 1155 ICData::New(function, name, Object::null_array(),
1150 Isolate::kNoDeoptId, kNumArgsChecked)); 1156 Isolate::kNoDeoptId, kNumArgsChecked));
1151 __ LoadObject(S5, ic_data); 1157 __ LoadObject(S5, ic_data);
1152 // FP - 4 : saved PP, object pool pointer of caller. 1158 // FP - 4 : saved PP, object pool pointer of caller.
1153 // FP + 0 : previous frame pointer. 1159 // FP + 0 : previous frame pointer.
1154 // FP + 4 : return address. 1160 // FP + 4 : return address.
1155 // FP + 8 : PC marker, for easy identification of RawInstruction obj. 1161 // FP + 8 : PC marker, for easy identification of RawInstruction obj.
1156 // FP + 12: last argument (arg n-1). 1162 // FP + 12: last argument (arg n-1).
1157 // SP + 0 : saved PP. 1163 // SP + 0 : saved PP.
1158 // SP + 16 + 4*(n-1) : first argument (arg 0). 1164 // SP + 16 + 4*(n-1) : first argument (arg 0).
1159 // S5 : ic-data. 1165 // S5 : ic-data.
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 __ AddImmediate(SP, kDoubleSize); 1933 __ AddImmediate(SP, kDoubleSize);
1928 } 1934 }
1929 1935
1930 1936
1931 #undef __ 1937 #undef __
1932 1938
1933 1939
1934 } // namespace dart 1940 } // namespace dart
1935 1941
1936 #endif // defined TARGET_ARCH_MIPS 1942 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698