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 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 5737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5748 * trace through its heap and call PersistentBase::RegisterExternalReference on | 5748 * trace through its heap and call PersistentBase::RegisterExternalReference on |
5749 * each js object reachable from any of the given wrappers. | 5749 * each js object reachable from any of the given wrappers. |
5750 * | 5750 * |
5751 * Before the first call to the TraceWrappersFrom function TracePrologue will be | 5751 * Before the first call to the TraceWrappersFrom function TracePrologue will be |
5752 * called. When the garbage collection cycle is finished, TraceEpilogue will be | 5752 * called. When the garbage collection cycle is finished, TraceEpilogue will be |
5753 * called. | 5753 * called. |
5754 */ | 5754 */ |
5755 class V8_EXPORT EmbedderHeapTracer { | 5755 class V8_EXPORT EmbedderHeapTracer { |
5756 public: | 5756 public: |
5757 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; | 5757 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; |
| 5758 |
5758 struct AdvanceTracingActions { | 5759 struct AdvanceTracingActions { |
5759 explicit AdvanceTracingActions(ForceCompletionAction force_completion_) | 5760 explicit AdvanceTracingActions(ForceCompletionAction force_completion_) |
5760 : force_completion(force_completion_) {} | 5761 : force_completion(force_completion_) {} |
5761 | 5762 |
5762 ForceCompletionAction force_completion; | 5763 ForceCompletionAction force_completion; |
5763 }; | 5764 }; |
| 5765 |
5764 /** | 5766 /** |
5765 * V8 will call this method with internal fields of found wrappers. | 5767 * V8 will call this method with internal fields of found wrappers. The |
5766 * Embedder is expected to store them in it's marking deque and trace | 5768 * embedder is expected to store them in its marking deque and trace |
5767 * reachable wrappers from them when asked by AdvanceTracing method. | 5769 * reachable wrappers from them when called through |AdvanceTracing|. |
5768 */ | 5770 */ |
5769 virtual void RegisterV8References( | 5771 virtual void RegisterV8References( |
5770 const std::vector<std::pair<void*, void*> >& internal_fields) = 0; | 5772 const std::vector<std::pair<void*, void*> >& internal_fields) = 0; |
| 5773 |
5771 /** | 5774 /** |
5772 * V8 will call this method at the beginning of the gc cycle. | 5775 * V8 will call this method at the beginning of a GC cycle. |
5773 */ | 5776 */ |
5774 virtual void TracePrologue() = 0; | 5777 virtual void TracePrologue() = 0; |
| 5778 |
5775 /** | 5779 /** |
5776 * Embedder is expected to trace its heap starting from wrappers reported by | 5780 * Embedder is expected to trace its heap starting from wrappers reported by |
5777 * RegisterV8References method, and call | 5781 * RegisterV8References method, and call |
5778 * PersistentBase::RegisterExternalReference() on all reachable wrappers. | 5782 * PersistentBase::RegisterExternalReference() on all reachable wrappers. |
5779 * Embedder is expected to stop tracing by the given deadline. | 5783 * Embedder is expected to stop tracing by the given deadline. |
5780 * | 5784 * |
5781 * Returns true if there is still work to do. | 5785 * Returns true if there is still work to do. |
5782 */ | 5786 */ |
5783 virtual bool AdvanceTracing(double deadline_in_ms, | 5787 virtual bool AdvanceTracing(double deadline_in_ms, |
5784 AdvanceTracingActions actions) = 0; | 5788 AdvanceTracingActions actions) = 0; |
| 5789 |
5785 /** | 5790 /** |
5786 * V8 will call this method at the end of the gc cycle. Allocation is *not* | 5791 * V8 will call this method at the end of a GC cycle. |
5787 * allowed in the TraceEpilogue. | 5792 * |
| 5793 * Note that allocation is *not* allowed within |TraceEpilogue|. |
5788 */ | 5794 */ |
5789 virtual void TraceEpilogue() = 0; | 5795 virtual void TraceEpilogue() = 0; |
5790 | 5796 |
5791 /** | 5797 /** |
5792 * Let embedder know v8 entered final marking pause (no more incremental steps | 5798 * Let embedder know v8 entered final marking pause (no more incremental steps |
5793 * will follow). | 5799 * will follow). |
5794 */ | 5800 */ |
5795 virtual void EnterFinalPause() {} | 5801 virtual void EnterFinalPause() {} |
5796 | 5802 |
5797 /** | 5803 /** |
5798 * Throw away all intermediate data and reset to the initial state. | 5804 * Throw away all intermediate data and reset to the initial state. |
5799 */ | 5805 */ |
5800 virtual void AbortTracing() {} | 5806 virtual void AbortTracing() {} |
5801 | 5807 |
| 5808 /** |
| 5809 * Returns the number of wrappers that are still to be traced by the embedder. |
| 5810 */ |
| 5811 virtual size_t NumberOfWrappersToTrace() { return 0; } |
| 5812 |
5802 protected: | 5813 protected: |
5803 virtual ~EmbedderHeapTracer() = default; | 5814 virtual ~EmbedderHeapTracer() = default; |
5804 }; | 5815 }; |
5805 | 5816 |
5806 /** | 5817 /** |
5807 * Isolate represents an isolated instance of the V8 engine. V8 isolates have | 5818 * Isolate represents an isolated instance of the V8 engine. V8 isolates have |
5808 * completely separate states. Objects from one isolate must not be used in | 5819 * completely separate states. Objects from one isolate must not be used in |
5809 * other isolates. The embedder can create multiple isolates and use them in | 5820 * other isolates. The embedder can create multiple isolates and use them in |
5810 * parallel in multiple threads. An isolate can be entered by at most one | 5821 * parallel in multiple threads. An isolate can be entered by at most one |
5811 * thread at any given time. The Locker/Unlocker API must be used to | 5822 * thread at any given time. The Locker/Unlocker API must be used to |
(...skipping 3421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9233 */ | 9244 */ |
9234 | 9245 |
9235 | 9246 |
9236 } // namespace v8 | 9247 } // namespace v8 |
9237 | 9248 |
9238 | 9249 |
9239 #undef TYPE_CHECK | 9250 #undef TYPE_CHECK |
9240 | 9251 |
9241 | 9252 |
9242 #endif // INCLUDE_V8_H_ | 9253 #endif // INCLUDE_V8_H_ |
OLD | NEW |