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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.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/debugger.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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 // the presence of optional parameters. 1060 // the presence of optional parameters.
1061 // No such checking code is generated if only fixed parameters are declared, 1061 // No such checking code is generated if only fixed parameters are declared,
1062 // unless we are in debug mode or unless we are compiling a closure. 1062 // unless we are in debug mode or unless we are compiling a closure.
1063 LocalVariable* saved_args_desc_var = 1063 LocalVariable* saved_args_desc_var =
1064 parsed_function().GetSavedArgumentsDescriptorVar(); 1064 parsed_function().GetSavedArgumentsDescriptorVar();
1065 if (num_copied_params == 0) { 1065 if (num_copied_params == 0) {
1066 #ifdef DEBUG 1066 #ifdef DEBUG
1067 ASSERT(!parsed_function().function().HasOptionalParameters()); 1067 ASSERT(!parsed_function().function().HasOptionalParameters());
1068 const bool check_arguments = true; 1068 const bool check_arguments = true;
1069 #else 1069 #else
1070 const bool check_arguments = function.IsClosureFunction(); 1070 const bool check_arguments =
1071 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher();
1071 #endif 1072 #endif
1072 if (check_arguments) { 1073 if (check_arguments) {
1073 __ Comment("Check argument count"); 1074 __ Comment("Check argument count");
1074 // Check that exactly num_fixed arguments are passed in. 1075 // Check that exactly num_fixed arguments are passed in.
1075 Label correct_num_arguments, wrong_num_arguments; 1076 Label correct_num_arguments, wrong_num_arguments;
1076 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); 1077 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
1077 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); 1078 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
1078 __ b(&wrong_num_arguments, NE); 1079 __ b(&wrong_num_arguments, NE);
1079 __ ldr(R1, FieldAddress(R4, 1080 __ ldr(R1, FieldAddress(R4,
1080 ArgumentsDescriptor::positional_count_offset())); 1081 ArgumentsDescriptor::positional_count_offset()));
1081 __ cmp(R0, ShifterOperand(R1)); 1082 __ cmp(R0, ShifterOperand(R1));
1082 __ b(&correct_num_arguments, EQ); 1083 __ b(&correct_num_arguments, EQ);
1083 __ Bind(&wrong_num_arguments); 1084 __ Bind(&wrong_num_arguments);
1084 if (function.IsClosureFunction()) { 1085 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) {
1085 if (StackSize() != 0) { 1086 if (StackSize() != 0) {
1086 // We need to unwind the space we reserved for locals and copied 1087 // We need to unwind the space we reserved for locals and copied
1087 // parameters. The NoSuchMethodFunction stub does not expect to see 1088 // parameters. The NoSuchMethodFunction stub does not expect to see
1088 // that area on the stack. 1089 // that area on the stack.
1089 __ AddImmediate(SP, StackSize() * kWordSize); 1090 __ AddImmediate(SP, StackSize() * kWordSize);
1090 } 1091 }
1091 // The call below has an empty stackmap because we have just 1092 // The call below has an empty stackmap because we have just
1092 // dropped the spill slots. 1093 // dropped the spill slots.
1093 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); 1094 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
1094 1095
1095 // Invoke noSuchMethod function passing "call" as the function name. 1096 // Invoke noSuchMethod function passing the original function name.
1097 // For closure functions, use "call" as the original name.
1098 const String& name =
1099 String::Handle(function.IsClosureFunction()
1100 ? Symbols::Call().raw()
1101 : function.name());
1096 const int kNumArgsChecked = 1; 1102 const int kNumArgsChecked = 1;
1097 const ICData& ic_data = ICData::ZoneHandle( 1103 const ICData& ic_data = ICData::ZoneHandle(
1098 ICData::New(function, Symbols::Call(), 1104 ICData::New(function, name, Isolate::kNoDeoptId, kNumArgsChecked));
1099 Isolate::kNoDeoptId, kNumArgsChecked));
1100 __ LoadObject(R5, ic_data); 1105 __ LoadObject(R5, ic_data);
1101 // FP - 4 : saved PP, object pool pointer of caller. 1106 // FP - 4 : saved PP, object pool pointer of caller.
1102 // FP + 0 : previous frame pointer. 1107 // FP + 0 : previous frame pointer.
1103 // FP + 4 : return address. 1108 // FP + 4 : return address.
1104 // FP + 8 : PC marker, for easy identification of RawInstruction obj. 1109 // FP + 8 : PC marker, for easy identification of RawInstruction obj.
1105 // FP + 12: last argument (arg n-1). 1110 // FP + 12: last argument (arg n-1).
1106 // SP + 0 : saved PP. 1111 // SP + 0 : saved PP.
1107 // SP + 16 + 4*(n-1) : first argument (arg 0). 1112 // SP + 16 + 4*(n-1) : first argument (arg 0).
1108 // R5 : ic-data. 1113 // R5 : ic-data.
1109 // R4 : arguments descriptor array. 1114 // R4 : arguments descriptor array.
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 1787 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
1783 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); 1788 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex));
1784 } 1789 }
1785 1790
1786 1791
1787 #undef __ 1792 #undef __
1788 1793
1789 } // namespace dart 1794 } // namespace dart
1790 1795
1791 #endif // defined TARGET_ARCH_ARM 1796 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698