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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 target_function = InlineCacheMissHelper(receiver, descriptor, name); | 1079 target_function = InlineCacheMissHelper(receiver, descriptor, name); |
1080 } | 1080 } |
1081 if (target_function.IsNull()) { | 1081 if (target_function.IsNull()) { |
1082 ASSERT(!FLAG_lazy_dispatchers); | 1082 ASSERT(!FLAG_lazy_dispatchers); |
1083 } else { | 1083 } else { |
1084 ic_data.AddReceiverCheck(receiver.GetClassId(), target_function); | 1084 ic_data.AddReceiverCheck(receiver.GetClassId(), target_function); |
1085 } | 1085 } |
1086 | 1086 |
1087 // Patch to call through stub. | 1087 // Patch to call through stub. |
1088 const Code& stub = | 1088 const Code& stub = |
1089 Code::Handle(zone, StubCode::ICLookupThroughCode_entry()->code()); | 1089 Code::Handle(zone, StubCode::ICCallThroughCode_entry()->code()); |
1090 ASSERT(!Isolate::Current()->compilation_allowed()); | 1090 ASSERT(!Isolate::Current()->compilation_allowed()); |
1091 CodePatcher::PatchSwitchableCallAt(caller_frame->pc(), | 1091 CodePatcher::PatchSwitchableCallAt(caller_frame->pc(), |
1092 caller_code, | 1092 caller_code, |
1093 ic_data, | 1093 ic_data, |
1094 stub); | 1094 stub); |
1095 | 1095 |
1096 // Return the ICData. The miss stub will jump to continue in the IC lookup | 1096 // Return the ICData. The miss stub will jump to continue in the IC lookup |
1097 // stub. | 1097 // stub. |
1098 arguments.SetReturn(ic_data); | 1098 arguments.SetReturn(ic_data); |
1099 #endif // !defined(TARGET_ARCH_DBC) | 1099 #endif // !defined(TARGET_ARCH_DBC) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 const MegamorphicCache& cache = MegamorphicCache::Handle(zone, | 1183 const MegamorphicCache& cache = MegamorphicCache::Handle(zone, |
1184 MegamorphicCacheTable::Lookup(isolate, name, descriptor)); | 1184 MegamorphicCacheTable::Lookup(isolate, name, descriptor)); |
1185 DartFrameIterator iterator; | 1185 DartFrameIterator iterator; |
1186 StackFrame* miss_function_frame = iterator.NextFrame(); | 1186 StackFrame* miss_function_frame = iterator.NextFrame(); |
1187 ASSERT(miss_function_frame->IsDartFrame()); | 1187 ASSERT(miss_function_frame->IsDartFrame()); |
1188 StackFrame* caller_frame = iterator.NextFrame(); | 1188 StackFrame* caller_frame = iterator.NextFrame(); |
1189 ASSERT(caller_frame->IsDartFrame()); | 1189 ASSERT(caller_frame->IsDartFrame()); |
1190 const Code& caller_code = | 1190 const Code& caller_code = |
1191 Code::Handle(zone, caller_frame->LookupDartCode()); | 1191 Code::Handle(zone, caller_frame->LookupDartCode()); |
1192 const Code& stub = | 1192 const Code& stub = |
1193 Code::Handle(zone, StubCode::MegamorphicLookup_entry()->code()); | 1193 Code::Handle(zone, StubCode::MegamorphicCall_entry()->code()); |
1194 | 1194 |
1195 CodePatcher::PatchSwitchableCallAt(caller_frame->pc(), caller_code, | 1195 CodePatcher::PatchSwitchableCallAt(caller_frame->pc(), caller_code, |
1196 cache, stub); | 1196 cache, stub); |
1197 } | 1197 } |
1198 } | 1198 } |
1199 } else { | 1199 } else { |
1200 const MegamorphicCache& cache = MegamorphicCache::Cast(ic_data_or_cache); | 1200 const MegamorphicCache& cache = MegamorphicCache::Cast(ic_data_or_cache); |
1201 // Insert function found into cache and return it. | 1201 // Insert function found into cache and return it. |
1202 cache.EnsureCapacity(); | 1202 cache.EnsureCapacity(); |
1203 const Smi& class_id = Smi::Handle(zone, Smi::New(cls.id())); | 1203 const Smi& class_id = Smi::Handle(zone, Smi::New(cls.id())); |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 2070 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
2071 const TypedData& new_data = | 2071 const TypedData& new_data = |
2072 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 2072 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
2073 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 2073 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
2074 typed_data_cell.SetAt(0, new_data); | 2074 typed_data_cell.SetAt(0, new_data); |
2075 arguments.SetReturn(new_data); | 2075 arguments.SetReturn(new_data); |
2076 } | 2076 } |
2077 | 2077 |
2078 | 2078 |
2079 } // namespace dart | 2079 } // namespace dart |
OLD | NEW |