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

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

Issue 17857008: Fix and simplify invocation of noSuchMethod on all platforms after the wrong (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/stub_code_arm.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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 __ Bind(&next_parameter); 979 __ Bind(&next_parameter);
980 } 980 }
981 __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 981 __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
982 __ SmiUntag(RBX); 982 __ SmiUntag(RBX);
983 // Check that RCX equals RBX, i.e. no named arguments passed. 983 // Check that RCX equals RBX, i.e. no named arguments passed.
984 __ cmpq(RCX, RBX); 984 __ cmpq(RCX, RBX);
985 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump); 985 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
986 } 986 }
987 987
988 __ Bind(&wrong_num_arguments); 988 __ Bind(&wrong_num_arguments);
989 if (StackSize() != 0) {
990 // We need to unwind the space we reserved for locals and copied parameters.
991 // The NoSuchMethodFunction stub does not expect to see that area on the
992 // stack.
993 __ addq(RSP, Immediate(StackSize() * kWordSize));
994 }
995 // The call below has an empty stackmap because we have just
996 // dropped the spill slots.
997 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
998
999 // Invoke noSuchMethod function passing the original name of the function. 989 // Invoke noSuchMethod function passing the original name of the function.
1000 // If the function is a closure function, use "call" as the original name. 990 // If the function is a closure function, use "call" as the original name.
1001 const String& name = String::Handle( 991 const String& name = String::Handle(
1002 function.IsClosureFunction() ? Symbols::Call().raw() : function.name()); 992 function.IsClosureFunction() ? Symbols::Call().raw() : function.name());
1003 const int kNumArgsChecked = 1; 993 const int kNumArgsChecked = 1;
1004 const ICData& ic_data = ICData::ZoneHandle( 994 const ICData& ic_data = ICData::ZoneHandle(
1005 ICData::New(function, name, Object::null_array(), 995 ICData::New(function, name, Object::null_array(),
1006 Isolate::kNoDeoptId, kNumArgsChecked)); 996 Isolate::kNoDeoptId, kNumArgsChecked));
1007 __ LoadObject(RBX, ic_data); 997 __ LoadObject(RBX, ic_data);
1008 // RBP - 8 : PC marker, allows easy identification of RawInstruction obj. 998 __ LeaveFrame(); // The arguments are still on the stack.
1009 // RBP : points to previous frame pointer. 999 __ jmp(&StubCode::CallNoSuchMethodFunctionLabel());
1010 // RBP + 8 : points to return address. 1000 // The noSuchMethod call may return to the caller, but not here.
1011 // RBP + 16 : address of last argument (arg n-1). 1001 __ int3();
1012 // RSP + 16 + 8*(n-1) : address of first argument (arg 0).
1013 // RBX : ic-data.
1014 // R10 : arguments descriptor array.
1015 __ call(&StubCode::CallNoSuchMethodFunctionLabel());
1016 // Emit descriptors in order to provide correct postion in stacktrace.
1017 AddCurrentDescriptor(PcDescriptors::kOther, -1, function.token_pos());
1018 if (is_optimizing()) {
1019 stackmap_table_builder_->AddEntry(assembler()->CodeSize(),
1020 empty_stack_bitmap,
1021 0); // No registers.
1022 }
1023 // The noSuchMethod call may return.
1024 __ LeaveFrame();
1025 __ ret();
1026 1002
1027 __ Bind(&all_arguments_processed); 1003 __ Bind(&all_arguments_processed);
1028 // Nullify originally passed arguments only after they have been copied and 1004 // Nullify originally passed arguments only after they have been copied and
1029 // checked, otherwise noSuchMethod would not see their original values. 1005 // checked, otherwise noSuchMethod would not see their original values.
1030 // This step can be skipped in case we decide that formal parameters are 1006 // This step can be skipped in case we decide that formal parameters are
1031 // implicitly final, since garbage collecting the unmodified value is not 1007 // implicitly final, since garbage collecting the unmodified value is not
1032 // an issue anymore. 1008 // an issue anymore.
1033 1009
1034 // R10 : arguments descriptor array. 1010 // R10 : arguments descriptor array.
1035 __ movq(RCX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1011 __ movq(RCX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); 1131 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
1156 __ cmpq(RAX, Immediate(Smi::RawValue(num_fixed_params))); 1132 __ cmpq(RAX, Immediate(Smi::RawValue(num_fixed_params)));
1157 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); 1133 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump);
1158 __ cmpq(RAX, 1134 __ cmpq(RAX,
1159 FieldAddress(R10, 1135 FieldAddress(R10,
1160 ArgumentsDescriptor::positional_count_offset())); 1136 ArgumentsDescriptor::positional_count_offset()));
1161 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); 1137 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump);
1162 1138
1163 __ Bind(&wrong_num_arguments); 1139 __ Bind(&wrong_num_arguments);
1164 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { 1140 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) {
1165 if (StackSize() != 0) {
1166 // We need to unwind the space we reserved for locals and copied
1167 // parameters. The NoSuchMethodFunction stub does not expect to see
1168 // that area on the stack.
1169 __ addq(RSP, Immediate(StackSize() * kWordSize));
1170 }
1171 // The call below has an empty stackmap because we have just
1172 // dropped the spill slots.
1173 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
1174
1175 // Invoke noSuchMethod function passing the original function name. 1141 // Invoke noSuchMethod function passing the original function name.
1176 // For closure functions, use "call" as the original name. 1142 // For closure functions, use "call" as the original name.
1177 const String& name = 1143 const String& name =
1178 String::Handle(function.IsClosureFunction() 1144 String::Handle(function.IsClosureFunction()
1179 ? Symbols::Call().raw() 1145 ? Symbols::Call().raw()
1180 : function.name()); 1146 : function.name());
1181 const int kNumArgsChecked = 1; 1147 const int kNumArgsChecked = 1;
1182 const ICData& ic_data = ICData::ZoneHandle( 1148 const ICData& ic_data = ICData::ZoneHandle(
1183 ICData::New(function, name, Object::null_array(), 1149 ICData::New(function, name, Object::null_array(),
1184 Isolate::kNoDeoptId, kNumArgsChecked)); 1150 Isolate::kNoDeoptId, kNumArgsChecked));
1185 __ LoadObject(RBX, ic_data); 1151 __ LoadObject(RBX, ic_data);
1186 // RBP - 8 : PC marker, for easy identification of RawInstruction obj. 1152 __ LeaveFrame(); // The arguments are still on the stack.
1187 // RBP : points to previous frame pointer. 1153 __ jmp(&StubCode::CallNoSuchMethodFunctionLabel());
1188 // RBP + 8 : points to return address. 1154 // The noSuchMethod call may return to the caller, but not here.
1189 // RBP + 16 : address of last argument (arg n-1). 1155 __ int3();
1190 // RSP + 16 + 8*(n-1) : address of first argument (arg 0).
1191 // RBX : ic-data.
1192 // R10 : arguments descriptor array.
1193 __ call(&StubCode::CallNoSuchMethodFunctionLabel());
1194 // Emit descriptors in order to provide correct postion in stacktrace.
1195 AddCurrentDescriptor(PcDescriptors::kOther, -1, function.token_pos());
1196 if (is_optimizing()) {
1197 stackmap_table_builder_->AddEntry(assembler()->CodeSize(),
1198 empty_stack_bitmap,
1199 0); // No registers.
1200 }
1201 // The noSuchMethod call may return.
1202 __ LeaveFrame();
1203 __ ret();
1204 } else { 1156 } else {
1205 __ Stop("Wrong number of arguments"); 1157 __ Stop("Wrong number of arguments");
1206 } 1158 }
1207 __ Bind(&correct_num_arguments); 1159 __ Bind(&correct_num_arguments);
1208 } 1160 }
1209 // The arguments descriptor is never saved in the absence of optional 1161 // The arguments descriptor is never saved in the absence of optional
1210 // parameters, since any argument definition test would always yield true. 1162 // parameters, since any argument definition test would always yield true.
1211 ASSERT(saved_args_desc_var == NULL); 1163 ASSERT(saved_args_desc_var == NULL);
1212 } else if (!flow_graph().IsCompiledForOsr()) { 1164 } else if (!flow_graph().IsCompiledForOsr()) {
1213 if (saved_args_desc_var != NULL) { 1165 if (saved_args_desc_var != NULL) {
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 __ movups(reg, Address(RSP, 0)); 1887 __ movups(reg, Address(RSP, 0));
1936 __ addq(RSP, Immediate(kFpuRegisterSize)); 1888 __ addq(RSP, Immediate(kFpuRegisterSize));
1937 } 1889 }
1938 1890
1939 1891
1940 #undef __ 1892 #undef __
1941 1893
1942 } // namespace dart 1894 } // namespace dart
1943 1895
1944 #endif // defined TARGET_ARCH_X64 1896 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698