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

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

Issue 2129043004: Don't load arguments descriptor for optimized static calls. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_arm64.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 "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 1048
1049 const int num_fixed_params = function.num_fixed_parameters(); 1049 const int num_fixed_params = function.num_fixed_parameters();
1050 const int num_copied_params = parsed_function().num_copied_params(); 1050 const int num_copied_params = parsed_function().num_copied_params();
1051 const int num_locals = parsed_function().num_stack_locals(); 1051 const int num_locals = parsed_function().num_stack_locals();
1052 1052
1053 // We check the number of passed arguments when we have to copy them due to 1053 // We check the number of passed arguments when we have to copy them due to
1054 // the presence of optional parameters. 1054 // the presence of optional parameters.
1055 // No such checking code is generated if only fixed parameters are declared, 1055 // No such checking code is generated if only fixed parameters are declared,
1056 // unless we are in debug mode or unless we are compiling a closure. 1056 // unless we are in debug mode or unless we are compiling a closure.
1057 if (num_copied_params == 0) { 1057 if (num_copied_params == 0) {
1058 #ifdef DEBUG
1059 ASSERT(!parsed_function().function().HasOptionalParameters());
1060 const bool check_arguments = !flow_graph().IsCompiledForOsr();
1061 #else
1062 const bool check_arguments = 1058 const bool check_arguments =
1063 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); 1059 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr();
1064 #endif
1065 if (check_arguments) { 1060 if (check_arguments) {
1066 __ Comment("Check argument count"); 1061 __ Comment("Check argument count");
1067 // Check that exactly num_fixed arguments are passed in. 1062 // Check that exactly num_fixed arguments are passed in.
1068 Label correct_num_arguments, wrong_num_arguments; 1063 Label correct_num_arguments, wrong_num_arguments;
1069 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); 1064 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
1070 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); 1065 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
1071 __ b(&wrong_num_arguments, NE); 1066 __ b(&wrong_num_arguments, NE);
1072 __ ldr(R1, FieldAddress(R4, 1067 __ ldr(R1, FieldAddress(R4,
1073 ArgumentsDescriptor::positional_count_offset())); 1068 ArgumentsDescriptor::positional_count_offset()));
1074 __ cmp(R0, Operand(R1)); 1069 __ cmp(R0, Operand(R1));
1075 __ b(&correct_num_arguments, EQ); 1070 __ b(&correct_num_arguments, EQ);
1076 __ Bind(&wrong_num_arguments); 1071 __ Bind(&wrong_num_arguments);
1077 if (function.IsClosureFunction()) { 1072 ASSERT(assembler()->constant_pool_allowed());
1078 ASSERT(assembler()->constant_pool_allowed()); 1073 __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack.
1079 __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack. 1074 __ Branch(*StubCode::CallClosureNoSuchMethod_entry());
1080 __ Branch(*StubCode::CallClosureNoSuchMethod_entry()); 1075 // The noSuchMethod call may return to the caller, but not here.
1081 // The noSuchMethod call may return to the caller, but not here.
1082 } else {
1083 __ Stop("Wrong number of arguments");
1084 }
1085 __ Bind(&correct_num_arguments); 1076 __ Bind(&correct_num_arguments);
1086 } 1077 }
1087 } else if (!flow_graph().IsCompiledForOsr()) { 1078 } else if (!flow_graph().IsCompiledForOsr()) {
1088 CopyParameters(); 1079 CopyParameters();
1089 } 1080 }
1090 1081
1091 if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) { 1082 if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
1092 // Load context from the closure object (first argument). 1083 // Load context from the closure object (first argument).
1093 LocalScope* scope = parsed_function().node_sequence()->scope(); 1084 LocalScope* scope = parsed_function().node_sequence()->scope();
1094 LocalVariable* closure_parameter = scope->VariableAt(0); 1085 LocalVariable* closure_parameter = scope->VariableAt(0);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 } 1412 }
1422 1413
1423 1414
1424 void FlowGraphCompiler::EmitOptimizedStaticCall( 1415 void FlowGraphCompiler::EmitOptimizedStaticCall(
1425 const Function& function, 1416 const Function& function,
1426 const Array& arguments_descriptor, 1417 const Array& arguments_descriptor,
1427 intptr_t argument_count, 1418 intptr_t argument_count,
1428 intptr_t deopt_id, 1419 intptr_t deopt_id,
1429 TokenPosition token_pos, 1420 TokenPosition token_pos,
1430 LocationSummary* locs) { 1421 LocationSummary* locs) {
1431 __ LoadObject(R4, arguments_descriptor); 1422 ASSERT(!function.IsClosureFunction());
1423 if (function.HasOptionalParameters()) {
1424 __ LoadObject(R4, arguments_descriptor);
1425 } else {
1426 __ LoadImmediate(R4, 0); // GC safe smi zero because of stub.
1427 }
1432 // Do not use the code from the function, but let the code be patched so that 1428 // Do not use the code from the function, but let the code be patched so that
1433 // we can record the outgoing edges to other code. 1429 // we can record the outgoing edges to other code.
1434 GenerateStaticDartCall(deopt_id, 1430 GenerateStaticDartCall(deopt_id,
1435 token_pos, 1431 token_pos,
1436 *StubCode::CallStaticFunction_entry(), 1432 *StubCode::CallStaticFunction_entry(),
1437 RawPcDescriptors::kOther, 1433 RawPcDescriptors::kOther,
1438 locs, 1434 locs,
1439 function); 1435 function);
1440 __ Drop(argument_count); 1436 __ Drop(argument_count);
1441 } 1437 }
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 DRegister dreg = EvenDRegisterOf(reg); 1990 DRegister dreg = EvenDRegisterOf(reg);
1995 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1991 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1996 } 1992 }
1997 1993
1998 1994
1999 #undef __ 1995 #undef __
2000 1996
2001 } // namespace dart 1997 } // namespace dart
2002 1998
2003 #endif // defined TARGET_ARCH_ARM 1999 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698