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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 target_function = InlineCacheMissHelper(receiver, descriptor, name); | 1042 target_function = InlineCacheMissHelper(receiver, descriptor, name); |
1043 } | 1043 } |
1044 if (target_function.IsNull()) { | 1044 if (target_function.IsNull()) { |
1045 ASSERT(!FLAG_lazy_dispatchers); | 1045 ASSERT(!FLAG_lazy_dispatchers); |
1046 arguments.SetReturn(target_function); | 1046 arguments.SetReturn(target_function); |
1047 return; | 1047 return; |
1048 } | 1048 } |
1049 | 1049 |
1050 if (ic_data_or_cache.IsICData()) { | 1050 if (ic_data_or_cache.IsICData()) { |
1051 const ICData& ic_data = ICData::Cast(ic_data_or_cache); | 1051 const ICData& ic_data = ICData::Cast(ic_data_or_cache); |
1052 ic_data.AddReceiverCheck(receiver.GetClassId(), target_function); | 1052 |
| 1053 if (ic_data.NumArgsTested() == 1) { |
| 1054 ic_data.AddReceiverCheck(receiver.GetClassId(), target_function); |
| 1055 } else { |
| 1056 ASSERT(ic_data.NumArgsTested() == 2); |
| 1057 GrowableArray<intptr_t> class_ids(2); |
| 1058 class_ids.Add(receiver.GetClassId()); |
| 1059 class_ids.Add(kDynamicCid); // No one will read this. |
| 1060 ic_data.AddCheck(class_ids, target_function); |
| 1061 } |
| 1062 |
1053 if (ic_data.NumberOfChecks() > FLAG_max_polymorphic_checks) { | 1063 if (ic_data.NumberOfChecks() > FLAG_max_polymorphic_checks) { |
1054 // Switch to megamorphic call. | 1064 // Switch to megamorphic call. |
1055 const MegamorphicCache& cache = MegamorphicCache::Handle(zone, | 1065 const MegamorphicCache& cache = MegamorphicCache::Handle(zone, |
1056 MegamorphicCacheTable::Lookup(isolate, name, descriptor)); | 1066 MegamorphicCacheTable::Lookup(isolate, name, descriptor)); |
1057 DartFrameIterator iterator; | 1067 DartFrameIterator iterator; |
1058 StackFrame* miss_function_frame = iterator.NextFrame(); | 1068 StackFrame* miss_function_frame = iterator.NextFrame(); |
1059 ASSERT(miss_function_frame->IsDartFrame()); | 1069 ASSERT(miss_function_frame->IsDartFrame()); |
1060 StackFrame* caller_frame = iterator.NextFrame(); | 1070 StackFrame* caller_frame = iterator.NextFrame(); |
1061 ASSERT(caller_frame->IsDartFrame()); | 1071 ASSERT(caller_frame->IsDartFrame()); |
1062 const Code& code = Code::Handle(zone, caller_frame->LookupDartCode()); | 1072 const Code& code = Code::Handle(zone, caller_frame->LookupDartCode()); |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1891 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1882 const TypedData& new_data = | 1892 const TypedData& new_data = |
1883 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1893 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1884 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1894 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1885 typed_data_cell.SetAt(0, new_data); | 1895 typed_data_cell.SetAt(0, new_data); |
1886 arguments.SetReturn(new_data); | 1896 arguments.SetReturn(new_data); |
1887 } | 1897 } |
1888 | 1898 |
1889 | 1899 |
1890 } // namespace dart | 1900 } // namespace dart |
OLD | NEW |