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

Side by Side Diff: runtime/vm/isolate.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/isolate.h ('k') | runtime/vm/object.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/json.h" 9 #include "platform/json.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 private: 1419 private:
1420 DISALLOW_COPY_AND_ASSIGN(FinalizeWeakPersistentHandlesVisitor); 1420 DISALLOW_COPY_AND_ASSIGN(FinalizeWeakPersistentHandlesVisitor);
1421 }; 1421 };
1422 1422
1423 1423
1424 void Isolate::Shutdown() { 1424 void Isolate::Shutdown() {
1425 ASSERT(this == Isolate::Current()); 1425 ASSERT(this == Isolate::Current());
1426 ASSERT(top_resource() == NULL); 1426 ASSERT(top_resource() == NULL);
1427 #if defined(DEBUG) 1427 #if defined(DEBUG)
1428 if (heap_ != NULL) { 1428 if (heap_ != NULL) {
1429 // Wait for concurrent GC tasks to finish before final verification.
1430 PageSpace* old_space = heap_->old_space();
1431 MonitorLocker ml(old_space->tasks_lock());
1432 while (old_space->tasks() > 0) {
1433 ml.Wait();
1434 }
1435 // The VM isolate keeps all objects marked. 1429 // The VM isolate keeps all objects marked.
1436 heap_->Verify(this == Dart::vm_isolate() ? kRequireMarked : kForbidMarked); 1430 heap_->Verify(this == Dart::vm_isolate() ? kRequireMarked : kForbidMarked);
1437 } 1431 }
1438 #endif // DEBUG 1432 #endif // DEBUG
1439 1433
1440 // Remove this isolate from the list *before* we start tearing it down, to 1434 // Remove this isolate from the list *before* we start tearing it down, to
1441 // avoid exposing it in a state of decay. 1435 // avoid exposing it in a state of decay.
1442 RemoveIsolateFromList(this); 1436 RemoveIsolateFromList(this);
1443 1437
1444 // Create an area where we do have a zone and a handle scope so that we can 1438 // Create an area where we do have a zone and a handle scope so that we can
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; 1500 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL;
1507 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; 1501 Dart_FileReadCallback Isolate::file_read_callback_ = NULL;
1508 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; 1502 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL;
1509 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; 1503 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL;
1510 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; 1504 Dart_EntropySource Isolate::entropy_source_callback_ = NULL;
1511 1505
1512 Monitor* Isolate::isolates_list_monitor_ = NULL; 1506 Monitor* Isolate::isolates_list_monitor_ = NULL;
1513 Isolate* Isolate::isolates_list_head_ = NULL; 1507 Isolate* Isolate::isolates_list_head_ = NULL;
1514 1508
1515 1509
1510 void Isolate::IterateObjectPointers(ObjectPointerVisitor* visitor,
1511 bool visit_prologue_weak_handles,
1512 bool validate_frames) {
1513 HeapIterationScope heap_iteration_scope;
1514 VisitObjectPointers(visitor, visit_prologue_weak_handles, validate_frames);
1515 }
1516
1517
1516 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, 1518 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
1517 bool visit_prologue_weak_handles, 1519 bool visit_prologue_weak_handles,
1518 bool validate_frames) { 1520 bool validate_frames) {
1519 ASSERT(visitor != NULL); 1521 ASSERT(visitor != NULL);
1520 1522
1521 // Visit objects in the object store. 1523 // Visit objects in the object store.
1522 object_store()->VisitObjectPointers(visitor); 1524 object_store()->VisitObjectPointers(visitor);
1523 1525
1524 // Visit objects in the class table. 1526 // Visit objects in the class table.
1525 class_table()->VisitObjectPointers(visitor); 1527 class_table()->VisitObjectPointers(visitor);
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 serialized_message_, serialized_message_len_); 2085 serialized_message_, serialized_message_len_);
2084 } 2086 }
2085 2087
2086 2088
2087 void IsolateSpawnState::Cleanup() { 2089 void IsolateSpawnState::Cleanup() {
2088 SwitchIsolateScope switch_scope(I); 2090 SwitchIsolateScope switch_scope(I);
2089 Dart::ShutdownIsolate(); 2091 Dart::ShutdownIsolate();
2090 } 2092 }
2091 2093
2092 } // namespace dart 2094 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698