Chromium Code Reviews| 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 5343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5354 * Memory pressure level for the MemoryPressureNotification. | 5354 * Memory pressure level for the MemoryPressureNotification. |
| 5355 * kNone hints V8 that there is no memory pressure. | 5355 * kNone hints V8 that there is no memory pressure. |
| 5356 * kModerate hints V8 to speed up incremental garbage collection at the cost of | 5356 * kModerate hints V8 to speed up incremental garbage collection at the cost of |
| 5357 * of higher latency due to garbage collection pauses. | 5357 * of higher latency due to garbage collection pauses. |
| 5358 * kCritical hints V8 to free memory as soon as possible. Garbage collection | 5358 * kCritical hints V8 to free memory as soon as possible. Garbage collection |
| 5359 * pauses at this level will be large. | 5359 * pauses at this level will be large. |
| 5360 */ | 5360 */ |
| 5361 enum class MemoryPressureLevel { kNone, kModerate, kCritical }; | 5361 enum class MemoryPressureLevel { kNone, kModerate, kCritical }; |
| 5362 | 5362 |
| 5363 /** | 5363 /** |
| 5364 * Structure representing hidden fields of the v8 object. Embedder sets these | |
| 5365 * fields on wrapper creation to be able to access the object wrapped by the | |
| 5366 * wrapper. | |
| 5367 */ | |
| 5368 struct WrapperHiddenFields { | |
|
jochen (gone - plz use gerrit)
2016/03/30 16:44:45
why not just std::pair<void*,void*>?
Marcel Hlopko
2016/03/30 18:51:12
Because I didn't know it exists :) Done.
| |
| 5369 WrapperHiddenFields(void* wrapper_info_ptr, void* wrapper_source_ptr) | |
| 5370 : wrapper_info(wrapper_info_ptr), wrapper_source(wrapper_source_ptr) {} | |
| 5371 void* wrapper_info; | |
| 5372 void* wrapper_source; | |
| 5373 }; | |
| 5374 | |
| 5375 /** | |
| 5376 * Interface for tracing through the embedder heap. During the v8 garbage | |
| 5377 * collection, v8 collects hidden fields of all potential wrappers, and at the | |
| 5378 * end of its marking phase iterates the collection and asks the embedder to | |
| 5379 * trace through its heap and call Isolate::AddObjectToMarkingDeque for each js | |
| 5380 * object reachable from the given one. | |
| 5381 * | |
| 5382 * Before the first call to the TraceWrappableFrom function v8 will call | |
| 5383 * TraceRoots. When the v8 garbage collection is finished, v8 will call | |
| 5384 * ClearTracingMarks. | |
| 5385 */ | |
| 5386 class EmbedderHeapTracer { | |
| 5387 public: | |
| 5388 /** | |
| 5389 * V8 will call this method at the beginning of the gc cycle. | |
| 5390 */ | |
| 5391 virtual void TraceRoots(Isolate* isolate) {} | |
|
jochen (gone - plz use gerrit)
2016/03/30 16:44:45
= 0;
also add an empty line after this one
Marcel Hlopko
2016/03/30 18:51:12
done
| |
| 5392 /** | |
| 5393 * V8 will call this method with internal fields of a potential wrapper. | |
| 5394 * Embedder is expected to trace its heap (synchronously) and call | |
| 5395 * Isolate::AddObjectToMarkingDeque() with all wrappers reachable from the | |
| 5396 * given one. | |
| 5397 */ | |
| 5398 virtual void TraceWrappableFrom(Isolate* isolate, | |
| 5399 WrapperHiddenFields internal_fields) {} | |
|
jochen (gone - plz use gerrit)
2016/03/30 16:44:45
same here.
why not pass a const std::vector<Hidde
Marcel Hlopko
2016/03/30 18:51:12
Done
| |
| 5400 /** | |
| 5401 * V8 will call this method at the end of the gc cycle. Allocation is *not* | |
| 5402 * allowed in the ClearTracingMarks. | |
| 5403 */ | |
| 5404 virtual void ClearTracingMarks(Isolate* isolate) {} | |
|
jochen (gone - plz use gerrit)
2016/03/30 16:44:45
= 0;
Marcel Hlopko
2016/03/30 18:51:11
Done
| |
| 5405 | |
| 5406 protected: | |
| 5407 virtual ~EmbedderHeapTracer() {} | |
|
jochen (gone - plz use gerrit)
2016/03/30 16:44:45
= default;
Marcel Hlopko
2016/03/30 18:51:12
Done
| |
| 5408 }; | |
| 5409 | |
| 5410 /** | |
| 5364 * Isolate represents an isolated instance of the V8 engine. V8 isolates have | 5411 * Isolate represents an isolated instance of the V8 engine. V8 isolates have |
| 5365 * completely separate states. Objects from one isolate must not be used in | 5412 * completely separate states. Objects from one isolate must not be used in |
| 5366 * other isolates. The embedder can create multiple isolates and use them in | 5413 * other isolates. The embedder can create multiple isolates and use them in |
| 5367 * parallel in multiple threads. An isolate can be entered by at most one | 5414 * parallel in multiple threads. An isolate can be entered by at most one |
| 5368 * thread at any given time. The Locker/Unlocker API must be used to | 5415 * thread at any given time. The Locker/Unlocker API must be used to |
| 5369 * synchronize. | 5416 * synchronize. |
| 5370 */ | 5417 */ |
| 5371 class V8_EXPORT Isolate { | 5418 class V8_EXPORT Isolate { |
| 5372 public: | 5419 public: |
| 5373 /** | 5420 /** |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5580 | 5627 |
| 5581 /** | 5628 /** |
| 5582 * Returns the entered isolate for the current thread or NULL in | 5629 * Returns the entered isolate for the current thread or NULL in |
| 5583 * case there is no current isolate. | 5630 * case there is no current isolate. |
| 5584 * | 5631 * |
| 5585 * This method must not be invoked before V8::Initialize() was invoked. | 5632 * This method must not be invoked before V8::Initialize() was invoked. |
| 5586 */ | 5633 */ |
| 5587 static Isolate* GetCurrent(); | 5634 static Isolate* GetCurrent(); |
| 5588 | 5635 |
| 5589 /** | 5636 /** |
| 5637 * Allows the embedder to add objects to the marking deque of the v8 garbage | |
| 5638 * collector. Only allowed when the embedder is asked to trace its heap by | |
| 5639 * EmbedderHeapTracer. | |
| 5640 */ | |
| 5641 void AddObjectToMarkingDeque(PersistentBase<Object>* handle); | |
|
jochen (gone - plz use gerrit)
2016/03/30 16:44:45
why not make this a member of PersistentBase?
Marcel Hlopko
2016/03/30 18:51:11
Done
| |
| 5642 | |
| 5643 /** | |
| 5590 * Custom callback used by embedders to help V8 determine if it should abort | 5644 * Custom callback used by embedders to help V8 determine if it should abort |
| 5591 * when it throws and no internal handler is predicted to catch the | 5645 * when it throws and no internal handler is predicted to catch the |
| 5592 * exception. If --abort-on-uncaught-exception is used on the command line, | 5646 * exception. If --abort-on-uncaught-exception is used on the command line, |
| 5593 * then V8 will abort if either: | 5647 * then V8 will abort if either: |
| 5594 * - no custom callback is set. | 5648 * - no custom callback is set. |
| 5595 * - the custom callback set returns true. | 5649 * - the custom callback set returns true. |
| 5596 * Otherwise, the custom callback will not be called and V8 will not abort. | 5650 * Otherwise, the custom callback will not be called and V8 will not abort. |
| 5597 */ | 5651 */ |
| 5598 typedef bool (*AbortOnUncaughtExceptionCallback)(Isolate*); | 5652 typedef bool (*AbortOnUncaughtExceptionCallback)(Isolate*); |
| 5599 void SetAbortOnUncaughtExceptionCallback( | 5653 void SetAbortOnUncaughtExceptionCallback( |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5822 void AddGCPrologueCallback(GCCallback callback, | 5876 void AddGCPrologueCallback(GCCallback callback, |
| 5823 GCType gc_type_filter = kGCTypeAll); | 5877 GCType gc_type_filter = kGCTypeAll); |
| 5824 | 5878 |
| 5825 /** | 5879 /** |
| 5826 * This function removes callback which was installed by | 5880 * This function removes callback which was installed by |
| 5827 * AddGCPrologueCallback function. | 5881 * AddGCPrologueCallback function. |
| 5828 */ | 5882 */ |
| 5829 void RemoveGCPrologueCallback(GCCallback callback); | 5883 void RemoveGCPrologueCallback(GCCallback callback); |
| 5830 | 5884 |
| 5831 /** | 5885 /** |
| 5886 * Sets the embedder heap tracer for the isolate. | |
| 5887 */ | |
| 5888 void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer); | |
| 5889 | |
| 5890 /** | |
| 5891 * Gets embedder heap tracer associated with the isolate, or nullptr. | |
| 5892 */ | |
| 5893 EmbedderHeapTracer* embedder_heap_tracer(); | |
|
jochen (gone - plz use gerrit)
2016/03/30 16:44:45
shouldn't be needed
Marcel Hlopko
2016/03/30 18:51:11
Sure it's not :) Removed.
| |
| 5894 | |
| 5895 /** | |
| 5832 * Enables the host application to receive a notification after a | 5896 * Enables the host application to receive a notification after a |
| 5833 * garbage collection. Allocations are allowed in the callback function, | 5897 * garbage collection. Allocations are allowed in the callback function, |
| 5834 * but the callback is not re-entrant: if the allocation inside it will | 5898 * but the callback is not re-entrant: if the allocation inside it will |
| 5835 * trigger the garbage collection, the callback won't be called again. | 5899 * trigger the garbage collection, the callback won't be called again. |
| 5836 * It is possible to specify the GCType filter for your callback. But it is | 5900 * It is possible to specify the GCType filter for your callback. But it is |
| 5837 * not possible to register the same callback function two times with | 5901 * not possible to register the same callback function two times with |
| 5838 * different GCType filters. | 5902 * different GCType filters. |
| 5839 */ | 5903 */ |
| 5840 void AddGCEpilogueCallback(GCCallback callback, | 5904 void AddGCEpilogueCallback(GCCallback callback, |
| 5841 GCType gc_type_filter = kGCTypeAll); | 5905 GCType gc_type_filter = kGCTypeAll); |
| (...skipping 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8687 */ | 8751 */ |
| 8688 | 8752 |
| 8689 | 8753 |
| 8690 } // namespace v8 | 8754 } // namespace v8 |
| 8691 | 8755 |
| 8692 | 8756 |
| 8693 #undef TYPE_CHECK | 8757 #undef TYPE_CHECK |
| 8694 | 8758 |
| 8695 | 8759 |
| 8696 #endif // INCLUDE_V8_H_ | 8760 #endif // INCLUDE_V8_H_ |
| OLD | NEW |