| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 if (check_correct_named_args) { | 908 if (check_correct_named_args) { |
| 909 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | 909 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); |
| 910 __ SmiUntag(T1); | 910 __ SmiUntag(T1); |
| 911 // Check that T2 equals T1, i.e. no named arguments passed. | 911 // Check that T2 equals T1, i.e. no named arguments passed. |
| 912 __ beq(T2, T1, &all_arguments_processed); | 912 __ beq(T2, T1, &all_arguments_processed); |
| 913 } | 913 } |
| 914 } | 914 } |
| 915 | 915 |
| 916 __ Bind(&wrong_num_arguments); | 916 __ Bind(&wrong_num_arguments); |
| 917 if (function.IsClosureFunction()) { | 917 if (function.IsClosureFunction()) { |
| 918 // Invoke noSuchMethod function passing "call" as the original name. | |
| 919 StubCode* stub_code = isolate()->stub_code(); | |
| 920 const int kNumArgsChecked = 1; | |
| 921 const ICData& ic_data = ICData::ZoneHandle( | |
| 922 ICData::New(function, Symbols::Call(), Object::empty_array(), | |
| 923 Isolate::kNoDeoptId, kNumArgsChecked)); | |
| 924 __ LoadObject(S5, ic_data); | |
| 925 __ LeaveDartFrame(); // The arguments are still on the stack. | 918 __ LeaveDartFrame(); // The arguments are still on the stack. |
| 926 __ Branch(&stub_code->CallNoSuchMethodFunctionLabel()); | 919 __ Branch(&isolate()->stub_code()->CallNoSuchMethodFunctionLabel()); |
| 927 // The noSuchMethod call may return to the caller, but not here. | 920 // The noSuchMethod call may return to the caller, but not here. |
| 928 __ break_(0); | |
| 929 } else if (check_correct_named_args) { | 921 } else if (check_correct_named_args) { |
| 930 __ Stop("Wrong arguments"); | 922 __ Stop("Wrong arguments"); |
| 931 } | 923 } |
| 932 | 924 |
| 933 __ Bind(&all_arguments_processed); | 925 __ Bind(&all_arguments_processed); |
| 934 // Nullify originally passed arguments only after they have been copied and | 926 // Nullify originally passed arguments only after they have been copied and |
| 935 // checked, otherwise noSuchMethod would not see their original values. | 927 // checked, otherwise noSuchMethod would not see their original values. |
| 936 // This step can be skipped in case we decide that formal parameters are | 928 // This step can be skipped in case we decide that formal parameters are |
| 937 // implicitly final, since garbage collecting the unmodified value is not | 929 // implicitly final, since garbage collecting the unmodified value is not |
| 938 // an issue anymore. | 930 // an issue anymore. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 Label correct_num_arguments, wrong_num_arguments; | 1077 Label correct_num_arguments, wrong_num_arguments; |
| 1086 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | 1078 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); |
| 1087 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), | 1079 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), |
| 1088 &wrong_num_arguments); | 1080 &wrong_num_arguments); |
| 1089 | 1081 |
| 1090 __ lw(T1, FieldAddress(S4, | 1082 __ lw(T1, FieldAddress(S4, |
| 1091 ArgumentsDescriptor::positional_count_offset())); | 1083 ArgumentsDescriptor::positional_count_offset())); |
| 1092 __ beq(T0, T1, &correct_num_arguments); | 1084 __ beq(T0, T1, &correct_num_arguments); |
| 1093 __ Bind(&wrong_num_arguments); | 1085 __ Bind(&wrong_num_arguments); |
| 1094 if (function.IsClosureFunction()) { | 1086 if (function.IsClosureFunction()) { |
| 1095 // Invoke noSuchMethod function passing the original function name. | |
| 1096 // For closure functions, use "call" as the original name. | |
| 1097 const String& name = | |
| 1098 String::Handle(function.IsClosureFunction() | |
| 1099 ? Symbols::Call().raw() | |
| 1100 : function.name()); | |
| 1101 const int kNumArgsChecked = 1; | |
| 1102 const ICData& ic_data = ICData::ZoneHandle( | |
| 1103 ICData::New(function, name, Object::empty_array(), | |
| 1104 Isolate::kNoDeoptId, kNumArgsChecked)); | |
| 1105 __ LoadObject(S5, ic_data); | |
| 1106 __ LeaveDartFrame(); // The arguments are still on the stack. | 1087 __ LeaveDartFrame(); // The arguments are still on the stack. |
| 1107 __ Branch(&stub_code->CallNoSuchMethodFunctionLabel()); | 1088 __ Branch(&isolate()->stub_code()->CallNoSuchMethodFunctionLabel()); |
| 1108 // The noSuchMethod call may return to the caller, but not here. | 1089 // The noSuchMethod call may return to the caller, but not here. |
| 1109 __ break_(0); | |
| 1110 } else { | 1090 } else { |
| 1111 __ Stop("Wrong number of arguments"); | 1091 __ Stop("Wrong number of arguments"); |
| 1112 } | 1092 } |
| 1113 __ Bind(&correct_num_arguments); | 1093 __ Bind(&correct_num_arguments); |
| 1114 } | 1094 } |
| 1115 } else if (!flow_graph().IsCompiledForOsr()) { | 1095 } else if (!flow_graph().IsCompiledForOsr()) { |
| 1116 CopyParameters(); | 1096 CopyParameters(); |
| 1117 } | 1097 } |
| 1118 | 1098 |
| 1119 // In unoptimized code, initialize (non-argument) stack allocated slots to | 1099 // In unoptimized code, initialize (non-argument) stack allocated slots to |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1810 __ AddImmediate(SP, kDoubleSize); | 1790 __ AddImmediate(SP, kDoubleSize); |
| 1811 } | 1791 } |
| 1812 | 1792 |
| 1813 | 1793 |
| 1814 #undef __ | 1794 #undef __ |
| 1815 | 1795 |
| 1816 | 1796 |
| 1817 } // namespace dart | 1797 } // namespace dart |
| 1818 | 1798 |
| 1819 #endif // defined TARGET_ARCH_MIPS | 1799 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |