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

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

Issue 517383005: VM: Clean up generated code for NoSuchMethod invocation of closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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_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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 911 __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
912 __ SmiUntag(EBX); 912 __ SmiUntag(EBX);
913 // Check that ECX equals EBX, i.e. no named arguments passed. 913 // Check that ECX equals EBX, i.e. no named arguments passed.
914 __ cmpl(ECX, EBX); 914 __ cmpl(ECX, EBX);
915 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump); 915 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
916 } 916 }
917 } 917 }
918 918
919 __ Bind(&wrong_num_arguments); 919 __ Bind(&wrong_num_arguments);
920 if (function.IsClosureFunction()) { 920 if (function.IsClosureFunction()) {
921 // Invoke noSuchMethod function passing "call" as the original name.
922 StubCode* stub_code = isolate()->stub_code();
923 const int kNumArgsChecked = 1;
924 const ICData& ic_data = ICData::ZoneHandle(
925 ICData::New(function, Symbols::Call(), Object::empty_array(),
926 Isolate::kNoDeoptId, kNumArgsChecked));
927 __ LoadObject(ECX, ic_data);
928 __ LeaveFrame(); // The arguments are still on the stack. 921 __ LeaveFrame(); // The arguments are still on the stack.
929 __ jmp(&stub_code->CallNoSuchMethodFunctionLabel()); 922 __ jmp(&isolate()->stub_code()->CallClosureNoSuchMethodLabel());
930 // The noSuchMethod call may return to the caller, but not here. 923 // The noSuchMethod call may return to the caller, but not here.
931 __ int3();
932 } else if (check_correct_named_args) { 924 } else if (check_correct_named_args) {
933 __ Stop("Wrong arguments"); 925 __ Stop("Wrong arguments");
934 } 926 }
935 927
936 __ Bind(&all_arguments_processed); 928 __ Bind(&all_arguments_processed);
937 // Nullify originally passed arguments only after they have been copied and 929 // Nullify originally passed arguments only after they have been copied and
938 // checked, otherwise noSuchMethod would not see their original values. 930 // checked, otherwise noSuchMethod would not see their original values.
939 // This step can be skipped in case we decide that formal parameters are 931 // This step can be skipped in case we decide that formal parameters are
940 // implicitly final, since garbage collecting the unmodified value is not 932 // implicitly final, since garbage collecting the unmodified value is not
941 // an issue anymore. 933 // an issue anymore.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); 1048 __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
1057 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params))); 1049 __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params)));
1058 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); 1050 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump);
1059 __ cmpl(EAX, 1051 __ cmpl(EAX,
1060 FieldAddress(EDX, 1052 FieldAddress(EDX,
1061 ArgumentsDescriptor::positional_count_offset())); 1053 ArgumentsDescriptor::positional_count_offset()));
1062 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); 1054 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump);
1063 1055
1064 __ Bind(&wrong_num_arguments); 1056 __ Bind(&wrong_num_arguments);
1065 if (function.IsClosureFunction()) { 1057 if (function.IsClosureFunction()) {
1066 // Invoke noSuchMethod function passing the original function name.
1067 // For closure functions, use "call" as the original name.
1068 const String& name =
1069 String::Handle(function.IsClosureFunction()
1070 ? Symbols::Call().raw()
1071 : function.name());
1072 const int kNumArgsChecked = 1;
1073 const ICData& ic_data = ICData::ZoneHandle(
1074 ICData::New(function, name, Object::empty_array(),
1075 Isolate::kNoDeoptId, kNumArgsChecked));
1076 __ LoadObject(ECX, ic_data);
1077 __ LeaveFrame(); // The arguments are still on the stack. 1058 __ LeaveFrame(); // The arguments are still on the stack.
1078 __ jmp(&stub_code->CallNoSuchMethodFunctionLabel()); 1059 __ jmp(&stub_code->CallClosureNoSuchMethodLabel());
1079 // The noSuchMethod call may return to the caller, but not here. 1060 // The noSuchMethod call may return to the caller, but not here.
1080 __ int3();
1081 } else { 1061 } else {
1082 __ Stop("Wrong number of arguments"); 1062 __ Stop("Wrong number of arguments");
1083 } 1063 }
1084 __ Bind(&correct_num_arguments); 1064 __ Bind(&correct_num_arguments);
1085 } 1065 }
1086 } else if (!flow_graph().IsCompiledForOsr()) { 1066 } else if (!flow_graph().IsCompiledForOsr()) {
1087 CopyParameters(); 1067 CopyParameters();
1088 } 1068 }
1089 1069
1090 // In unoptimized code, initialize (non-argument) stack allocated slots to 1070 // In unoptimized code, initialize (non-argument) stack allocated slots to
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 __ movups(reg, Address(ESP, 0)); 1753 __ movups(reg, Address(ESP, 0));
1774 __ addl(ESP, Immediate(kFpuRegisterSize)); 1754 __ addl(ESP, Immediate(kFpuRegisterSize));
1775 } 1755 }
1776 1756
1777 1757
1778 #undef __ 1758 #undef __
1779 1759
1780 } // namespace dart 1760 } // namespace dart
1781 1761
1782 #endif // defined TARGET_ARCH_IA32 1762 #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