OLD | NEW |
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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 if (check_correct_named_args) { | 869 if (check_correct_named_args) { |
870 __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 870 __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
871 __ SmiUntag(RBX); | 871 __ SmiUntag(RBX); |
872 // Check that RCX equals RBX, i.e. no named arguments passed. | 872 // Check that RCX equals RBX, i.e. no named arguments passed. |
873 __ cmpq(RCX, RBX); | 873 __ cmpq(RCX, RBX); |
874 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump); | 874 __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump); |
875 } | 875 } |
876 } | 876 } |
877 | 877 |
878 __ Bind(&wrong_num_arguments); | 878 __ Bind(&wrong_num_arguments); |
879 if (function.IsClosureFunction()) { | 879 if (function.IsClosureFunction() || function.IsConvertedClosureFunction()) { |
880 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack. | 880 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack. |
881 __ Jmp(*StubCode::CallClosureNoSuchMethod_entry()); | 881 __ Jmp(*StubCode::CallClosureNoSuchMethod_entry()); |
882 // The noSuchMethod call may return to the caller, but not here. | 882 // The noSuchMethod call may return to the caller, but not here. |
883 } else if (check_correct_named_args) { | 883 } else if (check_correct_named_args) { |
884 __ Stop("Wrong arguments"); | 884 __ Stop("Wrong arguments"); |
885 } | 885 } |
886 | 886 |
887 __ Bind(&all_arguments_processed); | 887 __ Bind(&all_arguments_processed); |
888 // Nullify originally passed arguments only after they have been copied and | 888 // Nullify originally passed arguments only after they have been copied and |
889 // checked, otherwise noSuchMethod would not see their original values. | 889 // checked, otherwise noSuchMethod would not see their original values. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 | 985 |
986 const int num_fixed_params = function.num_fixed_parameters(); | 986 const int num_fixed_params = function.num_fixed_parameters(); |
987 const int num_copied_params = parsed_function().num_copied_params(); | 987 const int num_copied_params = parsed_function().num_copied_params(); |
988 const int num_locals = parsed_function().num_stack_locals(); | 988 const int num_locals = parsed_function().num_stack_locals(); |
989 | 989 |
990 // We check the number of passed arguments when we have to copy them due to | 990 // We check the number of passed arguments when we have to copy them due to |
991 // the presence of optional parameters. | 991 // the presence of optional parameters. |
992 // No such checking code is generated if only fixed parameters are declared, | 992 // No such checking code is generated if only fixed parameters are declared, |
993 // unless we are in debug mode or unless we are compiling a closure. | 993 // unless we are in debug mode or unless we are compiling a closure. |
994 if (num_copied_params == 0) { | 994 if (num_copied_params == 0) { |
995 const bool check_arguments = | 995 const bool check_arguments = (function.IsClosureFunction() || |
996 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); | 996 function.IsConvertedClosureFunction()) && |
| 997 !flow_graph().IsCompiledForOsr(); |
997 if (check_arguments) { | 998 if (check_arguments) { |
998 __ Comment("Check argument count"); | 999 __ Comment("Check argument count"); |
999 // Check that exactly num_fixed arguments are passed in. | 1000 // Check that exactly num_fixed arguments are passed in. |
1000 Label correct_num_arguments, wrong_num_arguments; | 1001 Label correct_num_arguments, wrong_num_arguments; |
1001 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); | 1002 __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset())); |
1002 __ CompareImmediate(RAX, Immediate(Smi::RawValue(num_fixed_params))); | 1003 __ CompareImmediate(RAX, Immediate(Smi::RawValue(num_fixed_params))); |
1003 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); | 1004 __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump); |
1004 __ cmpq(RAX, FieldAddress( | 1005 __ cmpq(RAX, FieldAddress( |
1005 R10, ArgumentsDescriptor::positional_count_offset())); | 1006 R10, ArgumentsDescriptor::positional_count_offset())); |
1006 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); | 1007 __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump); |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1678 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
1678 __ movups(reg, Address(RSP, 0)); | 1679 __ movups(reg, Address(RSP, 0)); |
1679 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1680 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
1680 } | 1681 } |
1681 | 1682 |
1682 #undef __ | 1683 #undef __ |
1683 | 1684 |
1684 } // namespace dart | 1685 } // namespace dart |
1685 | 1686 |
1686 #endif // defined TARGET_ARCH_X64 | 1687 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |