Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/clustered_snapshot.h" | 5 #include "vm/clustered_snapshot.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1592 intptr_t count = objects_.length(); | 1592 intptr_t count = objects_.length(); |
| 1593 for (intptr_t i = 0; i < count; i++) { | 1593 for (intptr_t i = 0; i < count; i++) { |
| 1594 RawCode* code = objects_[i]; | 1594 RawCode* code = objects_[i]; |
| 1595 | 1595 |
| 1596 intptr_t pointer_offsets_length = | 1596 intptr_t pointer_offsets_length = |
| 1597 Code::PtrOffBits::decode(code->ptr()->state_bits_); | 1597 Code::PtrOffBits::decode(code->ptr()->state_bits_); |
| 1598 if (pointer_offsets_length != 0) { | 1598 if (pointer_offsets_length != 0) { |
| 1599 FATAL("Cannot serialize code with embedded pointers"); | 1599 FATAL("Cannot serialize code with embedded pointers"); |
| 1600 } | 1600 } |
| 1601 if (kind == Snapshot::kFullAOT) { | 1601 if (kind == Snapshot::kFullAOT) { |
| 1602 // No disabled code in precompilation. | 1602 if (code->ptr()->instructions_ != code->ptr()->active_instructions_) { |
| 1603 NOT_IN_PRECOMPILED(ASSERT(code->ptr()->instructions_ == | 1603 // TODO(rmacnak): Fix references to disabled code before serializing. |
| 1604 code->ptr()->active_instructions_)); | 1604 // s->UnexpectedObject(code, "Disabled code"); |
| 1605 } | |
|
siva
2017/07/18 23:52:25
the empty if statement seems like a NOP, do we nee
regis
2017/07/18 23:59:07
True. We could remove the 'kind' local as well, bu
rmacnak
2017/07/19 19:56:39
Please leave the commented out code.
regis
2017/07/19 20:14:23
Acknowledged.
| |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 RawInstructions* instr = code->ptr()->instructions_; | 1608 RawInstructions* instr = code->ptr()->instructions_; |
| 1608 int32_t text_offset = s->GetTextOffset(instr, code); | 1609 int32_t text_offset = s->GetTextOffset(instr, code); |
| 1609 s->Write<int32_t>(text_offset); | 1610 s->Write<int32_t>(text_offset); |
| 1610 if (s->kind() == Snapshot::kFullJIT) { | 1611 if (s->kind() == Snapshot::kFullJIT) { |
| 1611 // TODO(rmacnak): Fix references to disabled code before serializing. | 1612 // TODO(rmacnak): Fix references to disabled code before serializing. |
| 1612 if (code->ptr()->active_instructions_ != code->ptr()->instructions_) { | 1613 if (code->ptr()->active_instructions_ != code->ptr()->instructions_) { |
| 1613 instr = code->ptr()->active_instructions_; | 1614 instr = code->ptr()->active_instructions_; |
| 1614 text_offset = s->GetTextOffset(instr, code); | 1615 text_offset = s->GetTextOffset(instr, code); |
| (...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4720 | 4721 |
| 4721 cluster->Trace(this, object); | 4722 cluster->Trace(this, object); |
| 4722 | 4723 |
| 4723 #if defined(SNAPSHOT_BACKTRACE) | 4724 #if defined(SNAPSHOT_BACKTRACE) |
| 4724 current_parent_ = Object::null(); | 4725 current_parent_ = Object::null(); |
| 4725 #endif | 4726 #endif |
| 4726 } | 4727 } |
| 4727 | 4728 |
| 4728 | 4729 |
| 4729 void Serializer::UnexpectedObject(RawObject* raw_object, const char* message) { | 4730 void Serializer::UnexpectedObject(RawObject* raw_object, const char* message) { |
| 4731 // Exit the no safepoint scope so we can allocate while printing. | |
| 4732 while (thread()->no_safepoint_scope_depth() > 0) { | |
| 4733 thread()->DecrementNoSafepointScopeDepth(); | |
| 4734 } | |
| 4730 Object& object = Object::Handle(raw_object); | 4735 Object& object = Object::Handle(raw_object); |
| 4731 OS::PrintErr("Unexpected object (%s): %s\n", message, object.ToCString()); | 4736 OS::PrintErr("Unexpected object (%s): 0x%" Px " %s\n", message, |
| 4737 reinterpret_cast<uword>(object.raw()), object.ToCString()); | |
| 4732 #if defined(SNAPSHOT_BACKTRACE) | 4738 #if defined(SNAPSHOT_BACKTRACE) |
| 4733 while (!object.IsNull()) { | 4739 while (!object.IsNull()) { |
| 4734 object = ParentOf(object); | 4740 object = ParentOf(object); |
| 4735 OS::PrintErr("referenced by %s\n", object.ToCString()); | 4741 OS::PrintErr("referenced by 0x%" Px " %s\n", |
| 4742 reinterpret_cast<uword>(object.raw()), object.ToCString()); | |
| 4736 } | 4743 } |
| 4737 #endif | 4744 #endif |
| 4738 OS::Abort(); | 4745 OS::Abort(); |
| 4739 } | 4746 } |
| 4740 | 4747 |
| 4741 | 4748 |
| 4742 #if defined(SNAPSHOT_BACKTRACE) | 4749 #if defined(SNAPSHOT_BACKTRACE) |
| 4743 RawObject* Serializer::ParentOf(const Object& object) { | 4750 RawObject* Serializer::ParentOf(const Object& object) { |
| 4744 for (intptr_t i = 0; i < parent_pairs_.length(); i += 2) { | 4751 for (intptr_t i = 0; i < parent_pairs_.length(); i += 2) { |
| 4745 if (parent_pairs_[i]->raw() == object.raw()) { | 4752 if (parent_pairs_[i]->raw() == object.raw()) { |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5642 thread_->isolate()->SetupImagePage(data_buffer_, | 5649 thread_->isolate()->SetupImagePage(data_buffer_, |
| 5643 /* is_executable */ false); | 5650 /* is_executable */ false); |
| 5644 } | 5651 } |
| 5645 | 5652 |
| 5646 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); | 5653 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
| 5647 | 5654 |
| 5648 return ApiError::null(); | 5655 return ApiError::null(); |
| 5649 } | 5656 } |
| 5650 | 5657 |
| 5651 } // namespace dart | 5658 } // namespace dart |
| OLD | NEW |