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

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

Issue 1880233002: Address Siva's comments from https://codereview.chromium.org/1877973002/ (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Adjust assert: Protect may be called while mutator_thread does not exist" Created 4 years, 8 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/virtual_memory_android.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 "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/text_buffer.h" 10 #include "platform/text_buffer.h"
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 ISOLATE_METRIC_LIST(ISOLATE_METRIC_PRINT); 1520 ISOLATE_METRIC_LIST(ISOLATE_METRIC_PRINT);
1521 #undef ISOLATE_METRIC_PRINT 1521 #undef ISOLATE_METRIC_PRINT
1522 THR_Print("\n"); 1522 THR_Print("\n");
1523 } 1523 }
1524 } 1524 }
1525 1525
1526 1526
1527 void Isolate::StopBackgroundCompiler() { 1527 void Isolate::StopBackgroundCompiler() {
1528 // Wait until all background compilation has finished. 1528 // Wait until all background compilation has finished.
1529 if (background_compiler_ != NULL) { 1529 if (background_compiler_ != NULL) {
1530 BackgroundCompiler::Stop(background_compiler_); 1530 BackgroundCompiler::Stop(this);
1531 } 1531 }
1532 } 1532 }
1533 1533
1534 1534
1535 void Isolate::Shutdown() { 1535 void Isolate::Shutdown() {
1536 ASSERT(this == Isolate::Current()); 1536 ASSERT(this == Isolate::Current());
1537 StopBackgroundCompiler(); 1537 StopBackgroundCompiler();
1538 1538
1539 #if defined(DEBUG) 1539 #if defined(DEBUG)
1540 if (heap_ != NULL) { 1540 if (heap_ != NULL) {
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 if (disabling_field_list_ == GrowableObjectArray::null()) { 1898 if (disabling_field_list_ == GrowableObjectArray::null()) {
1899 disabling_field_list_ = GrowableObjectArray::New(Heap::kOld); 1899 disabling_field_list_ = GrowableObjectArray::New(Heap::kOld);
1900 } 1900 }
1901 const GrowableObjectArray& array = 1901 const GrowableObjectArray& array =
1902 GrowableObjectArray::Handle(disabling_field_list_); 1902 GrowableObjectArray::Handle(disabling_field_list_);
1903 array.Add(field, Heap::kOld); 1903 array.Add(field, Heap::kOld);
1904 } 1904 }
1905 1905
1906 1906
1907 RawField* Isolate::GetDisablingField() { 1907 RawField* Isolate::GetDisablingField() {
1908 ASSERT(Compiler::IsBackgroundCompilation()); 1908 ASSERT(Compiler::IsBackgroundCompilation() &&
1909 MutexLocker ml(field_list_mutex_); 1909 (!Isolate::Current()->HasMutatorThread() ||
1910 Isolate::Current()->mutator_thread()->IsAtSafepoint()));
1911 ASSERT(Thread::Current()->IsAtSafepoint());
1910 if (disabling_field_list_ == GrowableObjectArray::null()) { 1912 if (disabling_field_list_ == GrowableObjectArray::null()) {
1911 return Field::null(); 1913 return Field::null();
1912 } 1914 }
1913 const GrowableObjectArray& array = 1915 const GrowableObjectArray& array =
1914 GrowableObjectArray::Handle(disabling_field_list_); 1916 GrowableObjectArray::Handle(disabling_field_list_);
1915 if (array.Length() == 0) { 1917 if (array.Length() == 0) {
1916 return Field::null(); 1918 return Field::null();
1917 } 1919 }
1918 return Field::RawCast(array.RemoveLast()); 1920 return Field::RawCast(array.RemoveLast());
1919 } 1921 }
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 void IsolateSpawnState::DecrementSpawnCount() { 2692 void IsolateSpawnState::DecrementSpawnCount() {
2691 ASSERT(spawn_count_monitor_ != NULL); 2693 ASSERT(spawn_count_monitor_ != NULL);
2692 ASSERT(spawn_count_ != NULL); 2694 ASSERT(spawn_count_ != NULL);
2693 MonitorLocker ml(spawn_count_monitor_); 2695 MonitorLocker ml(spawn_count_monitor_);
2694 ASSERT(*spawn_count_ > 0); 2696 ASSERT(*spawn_count_ > 0);
2695 *spawn_count_ = *spawn_count_ - 1; 2697 *spawn_count_ = *spawn_count_ - 1;
2696 ml.Notify(); 2698 ml.Notify();
2697 } 2699 }
2698 2700
2699 } // namespace dart 2701 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/virtual_memory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698