Chromium Code Reviews| Index: runtime/vm/megamorphic_cache_table.cc |
| diff --git a/runtime/vm/megamorphic_cache_table.cc b/runtime/vm/megamorphic_cache_table.cc |
| index 3bbc5291fc9fcd925c96c623c6cba1e8adac1b44..5757327020991fce9828674e5e573e69c1706384 100644 |
| --- a/runtime/vm/megamorphic_cache_table.cc |
| +++ b/runtime/vm/megamorphic_cache_table.cc |
| @@ -55,6 +55,11 @@ void MegamorphicCacheTable::InitMissHandler() { |
| const Code& code = |
| Code::Handle(StubCode::Generate("_stub_MegamorphicMiss", |
| StubCode::GenerateMegamorphicMissStub)); |
| + // When FLAG_lazy_dispatcher=false, this stub can be on the stack during |
| + // exceptions, but it has a corresponding function so IsStubCode is false and |
| + // it is considered in the search for an exception handler. |
| + code.set_exception_handlers(Object::empty_exception_handlers()); |
| + |
| const Class& cls = |
| Class::Handle(Type::Handle(Type::Function()).type_class()); |
| const Function& function = |
| @@ -102,4 +107,40 @@ void MegamorphicCacheTable::PrintSizes() { |
| length_, size / 1024); |
| } |
| + |
| +void MegamorphicCacheTable::ReadFrom(SnapshotReader* reader) { |
| + ASSERT(reader->snapshot_code()); |
| + |
| + *reader->FunctionHandle() ^= reader->ReadObject(); |
| + miss_handler_function_ = reader->FunctionHandle()->raw(); |
| + miss_handler_code_ = reader->FunctionHandle()->CurrentCode(); |
| + |
| + capacity_ = reader->Read<intptr_t>(); |
| + length_ = capacity_; |
| + |
| + table_ = reinterpret_cast<Entry*>(malloc(length_ * sizeof(*table_))); |
| + for (intptr_t i = 0; i < length_; ++i) { |
| + *reader->StringHandle() ^= reader->ReadObject(); |
| + table_[i].name = reader->StringHandle()->raw(); |
| + *reader->ArrayHandle() ^= reader->ReadObject(); |
| + table_[i].descriptor = reader->ArrayHandle()->raw(); |
| + *reader->MegamorphicCacheHandle() ^= reader->ReadObject(); |
| + table_[i].cache = reader->MegamorphicCacheHandle()->raw(); |
| + } |
| +} |
| + |
| + |
| +void MegamorphicCacheTable::WriteTo(SnapshotWriter* writer) { |
| + ASSERT(writer->snapshot_code()); |
| + |
| + writer->WriteObject(miss_handler_function_); |
| + writer->Write<intptr_t>(length_); |
| + for (intptr_t i = 0; i < length_; i++) { |
| + writer->WriteObject(table_[i].name); |
| + writer->WriteObject(table_[i].descriptor); |
| + writer->WriteObject(table_[i].cache); |
| + } |
| +} |
|
siva
2015/09/14 21:29:34
This code is another CL and as discussed offline m
rmacnak
2015/09/15 20:07:45
Dropped.
|
| + |
| + |
| } // namespace dart |