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

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
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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 const Function& function = parsed_function().function(); 1130 const Function& function = parsed_function().function();
1131 1131
1132 const int num_fixed_params = function.num_fixed_parameters(); 1132 const int num_fixed_params = function.num_fixed_parameters();
1133 const int num_copied_params = parsed_function().num_copied_params(); 1133 const int num_copied_params = parsed_function().num_copied_params();
1134 const int num_locals = parsed_function().num_stack_locals(); 1134 const int num_locals = parsed_function().num_stack_locals();
1135 1135
1136 // We check the number of passed arguments when we have to copy them due to 1136 // We check the number of passed arguments when we have to copy them due to
1137 // the presence of optional parameters. 1137 // the presence of optional parameters.
1138 // No such checking code is generated if only fixed parameters are declared, 1138 // No such checking code is generated if only fixed parameters are declared,
1139 // unless we are in debug mode or unless we are compiling a closure. 1139 // unless we are in debug mode or unless we are compiling a closure.
1140 LocalVariable* saved_args_desc_var =
1141 parsed_function().GetSavedArgumentsDescriptorVar();
1142 if (num_copied_params == 0) { 1140 if (num_copied_params == 0) {
1143 #ifdef DEBUG 1141 #ifdef DEBUG
1144 ASSERT(!parsed_function().function().HasOptionalParameters()); 1142 ASSERT(!parsed_function().function().HasOptionalParameters());
1145 const bool check_arguments = !flow_graph().IsCompiledForOsr(); 1143 const bool check_arguments = !flow_graph().IsCompiledForOsr();
1146 #else 1144 #else
1147 const bool check_arguments = 1145 const bool check_arguments =
1148 (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) && 1146 (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) &&
1149 !flow_graph().IsCompiledForOsr(); 1147 !flow_graph().IsCompiledForOsr();
1150 #endif 1148 #endif
1151 if (check_arguments) { 1149 if (check_arguments) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 0); // No registers. 1197 0); // No registers.
1200 } 1198 }
1201 // The noSuchMethod call may return. 1199 // The noSuchMethod call may return.
1202 __ LeaveFrame(); 1200 __ LeaveFrame();
1203 __ ret(); 1201 __ ret();
1204 } else { 1202 } else {
1205 __ Stop("Wrong number of arguments"); 1203 __ Stop("Wrong number of arguments");
1206 } 1204 }
1207 __ Bind(&correct_num_arguments); 1205 __ Bind(&correct_num_arguments);
1208 } 1206 }
1209 // The arguments descriptor is never saved in the absence of optional
1210 // parameters, since any argument definition test would always yield true.
1211 ASSERT(saved_args_desc_var == NULL);
1212 } else if (!flow_graph().IsCompiledForOsr()) { 1207 } else if (!flow_graph().IsCompiledForOsr()) {
1213 if (saved_args_desc_var != NULL) {
1214 __ Comment("Save arguments descriptor");
1215 const Register kArgumentsDescriptorReg = R10;
1216 // The saved_args_desc_var is allocated one slot before the first local.
1217 const intptr_t slot = parsed_function().first_stack_local_index() + 1;
1218 // If the saved_args_desc_var is captured, it is first moved to the stack
1219 // and later to the context, once the context is allocated.
1220 ASSERT(saved_args_desc_var->is_captured() ||
1221 (saved_args_desc_var->index() == slot));
1222 __ movq(Address(RBP, slot * kWordSize), kArgumentsDescriptorReg);
1223 }
1224 CopyParameters(); 1208 CopyParameters();
1225 } 1209 }
1226 1210
1227 // In unoptimized code, initialize (non-argument) stack allocated slots to 1211 // In unoptimized code, initialize (non-argument) stack allocated slots to
1228 // null. This does not cover the saved_args_desc_var slot. 1212 // null.
1229 if (!is_optimizing() && (num_locals > 0)) { 1213 if (!is_optimizing() && (num_locals > 0)) {
1230 __ Comment("Initialize spill slots"); 1214 __ Comment("Initialize spill slots");
1231 const intptr_t slot_base = parsed_function().first_stack_local_index(); 1215 const intptr_t slot_base = parsed_function().first_stack_local_index();
1232 const Immediate& raw_null = 1216 const Immediate& raw_null =
1233 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1217 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1234 __ movq(RAX, raw_null); 1218 __ movq(RAX, raw_null);
1235 for (intptr_t i = 0; i < num_locals; ++i) { 1219 for (intptr_t i = 0; i < num_locals; ++i) {
1236 // Subtract index i (locals lie at lower addresses than RBP). 1220 // Subtract index i (locals lie at lower addresses than RBP).
1237 __ movq(Address(RBP, (slot_base - i) * kWordSize), RAX); 1221 __ movq(Address(RBP, (slot_base - i) * kWordSize), RAX);
1238 } 1222 }
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 __ movups(reg, Address(RSP, 0)); 1919 __ movups(reg, Address(RSP, 0));
1936 __ addq(RSP, Immediate(kFpuRegisterSize)); 1920 __ addq(RSP, Immediate(kFpuRegisterSize));
1937 } 1921 }
1938 1922
1939 1923
1940 #undef __ 1924 #undef __
1941 1925
1942 } // namespace dart 1926 } // namespace dart
1943 1927
1944 #endif // defined TARGET_ARCH_X64 1928 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698