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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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 | « runtime/vm/flow_graph_compiler_arm64.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 "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1047
1048 const int num_fixed_params = function.num_fixed_parameters(); 1048 const int num_fixed_params = function.num_fixed_parameters();
1049 const int num_copied_params = parsed_function().num_copied_params(); 1049 const int num_copied_params = parsed_function().num_copied_params();
1050 const int num_locals = parsed_function().num_stack_locals(); 1050 const int num_locals = parsed_function().num_stack_locals();
1051 1051
1052 // We check the number of passed arguments when we have to copy them due to 1052 // We check the number of passed arguments when we have to copy them due to
1053 // the presence of optional parameters. 1053 // the presence of optional parameters.
1054 // No such checking code is generated if only fixed parameters are declared, 1054 // No such checking code is generated if only fixed parameters are declared,
1055 // unless we are in debug mode or unless we are compiling a closure. 1055 // unless we are in debug mode or unless we are compiling a closure.
1056 if (num_copied_params == 0) { 1056 if (num_copied_params == 0) {
1057 #ifdef DEBUG
1058 ASSERT(!parsed_function().function().HasOptionalParameters());
1059 const bool check_arguments = !flow_graph().IsCompiledForOsr();
1060 #else
1061 const bool check_arguments = 1057 const bool check_arguments =
1062 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); 1058 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr();
1063 #endif
1064 if (check_arguments) { 1059 if (check_arguments) {
1065 __ Comment("Check argument count"); 1060 __ Comment("Check argument count");
1066 // Check that exactly num_fixed arguments are passed in. 1061 // Check that exactly num_fixed arguments are passed in.
1067 Label correct_num_arguments, wrong_num_arguments; 1062 Label correct_num_arguments, wrong_num_arguments;
1068 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 1063 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
1069 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params))); 1064 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params)));
1070 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); 1065 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump);
1071 __ cmpl(EAX, 1066 __ cmpl(EAX,
1072 FieldAddress(EDX, 1067 FieldAddress(EDX,
1073 ArgumentsDescriptor::positional_count_offset())); 1068 ArgumentsDescriptor::positional_count_offset()));
1074 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); 1069 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump);
1075 1070
1076 __ Bind(&wrong_num_arguments); 1071 __ Bind(&wrong_num_arguments);
1077 if (function.IsClosureFunction()) { 1072 __ LeaveFrame(); // The arguments are still on the stack.
1078 __ LeaveFrame(); // The arguments are still on the stack. 1073 __ Jmp(*StubCode::CallClosureNoSuchMethod_entry());
1079 __ Jmp(*StubCode::CallClosureNoSuchMethod_entry()); 1074 // The noSuchMethod call may return to the caller, but not here.
1080 // The noSuchMethod call may return to the caller, but not here.
1081 } else {
1082 __ Stop("Wrong number of arguments");
1083 }
1084 __ Bind(&correct_num_arguments); 1075 __ Bind(&correct_num_arguments);
1085 } 1076 }
1086 } else if (!flow_graph().IsCompiledForOsr()) { 1077 } else if (!flow_graph().IsCompiledForOsr()) {
1087 CopyParameters(); 1078 CopyParameters();
1088 } 1079 }
1089 1080
1090 if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) { 1081 if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
1091 // Load context from the closure object (first argument). 1082 // Load context from the closure object (first argument).
1092 LocalScope* scope = parsed_function().node_sequence()->scope(); 1083 LocalScope* scope = parsed_function().node_sequence()->scope();
1093 LocalVariable* closure_parameter = scope->VariableAt(0); 1084 LocalVariable* closure_parameter = scope->VariableAt(0);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 } 1341 }
1351 1342
1352 1343
1353 void FlowGraphCompiler::EmitOptimizedStaticCall( 1344 void FlowGraphCompiler::EmitOptimizedStaticCall(
1354 const Function& function, 1345 const Function& function,
1355 const Array& arguments_descriptor, 1346 const Array& arguments_descriptor,
1356 intptr_t argument_count, 1347 intptr_t argument_count,
1357 intptr_t deopt_id, 1348 intptr_t deopt_id,
1358 TokenPosition token_pos, 1349 TokenPosition token_pos,
1359 LocationSummary* locs) { 1350 LocationSummary* locs) {
1360 __ LoadObject(EDX, arguments_descriptor); 1351 if (function.HasOptionalParameters()) {
1352 __ LoadObject(EDX, arguments_descriptor);
1353 } else {
1354 __ xorl(EDX, EDX); // GC safe smi zero because of stub.
1355 }
1361 // Do not use the code from the function, but let the code be patched so that 1356 // Do not use the code from the function, but let the code be patched so that
1362 // we can record the outgoing edges to other code. 1357 // we can record the outgoing edges to other code.
1363 GenerateDartCall(deopt_id, 1358 GenerateDartCall(deopt_id,
1364 token_pos, 1359 token_pos,
1365 *StubCode::CallStaticFunction_entry(), 1360 *StubCode::CallStaticFunction_entry(),
1366 RawPcDescriptors::kOther, 1361 RawPcDescriptors::kOther,
1367 locs); 1362 locs);
1368 AddStaticCallTarget(function); 1363 AddStaticCallTarget(function);
1369 __ Drop(argument_count); 1364 __ Drop(argument_count);
1370 } 1365 }
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 __ movups(reg, Address(ESP, 0)); 1860 __ movups(reg, Address(ESP, 0));
1866 __ addl(ESP, Immediate(kFpuRegisterSize)); 1861 __ addl(ESP, Immediate(kFpuRegisterSize));
1867 } 1862 }
1868 1863
1869 1864
1870 #undef __ 1865 #undef __
1871 1866
1872 } // namespace dart 1867 } // namespace dart
1873 1868
1874 #endif // defined TARGET_ARCH_IA32 1869 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm64.cc ('k') | runtime/vm/flow_graph_compiler_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698