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

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

Issue 1410643008: Get rid of deprecated methods accessing mutator_thread_ instead of current thread (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/snapshot.h ('k') | runtime/vm/stack_frame.cc » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/snapshot.h" 5 #include "vm/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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 index -= max_vm_isolate_object_id_; 566 index -= max_vm_isolate_object_id_;
567 if (index < backward_references_->length()) { 567 if (index < backward_references_->length()) {
568 return (*backward_references_)[index].reference(); 568 return (*backward_references_)[index].reference();
569 } 569 }
570 return NULL; 570 return NULL;
571 } 571 }
572 572
573 573
574 class HeapLocker : public StackResource { 574 class HeapLocker : public StackResource {
575 public: 575 public:
576 HeapLocker(Isolate* isolate, PageSpace* page_space) 576 HeapLocker(Thread* thread, PageSpace* page_space)
577 : StackResource(isolate), page_space_(page_space) { 577 : StackResource(thread), page_space_(page_space) {
578 page_space_->AcquireDataLock(); 578 page_space_->AcquireDataLock();
579 } 579 }
580 ~HeapLocker() { 580 ~HeapLocker() {
581 page_space_->ReleaseDataLock(); 581 page_space_->ReleaseDataLock();
582 } 582 }
583 583
584 private: 584 private:
585 PageSpace* page_space_; 585 PageSpace* page_space_;
586 }; 586 };
587 587
588 588
589 RawApiError* SnapshotReader::ReadFullSnapshot() { 589 RawApiError* SnapshotReader::ReadFullSnapshot() {
590 ASSERT(kind_ == Snapshot::kFull); 590 ASSERT(kind_ == Snapshot::kFull);
591 Isolate* isolate = Isolate::Current(); 591 Thread* thread = Thread::Current();
592 Isolate* isolate = thread->isolate();
592 ASSERT(isolate != NULL); 593 ASSERT(isolate != NULL);
593 ObjectStore* object_store = isolate->object_store(); 594 ObjectStore* object_store = isolate->object_store();
594 ASSERT(object_store != NULL); 595 ASSERT(object_store != NULL);
595 596
596 // First read the version string, and check that it matches. 597 // First read the version string, and check that it matches.
597 RawApiError* error = VerifyVersion(); 598 RawApiError* error = VerifyVersion();
598 if (error != ApiError::null()) { 599 if (error != ApiError::null()) {
599 return error; 600 return error;
600 } 601 }
601 602
602 // The version string matches. Read the rest of the snapshot. 603 // The version string matches. Read the rest of the snapshot.
603 604
604 // TODO(asiva): Add a check here to ensure we have the right heap 605 // TODO(asiva): Add a check here to ensure we have the right heap
605 // size for the full snapshot being read. 606 // size for the full snapshot being read.
606 { 607 {
607 NoSafepointScope no_safepoint; 608 NoSafepointScope no_safepoint;
608 HeapLocker hl(isolate, old_space()); 609 HeapLocker hl(thread, old_space());
609 610
610 // Read in all the objects stored in the object store. 611 // Read in all the objects stored in the object store.
611 RawObject** toobj = snapshot_code() ? object_store->to() 612 RawObject** toobj = snapshot_code() ? object_store->to()
612 : object_store->to_snapshot(); 613 : object_store->to_snapshot();
613 intptr_t num_flds = (toobj - object_store->from()); 614 intptr_t num_flds = (toobj - object_store->from());
614 for (intptr_t i = 0; i <= num_flds; i++) { 615 for (intptr_t i = 0; i <= num_flds; i++) {
615 *(object_store->from() + i) = ReadObjectImpl(kAsInlinedObject); 616 *(object_store->from() + i) = ReadObjectImpl(kAsInlinedObject);
616 } 617 }
617 for (intptr_t i = 0; i < backward_references_->length(); i++) { 618 for (intptr_t i = 0; i < backward_references_->length(); i++) {
618 if (!(*backward_references_)[i].is_deserialized()) { 619 if (!(*backward_references_)[i].is_deserialized()) {
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 Object::vm_isolate_snapshot_object_table().SetAt( 1466 Object::vm_isolate_snapshot_object_table().SetAt(
1466 i, *(backrefs->At(i).reference())); 1467 i, *(backrefs->At(i).reference()));
1467 } 1468 }
1468 ResetBackwardReferenceTable(); 1469 ResetBackwardReferenceTable();
1469 Dart::set_instructions_snapshot_buffer(instructions_buffer_); 1470 Dart::set_instructions_snapshot_buffer(instructions_buffer_);
1470 } 1471 }
1471 1472
1472 1473
1473 RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() { 1474 RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() {
1474 ASSERT(kind() == Snapshot::kFull); 1475 ASSERT(kind() == Snapshot::kFull);
1475 Isolate* isolate = Isolate::Current(); 1476 Thread* thread = Thread::Current();
1477 Isolate* isolate = thread->isolate();
1476 ASSERT(isolate != NULL); 1478 ASSERT(isolate != NULL);
1477 ASSERT(isolate == Dart::vm_isolate()); 1479 ASSERT(isolate == Dart::vm_isolate());
1478 ObjectStore* object_store = isolate->object_store(); 1480 ObjectStore* object_store = isolate->object_store();
1479 ASSERT(object_store != NULL); 1481 ASSERT(object_store != NULL);
1480 1482
1481 // First read the version string, and check that it matches. 1483 // First read the version string, and check that it matches.
1482 RawApiError* error = VerifyVersion(); 1484 RawApiError* error = VerifyVersion();
1483 if (error != ApiError::null()) { 1485 if (error != ApiError::null()) {
1484 return error; 1486 return error;
1485 } 1487 }
1486 1488
1487 // The version string matches. Read the rest of the snapshot. 1489 // The version string matches. Read the rest of the snapshot.
1488 1490
1489 { 1491 {
1490 NoSafepointScope no_safepoint; 1492 NoSafepointScope no_safepoint;
1491 HeapLocker hl(isolate, old_space()); 1493 HeapLocker hl(thread, old_space());
1492 1494
1493 // Read in the symbol table. 1495 // Read in the symbol table.
1494 object_store->symbol_table_ = reinterpret_cast<RawArray*>(ReadObject()); 1496 object_store->symbol_table_ = reinterpret_cast<RawArray*>(ReadObject());
1495 1497
1496 Symbols::InitOnceFromSnapshot(isolate); 1498 Symbols::InitOnceFromSnapshot(isolate);
1497 1499
1498 // Read in all the script objects and the accompanying token streams 1500 // Read in all the script objects and the accompanying token streams
1499 // for bootstrap libraries so that they are in the VM isolate's read 1501 // for bootstrap libraries so that they are in the VM isolate's read
1500 // only memory. 1502 // only memory.
1501 *(ArrayHandle()) ^= ReadObject(); 1503 *(ArrayHandle()) ^= ReadObject();
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 if (setjmp(*jump.Set()) == 0) { 2555 if (setjmp(*jump.Set()) == 0) {
2554 NoSafepointScope no_safepoint; 2556 NoSafepointScope no_safepoint;
2555 WriteObject(obj.raw()); 2557 WriteObject(obj.raw());
2556 } else { 2558 } else {
2557 ThrowException(exception_type(), exception_msg()); 2559 ThrowException(exception_type(), exception_msg());
2558 } 2560 }
2559 } 2561 }
2560 2562
2561 2563
2562 } // namespace dart 2564 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/stack_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698