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

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

Issue 1212943010: Safer interface for heap iteration. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix release mode. Created 5 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/pages.cc ('k') | runtime/vm/verifier.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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 #if defined(DEBUG) 1560 #if defined(DEBUG)
1561 isolate_->ValidateClassTable(); 1561 isolate_->ValidateClassTable();
1562 #endif 1562 #endif
1563 1563
1564 // Collect all the script objects and their accompanying token stream objects 1564 // Collect all the script objects and their accompanying token stream objects
1565 // into an array so that we can write it out as part of the VM isolate 1565 // into an array so that we can write it out as part of the VM isolate
1566 // snapshot. We first count the number of script objects, allocate an array 1566 // snapshot. We first count the number of script objects, allocate an array
1567 // and then fill it up with the script objects. 1567 // and then fill it up with the script objects.
1568 ASSERT(isolate_ != NULL); 1568 ASSERT(isolate_ != NULL);
1569 ScriptVisitor scripts_counter(isolate_); 1569 ScriptVisitor scripts_counter(isolate_);
1570 heap->old_space()->VisitObjects(&scripts_counter); 1570 heap->IterateOldObjects(&scripts_counter);
1571 intptr_t count = scripts_counter.count(); 1571 intptr_t count = scripts_counter.count();
1572 scripts_ = Array::New(count, Heap::kOld); 1572 scripts_ = Array::New(count, Heap::kOld);
1573 ScriptVisitor script_visitor(isolate_, &scripts_); 1573 ScriptVisitor script_visitor(isolate_, &scripts_);
1574 heap->old_space()->VisitObjects(&script_visitor); 1574 heap->IterateOldObjects(&script_visitor);
1575 1575
1576 // Stash the symbol table away for writing and reading into the vm isolate, 1576 // Stash the symbol table away for writing and reading into the vm isolate,
1577 // and reset the symbol table for the regular isolate so that we do not 1577 // and reset the symbol table for the regular isolate so that we do not
1578 // write these symbols into the snapshot of a regular dart isolate. 1578 // write these symbols into the snapshot of a regular dart isolate.
1579 symbol_table_ = object_store->symbol_table(); 1579 symbol_table_ = object_store->symbol_table();
1580 Symbols::SetupSymbolTable(isolate_); 1580 Symbols::SetupSymbolTable(isolate_);
1581 1581
1582 forward_list_ = new ForwardList(SnapshotWriter::FirstObjectId()); 1582 forward_list_ = new ForwardList(SnapshotWriter::FirstObjectId());
1583 ASSERT(forward_list_ != NULL); 1583 ASSERT(forward_list_ != NULL);
1584 } 1584 }
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2341 NoSafepointScope no_safepoint; 2341 NoSafepointScope no_safepoint;
2342 WriteObject(obj.raw()); 2342 WriteObject(obj.raw());
2343 UnmarkAll(); 2343 UnmarkAll();
2344 } else { 2344 } else {
2345 ThrowException(exception_type(), exception_msg()); 2345 ThrowException(exception_type(), exception_msg());
2346 } 2346 }
2347 } 2347 }
2348 2348
2349 2349
2350 } // namespace dart 2350 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/pages.cc ('k') | runtime/vm/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698