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

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

Issue 1275113003: Endless thread safe timeline recorder (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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/thread.h" 5 #include "vm/thread.h"
6 6
7 #include "vm/growable_array.h" 7 #include "vm/growable_array.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/lockers.h" 9 #include "vm/lockers.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 #undef INIT_VALUE 101 #undef INIT_VALUE
102 } 102 }
103 103
104 104
105 void Thread::Schedule(Isolate* isolate) { 105 void Thread::Schedule(Isolate* isolate) {
106 State st; 106 State st;
107 if (isolate->thread_registry()->RestoreStateTo(this, &st)) { 107 if (isolate->thread_registry()->RestoreStateTo(this, &st)) {
108 ASSERT(isolate->thread_registry()->Contains(this)); 108 ASSERT(isolate->thread_registry()->Contains(this));
109 state_ = st; 109 state_ = st;
110 } 110 }
111 PostSchedule();
112 }
113
114
115 void Thread::PostSchedule() {
116 if ((current_block() == NULL) || current_block()->IsFull()) {
117 // Thread doesn't have a timeline block or it is full, request a new one.
koda 2015/08/07 01:09:54 Why not let these cases be handled naturally when
Cutch 2015/08/07 16:47:42 Done.
118 set_current_block(isolate_->GetNewTimelineBlock());
119 }
111 } 120 }
112 121
113 122
114 void Thread::Unschedule() { 123 void Thread::Unschedule() {
115 ThreadRegistry* reg = isolate_->thread_registry(); 124 ThreadRegistry* reg = isolate_->thread_registry();
116 ASSERT(reg->Contains(this)); 125 ASSERT(reg->Contains(this));
117 reg->SaveStateFrom(this, state_); 126 reg->SaveStateFrom(this, state_);
118 ClearState(); 127 ClearState();
119 } 128 }
120 129
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \ 267 #define COMPUTE_OFFSET(type_name, member_name, expr, default_init_value) \
259 ASSERT((expr)->IsVMHeapObject()); \ 268 ASSERT((expr)->IsVMHeapObject()); \
260 if (object.raw() == expr) return Thread::member_name##offset(); 269 if (object.raw() == expr) return Thread::member_name##offset();
261 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET) 270 CACHED_VM_OBJECTS_LIST(COMPUTE_OFFSET)
262 #undef COMPUTE_OFFSET 271 #undef COMPUTE_OFFSET
263 UNREACHABLE(); 272 UNREACHABLE();
264 return -1; 273 return -1;
265 } 274 }
266 275
267 } // namespace dart 276 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698