Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: runtime/vm/clustered_snapshot.cc

Issue 2979763002: [VM generic function types] Properly set the scope function after parsing a (Closed)
Patch Set: address comments, move new test from language to language_2, sync Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 for (intptr_t i = 0; i < count; i++) { 1563 for (intptr_t i = 0; i < count; i++) {
1564 RawCode* code = objects_[i]; 1564 RawCode* code = objects_[i];
1565 1565
1566 intptr_t pointer_offsets_length = 1566 intptr_t pointer_offsets_length =
1567 Code::PtrOffBits::decode(code->ptr()->state_bits_); 1567 Code::PtrOffBits::decode(code->ptr()->state_bits_);
1568 if (pointer_offsets_length != 0) { 1568 if (pointer_offsets_length != 0) {
1569 FATAL("Cannot serialize code with embedded pointers"); 1569 FATAL("Cannot serialize code with embedded pointers");
1570 } 1570 }
1571 if (kind == Snapshot::kFullAOT) { 1571 if (kind == Snapshot::kFullAOT) {
1572 if (code->ptr()->instructions_ != code->ptr()->active_instructions_) { 1572 if (code->ptr()->instructions_ != code->ptr()->active_instructions_) {
1573 s->UnexpectedObject(code, "Disabled code"); 1573 // TODO(rmacnak): Fix references to disabled code before serializing.
1574 // s->UnexpectedObject(code, "Disabled code");
1574 } 1575 }
1575 } 1576 }
1576 1577
1577 RawInstructions* instr = code->ptr()->instructions_; 1578 RawInstructions* instr = code->ptr()->instructions_;
1578 int32_t text_offset = s->GetTextOffset(instr, code); 1579 int32_t text_offset = s->GetTextOffset(instr, code);
1579 s->Write<int32_t>(text_offset); 1580 s->Write<int32_t>(text_offset);
1580 if (s->kind() == Snapshot::kFullJIT) { 1581 if (s->kind() == Snapshot::kFullJIT) {
1581 // TODO(rmacnak): Fix references to disabled code before serializing. 1582 // TODO(rmacnak): Fix references to disabled code before serializing.
1582 if (code->ptr()->active_instructions_ != code->ptr()->instructions_) { 1583 if (code->ptr()->active_instructions_ != code->ptr()->instructions_) {
1583 instr = code->ptr()->active_instructions_; 1584 instr = code->ptr()->active_instructions_;
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
4622 #endif 4623 #endif
4623 4624
4624 cluster->Trace(this, object); 4625 cluster->Trace(this, object);
4625 4626
4626 #if defined(SNAPSHOT_BACKTRACE) 4627 #if defined(SNAPSHOT_BACKTRACE)
4627 current_parent_ = Object::null(); 4628 current_parent_ = Object::null();
4628 #endif 4629 #endif
4629 } 4630 }
4630 4631
4631 void Serializer::UnexpectedObject(RawObject* raw_object, const char* message) { 4632 void Serializer::UnexpectedObject(RawObject* raw_object, const char* message) {
4633 // Exit the no safepoint scope so we can allocate while printing.
4634 while (thread()->no_safepoint_scope_depth() > 0) {
4635 thread()->DecrementNoSafepointScopeDepth();
4636 }
4632 Object& object = Object::Handle(raw_object); 4637 Object& object = Object::Handle(raw_object);
4633 OS::PrintErr("Unexpected object (%s): %s\n", message, object.ToCString()); 4638 OS::PrintErr("Unexpected object (%s): 0x%" Px " %s\n", message,
4639 reinterpret_cast<uword>(object.raw()), object.ToCString());
4634 #if defined(SNAPSHOT_BACKTRACE) 4640 #if defined(SNAPSHOT_BACKTRACE)
4635 while (!object.IsNull()) { 4641 while (!object.IsNull()) {
4636 object = ParentOf(object); 4642 object = ParentOf(object);
4637 OS::PrintErr("referenced by %s\n", object.ToCString()); 4643 OS::PrintErr("referenced by 0x%" Px " %s\n",
4644 reinterpret_cast<uword>(object.raw()), object.ToCString());
4638 } 4645 }
4639 #endif 4646 #endif
4640 OS::Abort(); 4647 OS::Abort();
4641 } 4648 }
4642 4649
4643 #if defined(SNAPSHOT_BACKTRACE) 4650 #if defined(SNAPSHOT_BACKTRACE)
4644 RawObject* Serializer::ParentOf(const Object& object) { 4651 RawObject* Serializer::ParentOf(const Object& object) {
4645 for (intptr_t i = 0; i < parent_pairs_.length(); i += 2) { 4652 for (intptr_t i = 0; i < parent_pairs_.length(); i += 2) {
4646 if (parent_pairs_[i]->raw() == object.raw()) { 4653 if (parent_pairs_[i]->raw() == object.raw()) {
4647 return parent_pairs_[i + 1]->raw(); 4654 return parent_pairs_[i + 1]->raw();
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
5521 thread_->isolate()->SetupImagePage(data_buffer_, 5528 thread_->isolate()->SetupImagePage(data_buffer_,
5522 /* is_executable */ false); 5529 /* is_executable */ false);
5523 } 5530 }
5524 5531
5525 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); 5532 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store());
5526 5533
5527 return ApiError::null(); 5534 return ApiError::null();
5528 } 5535 }
5529 5536
5530 } // namespace dart 5537 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698