OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ISOLATE_H_ | 5 #ifndef V8_ISOLATE_H_ |
6 #define V8_ISOLATE_H_ | 6 #define V8_ISOLATE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 474 |
475 // Returns the isolate inside which the current thread is running. | 475 // Returns the isolate inside which the current thread is running. |
476 INLINE(static Isolate* Current()) { | 476 INLINE(static Isolate* Current()) { |
477 DCHECK(base::NoBarrier_Load(&isolate_key_created_) == 1); | 477 DCHECK(base::NoBarrier_Load(&isolate_key_created_) == 1); |
478 Isolate* isolate = reinterpret_cast<Isolate*>( | 478 Isolate* isolate = reinterpret_cast<Isolate*>( |
479 base::Thread::GetExistingThreadLocal(isolate_key_)); | 479 base::Thread::GetExistingThreadLocal(isolate_key_)); |
480 DCHECK(isolate != NULL); | 480 DCHECK(isolate != NULL); |
481 return isolate; | 481 return isolate; |
482 } | 482 } |
483 | 483 |
484 INLINE(static Isolate* UncheckedCurrent()) { | 484 // Like Current, but skips the check that |isolate_key_| was initialized. |
485 DCHECK(base::NoBarrier_Load(&isolate_key_created_) == 1); | 485 // Callers have to ensure that themselves. |
486 return reinterpret_cast<Isolate*>( | 486 // DO NOT USE. The only remaining callsite will be deleted soon. |
487 base::Thread::GetThreadLocal(isolate_key_)); | |
488 } | |
489 | |
490 // Like UncheckedCurrent, but skips the check that |isolate_key_| was | |
491 // initialized. Callers have to ensure that themselves. | |
492 INLINE(static Isolate* UnsafeCurrent()) { | 487 INLINE(static Isolate* UnsafeCurrent()) { |
493 return reinterpret_cast<Isolate*>( | 488 return reinterpret_cast<Isolate*>( |
494 base::Thread::GetThreadLocal(isolate_key_)); | 489 base::Thread::GetThreadLocal(isolate_key_)); |
495 } | 490 } |
496 | 491 |
497 // Usually called by Init(), but can be called early e.g. to allow | 492 // Usually called by Init(), but can be called early e.g. to allow |
498 // testing components that require logging but not the whole | 493 // testing components that require logging but not the whole |
499 // isolate. | 494 // isolate. |
500 // | 495 // |
501 // Safe to call more than once. | 496 // Safe to call more than once. |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 | 1561 |
1567 EmbeddedVector<char, 128> filename_; | 1562 EmbeddedVector<char, 128> filename_; |
1568 FILE* file_; | 1563 FILE* file_; |
1569 int scope_depth_; | 1564 int scope_depth_; |
1570 }; | 1565 }; |
1571 | 1566 |
1572 } // namespace internal | 1567 } // namespace internal |
1573 } // namespace v8 | 1568 } // namespace v8 |
1574 | 1569 |
1575 #endif // V8_ISOLATE_H_ | 1570 #endif // V8_ISOLATE_H_ |
OLD | NEW |