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

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

Issue 2395123003: Make adding a pending deopt atomic. (Closed)
Patch Set: Created 4 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
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 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 #endif // !PRODUCT 1900 #endif // !PRODUCT
1901 ASSERT(raw_class != NULL); 1901 ASSERT(raw_class != NULL);
1902 #if !defined(DART_PRECOMPILER) 1902 #if !defined(DART_PRECOMPILER)
1903 // This is temporarily untrue during a class id remap. 1903 // This is temporarily untrue during a class id remap.
1904 ASSERT(raw_class->ptr()->id_ == cid); 1904 ASSERT(raw_class->ptr()->id_ == cid);
1905 #endif 1905 #endif
1906 return raw_class; 1906 return raw_class;
1907 } 1907 }
1908 1908
1909 1909
1910 void Isolate::AddPendingDeopt(uword fp, uword pc) {
1911 // GrowableArray::Add is not atomic and may be interrupt by a profiler
siva 2016/10/10 04:10:26 may be interrupted ...
1912 // stack walk.
1913 MallocGrowableArray<PendingLazyDeopt>* old_pending_deopts = pending_deopts_;
1914 MallocGrowableArray<PendingLazyDeopt>* new_pending_deopts
1915 = new MallocGrowableArray<PendingLazyDeopt>(
1916 old_pending_deopts->length() + 1);
1917 for (intptr_t i = 0; i < old_pending_deopts->length(); i++) {
1918 ASSERT((*old_pending_deopts)[i].fp() != fp);
1919 new_pending_deopts->Add((*old_pending_deopts)[i]);
1920 }
1921 PendingLazyDeopt deopt(fp, pc);
1922 new_pending_deopts->Add(deopt);
1923
1924 pending_deopts_ = new_pending_deopts;
1925 delete old_pending_deopts;
1926 }
1927
1928
1929 uword Isolate::FindPendingDeopt(uword fp) const {
1930 for (intptr_t i = 0; i < pending_deopts_->length(); i++) {
1931 if ((*pending_deopts_)[i].fp() == fp) {
1932 return (*pending_deopts_)[i].pc();
1933 }
1934 }
1935 FATAL("Missing pending deopt entry");
1936 return 0;
siva 2016/10/10 04:10:26 Can another thread be executing this code while Ad
1937 }
1938
1939
1940 void Isolate::ClearPendingDeoptsAtOrBelow(uword fp) const {
1941 for (intptr_t i = pending_deopts_->length() - 1; i >= 0; i--) {
1942 if ((*pending_deopts_)[i].fp() <= fp) {
1943 pending_deopts_->RemoveAt(i);
1944 }
1945 }
siva 2016/10/10 04:10:26 Same question about this function.
1946 }
1947
1948
1910 #ifndef PRODUCT 1949 #ifndef PRODUCT
1911 static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) { 1950 static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) {
1912 switch (pi) { 1951 switch (pi) {
1913 case kPauseOnAllExceptions: 1952 case kPauseOnAllExceptions:
1914 return "All"; 1953 return "All";
1915 case kNoPauseOnExceptions: 1954 case kNoPauseOnExceptions:
1916 return "None"; 1955 return "None";
1917 case kPauseOnUnhandledExceptions: 1956 case kPauseOnUnhandledExceptions:
1918 return "Unhandled"; 1957 return "Unhandled";
1919 default: 1958 default:
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 void IsolateSpawnState::DecrementSpawnCount() { 2946 void IsolateSpawnState::DecrementSpawnCount() {
2908 ASSERT(spawn_count_monitor_ != NULL); 2947 ASSERT(spawn_count_monitor_ != NULL);
2909 ASSERT(spawn_count_ != NULL); 2948 ASSERT(spawn_count_ != NULL);
2910 MonitorLocker ml(spawn_count_monitor_); 2949 MonitorLocker ml(spawn_count_monitor_);
2911 ASSERT(*spawn_count_ > 0); 2950 ASSERT(*spawn_count_ > 0);
2912 *spawn_count_ = *spawn_count_ - 1; 2951 *spawn_count_ = *spawn_count_ - 1;
2913 ml.Notify(); 2952 ml.Notify();
2914 } 2953 }
2915 2954
2916 } // namespace dart 2955 } // namespace dart
OLDNEW
« runtime/vm/isolate.h ('K') | « runtime/vm/isolate.h ('k') | runtime/vm/stack_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698