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

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

Issue 17977002: - Remove arguments definition test from the VM. (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_mips.cc ('k') | runtime/vm/flow_graph_inliner.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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 const Function& function = parsed_function().function(); 1106 const Function& function = parsed_function().function();
1107 1107
1108 const int num_fixed_params = function.num_fixed_parameters(); 1108 const int num_fixed_params = function.num_fixed_parameters();
1109 const int num_copied_params = parsed_function().num_copied_params(); 1109 const int num_copied_params = parsed_function().num_copied_params();
1110 const int num_locals = parsed_function().num_stack_locals(); 1110 const int num_locals = parsed_function().num_stack_locals();
1111 1111
1112 // We check the number of passed arguments when we have to copy them due to 1112 // We check the number of passed arguments when we have to copy them due to
1113 // the presence of optional parameters. 1113 // the presence of optional parameters.
1114 // No such checking code is generated if only fixed parameters are declared, 1114 // No such checking code is generated if only fixed parameters are declared,
1115 // unless we are in debug mode or unless we are compiling a closure. 1115 // unless we are in debug mode or unless we are compiling a closure.
1116 LocalVariable* saved_args_desc_var =
1117 parsed_function().GetSavedArgumentsDescriptorVar();
1118 if (num_copied_params == 0) { 1116 if (num_copied_params == 0) {
1119 #ifdef DEBUG 1117 #ifdef DEBUG
1120 ASSERT(!parsed_function().function().HasOptionalParameters()); 1118 ASSERT(!parsed_function().function().HasOptionalParameters());
1121 const bool check_arguments = !flow_graph().IsCompiledForOsr(); 1119 const bool check_arguments = !flow_graph().IsCompiledForOsr();
1122 #else 1120 #else
1123 const bool check_arguments = 1121 const bool check_arguments =
1124 (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) && 1122 (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) &&
1125 !flow_graph().IsCompiledForOsr(); 1123 !flow_graph().IsCompiledForOsr();
1126 #endif 1124 #endif
1127 if (check_arguments) { 1125 if (check_arguments) {
(...skipping 23 matching lines...) Expand all
1151 __ LoadObject(RBX, ic_data); 1149 __ LoadObject(RBX, ic_data);
1152 __ LeaveFrame(); // The arguments are still on the stack. 1150 __ LeaveFrame(); // The arguments are still on the stack.
1153 __ jmp(&StubCode::CallNoSuchMethodFunctionLabel()); 1151 __ jmp(&StubCode::CallNoSuchMethodFunctionLabel());
1154 // The noSuchMethod call may return to the caller, but not here. 1152 // The noSuchMethod call may return to the caller, but not here.
1155 __ int3(); 1153 __ int3();
1156 } else { 1154 } else {
1157 __ Stop("Wrong number of arguments"); 1155 __ Stop("Wrong number of arguments");
1158 } 1156 }
1159 __ Bind(&correct_num_arguments); 1157 __ Bind(&correct_num_arguments);
1160 } 1158 }
1161 // The arguments descriptor is never saved in the absence of optional
1162 // parameters, since any argument definition test would always yield true.
1163 ASSERT(saved_args_desc_var == NULL);
1164 } else if (!flow_graph().IsCompiledForOsr()) { 1159 } else if (!flow_graph().IsCompiledForOsr()) {
1165 if (saved_args_desc_var != NULL) {
1166 __ Comment("Save arguments descriptor");
1167 const Register kArgumentsDescriptorReg = R10;
1168 // The saved_args_desc_var is allocated one slot before the first local.
1169 const intptr_t slot = parsed_function().first_stack_local_index() + 1;
1170 // If the saved_args_desc_var is captured, it is first moved to the stack
1171 // and later to the context, once the context is allocated.
1172 ASSERT(saved_args_desc_var->is_captured() ||
1173 (saved_args_desc_var->index() == slot));
1174 __ movq(Address(RBP, slot * kWordSize), kArgumentsDescriptorReg);
1175 }
1176 CopyParameters(); 1160 CopyParameters();
1177 } 1161 }
1178 1162
1179 // In unoptimized code, initialize (non-argument) stack allocated slots to 1163 // In unoptimized code, initialize (non-argument) stack allocated slots to
1180 // null. This does not cover the saved_args_desc_var slot. 1164 // null.
1181 if (!is_optimizing() && (num_locals > 0)) { 1165 if (!is_optimizing() && (num_locals > 0)) {
1182 __ Comment("Initialize spill slots"); 1166 __ Comment("Initialize spill slots");
1183 const intptr_t slot_base = parsed_function().first_stack_local_index(); 1167 const intptr_t slot_base = parsed_function().first_stack_local_index();
1184 const Immediate& raw_null = 1168 const Immediate& raw_null =
1185 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1169 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1186 __ movq(RAX, raw_null); 1170 __ movq(RAX, raw_null);
1187 for (intptr_t i = 0; i < num_locals; ++i) { 1171 for (intptr_t i = 0; i < num_locals; ++i) {
1188 // Subtract index i (locals lie at lower addresses than RBP). 1172 // Subtract index i (locals lie at lower addresses than RBP).
1189 __ movq(Address(RBP, (slot_base - i) * kWordSize), RAX); 1173 __ movq(Address(RBP, (slot_base - i) * kWordSize), RAX);
1190 } 1174 }
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 __ movups(reg, Address(RSP, 0)); 1871 __ movups(reg, Address(RSP, 0));
1888 __ addq(RSP, Immediate(kFpuRegisterSize)); 1872 __ addq(RSP, Immediate(kFpuRegisterSize));
1889 } 1873 }
1890 1874
1891 1875
1892 #undef __ 1876 #undef __
1893 1877
1894 } // namespace dart 1878 } // namespace dart
1895 1879
1896 #endif // defined TARGET_ARCH_X64 1880 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698