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

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

Issue 1678203002: Remove more feature in product mode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/object.cc ('k') | runtime/vm/parser.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) 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/os_thread.h" 5 #include "vm/os_thread.h"
6 6
7 #include "vm/atomic.h" 7 #include "vm/atomic.h"
8 #include "vm/lockers.h" 8 #include "vm/lockers.h"
9 #include "vm/log.h" 9 #include "vm/log.h"
10 #include "vm/thread_interrupter.h" 10 #include "vm/thread_interrupter.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 OSThread* os_thread = new OSThread(); 44 OSThread* os_thread = new OSThread();
45 AddThreadToListLocked(os_thread); 45 AddThreadToListLocked(os_thread);
46 return os_thread; 46 return os_thread;
47 } 47 }
48 48
49 49
50 OSThread::~OSThread() { 50 OSThread::~OSThread() {
51 RemoveThreadFromList(this); 51 RemoveThreadFromList(this);
52 delete log_; 52 delete log_;
53 log_ = NULL; 53 log_ = NULL;
54 if (Timeline::recorder() != NULL) { 54 if (FLAG_support_timeline) {
55 Timeline::recorder()->FinishBlock(timeline_block_); 55 if (Timeline::recorder() != NULL) {
56 Timeline::recorder()->FinishBlock(timeline_block_);
57 }
56 } 58 }
57 timeline_block_ = NULL; 59 timeline_block_ = NULL;
58 delete timeline_block_lock_; 60 delete timeline_block_lock_;
59 free(name_); 61 free(name_);
60 } 62 }
61 63
62 64
63 void OSThread::DisableThreadInterrupts() { 65 void OSThread::DisableThreadInterrupts() {
64 ASSERT(OSThread::Current() == this); 66 ASSERT(OSThread::Current() == this);
65 AtomicOperations::FetchAndIncrement(&thread_interrupt_disabled_); 67 AtomicOperations::FetchAndIncrement(&thread_interrupt_disabled_);
66 } 68 }
67 69
68 70
69 void OSThread::EnableThreadInterrupts() { 71 void OSThread::EnableThreadInterrupts() {
70 ASSERT(OSThread::Current() == this); 72 ASSERT(OSThread::Current() == this);
71 uintptr_t old = 73 uintptr_t old =
72 AtomicOperations::FetchAndDecrement(&thread_interrupt_disabled_); 74 AtomicOperations::FetchAndDecrement(&thread_interrupt_disabled_);
73 if (old == 1) { 75 if (FLAG_profiler && (old == 1)) {
74 // We just decremented from 1 to 0. 76 // We just decremented from 1 to 0.
75 // Make sure the thread interrupter is awake. 77 // Make sure the thread interrupter is awake.
76 ThreadInterrupter::WakeUp(); 78 ThreadInterrupter::WakeUp();
77 } 79 }
78 if (old == 0) { 80 if (old == 0) {
79 // We just decremented from 0, this means we've got a mismatched pair 81 // We just decremented from 0, this means we've got a mismatched pair
80 // of calls to EnableThreadInterrupts and DisableThreadInterrupts. 82 // of calls to EnableThreadInterrupts and DisableThreadInterrupts.
81 FATAL("Invalid call to OSThread::EnableThreadInterrupts()"); 83 FATAL("Invalid call to OSThread::EnableThreadInterrupts()");
82 } 84 }
83 } 85 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 270
269 OSThread* OSThreadIterator::Next() { 271 OSThread* OSThreadIterator::Next() {
270 ASSERT(OSThread::thread_list_lock_ != NULL); 272 ASSERT(OSThread::thread_list_lock_ != NULL);
271 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread()); 273 ASSERT(OSThread::thread_list_lock_->IsOwnedByCurrentThread());
272 OSThread* current = next_; 274 OSThread* current = next_;
273 next_ = next_->thread_list_next_; 275 next_ = next_->thread_list_next_;
274 return current; 276 return current;
275 } 277 }
276 278
277 } // namespace dart 279 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698