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

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

Issue 2995543004: [vm, gc] Require a safepoint for heap iteration. (Closed)
Patch Set: explicit-thread Created 3 years, 4 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/compiler_stats.cc ('k') | runtime/vm/debugger_api_impl_test.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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "lib/stacktrace.h" 9 #include "lib/stacktrace.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 CHECK_NULL(isolate_snapshot_data_size); 1493 CHECK_NULL(isolate_snapshot_data_size);
1494 // Finalize all classes if needed. 1494 // Finalize all classes if needed.
1495 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T); 1495 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
1496 if (::Dart_IsError(state)) { 1496 if (::Dart_IsError(state)) {
1497 return state; 1497 return state;
1498 } 1498 }
1499 I->StopBackgroundCompiler(); 1499 I->StopBackgroundCompiler();
1500 1500
1501 #if defined(DEBUG) 1501 #if defined(DEBUG)
1502 I->heap()->CollectAllGarbage(); 1502 I->heap()->CollectAllGarbage();
1503 CheckFunctionTypesVisitor check_canonical(T); 1503 {
1504 I->heap()->IterateObjects(&check_canonical); 1504 HeapIterationScope iteration(T);
1505 CheckFunctionTypesVisitor check_canonical(T);
1506 iteration.IterateObjects(&check_canonical);
1507 }
1505 #endif // #if defined(DEBUG) 1508 #endif // #if defined(DEBUG)
1506 1509
1507 Symbols::Compact(I); 1510 Symbols::Compact(I);
1508 1511
1509 FullSnapshotWriter writer(Snapshot::kFull, vm_snapshot_data_buffer, 1512 FullSnapshotWriter writer(Snapshot::kFull, vm_snapshot_data_buffer,
1510 isolate_snapshot_data_buffer, ApiReallocate, 1513 isolate_snapshot_data_buffer, ApiReallocate,
1511 NULL /* vm_image_writer */, 1514 NULL /* vm_image_writer */,
1512 NULL /* isolate_image_writer */); 1515 NULL /* isolate_image_writer */);
1513 writer.WriteFullSnapshot(); 1516 writer.WriteFullSnapshot();
1514 if (vm_snapshot_data_buffer != NULL) { 1517 if (vm_snapshot_data_buffer != NULL) {
(...skipping 13 matching lines...) Expand all
1528 CHECK_NULL(script_snapshot_size); 1531 CHECK_NULL(script_snapshot_size);
1529 // Finalize all classes if needed. 1532 // Finalize all classes if needed.
1530 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T); 1533 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
1531 if (::Dart_IsError(state)) { 1534 if (::Dart_IsError(state)) {
1532 return state; 1535 return state;
1533 } 1536 }
1534 Library& lib = Library::Handle(Z, I->object_store()->root_library()); 1537 Library& lib = Library::Handle(Z, I->object_store()->root_library());
1535 1538
1536 #if defined(DEBUG) 1539 #if defined(DEBUG)
1537 I->heap()->CollectAllGarbage(); 1540 I->heap()->CollectAllGarbage();
1538 CheckFunctionTypesVisitor check_canonical(T); 1541 {
1539 I->heap()->IterateObjects(&check_canonical); 1542 HeapIterationScope iteration(T);
1543 CheckFunctionTypesVisitor check_canonical(T);
1544 iteration.IterateObjects(&check_canonical);
1545 }
1540 #endif // #if defined(DEBUG) 1546 #endif // #if defined(DEBUG)
1541 1547
1542 ScriptSnapshotWriter writer(script_snapshot_buffer, ApiReallocate); 1548 ScriptSnapshotWriter writer(script_snapshot_buffer, ApiReallocate);
1543 writer.WriteScriptSnapshot(lib); 1549 writer.WriteScriptSnapshot(lib);
1544 *script_snapshot_size = writer.BytesWritten(); 1550 *script_snapshot_size = writer.BytesWritten();
1545 return Api::Success(); 1551 return Api::Success();
1546 } 1552 }
1547 1553
1548 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { 1554 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) {
1549 if (isolate == NULL) { 1555 if (isolate == NULL) {
(...skipping 5220 matching lines...) Expand 10 before | Expand all | Expand 10 after
6770 #endif 6776 #endif
6771 } 6777 }
6772 6778
6773 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { 6779 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) {
6774 #ifndef PRODUCT 6780 #ifndef PRODUCT
6775 Profiler::DumpStackTrace(context); 6781 Profiler::DumpStackTrace(context);
6776 #endif 6782 #endif
6777 } 6783 }
6778 6784
6779 } // namespace dart 6785 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler_stats.cc ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698