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 5395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5406 */ | 5406 */ |
5407 enum class MemoryPressureLevel { kNone, kModerate, kCritical }; | 5407 enum class MemoryPressureLevel { kNone, kModerate, kCritical }; |
5408 | 5408 |
5409 /** | 5409 /** |
5410 * Interface for tracing through the embedder heap. During the v8 garbage | 5410 * Interface for tracing through the embedder heap. During the v8 garbage |
5411 * collection, v8 collects hidden fields of all potential wrappers, and at the | 5411 * collection, v8 collects hidden fields of all potential wrappers, and at the |
5412 * end of its marking phase iterates the collection and asks the embedder to | 5412 * end of its marking phase iterates the collection and asks the embedder to |
5413 * trace through its heap and call PersistentBase::RegisterExternalReference on | 5413 * trace through its heap and call PersistentBase::RegisterExternalReference on |
5414 * each js object reachable from any of the given wrappers. | 5414 * each js object reachable from any of the given wrappers. |
5415 * | 5415 * |
5416 * Before the first call to the TraceWrappersFrom function v8 will call | 5416 * Before the first call to the TraceWrappersFrom function TracePrologue will be |
5417 * TracePrologue. When the v8 garbage collection is finished, v8 will call | 5417 * called. When the garbage collection cycle is finished, TraceEpilogue will be |
5418 * TraceEpilogue. | 5418 * called. |
5419 */ | 5419 */ |
5420 class EmbedderHeapTracer { | 5420 class EmbedderHeapTracer { |
5421 public: | 5421 public: |
5422 /** | 5422 /** |
5423 * V8 will call this method at the beginning of the gc cycle. | 5423 * V8 will call this method at the beginning of the gc cycle. |
5424 */ | 5424 */ |
5425 virtual void TracePrologue(Isolate* isolate) = 0; | 5425 virtual void TracePrologue() = 0; |
5426 | |
5427 /** | 5426 /** |
5428 * V8 will call this method with internal fields of a potential wrappers. | 5427 * V8 will call this method with internal fields of a potential wrappers. |
5429 * Embedder is expected to trace its heap (synchronously) and call | 5428 * Embedder is expected to trace its heap (synchronously) and call |
5430 * PersistentBase::RegisterExternalReference() on all wrappers reachable from | 5429 * PersistentBase::RegisterExternalReference() on all wrappers reachable from |
5431 * any of the given wrappers. | 5430 * any of the given wrappers. |
5432 */ | 5431 */ |
5433 virtual void TraceWrappersFrom( | 5432 virtual void TraceWrappersFrom( |
5434 Isolate* isolate, | |
5435 const std::vector<std::pair<void*, void*> >& internal_fields) = 0; | 5433 const std::vector<std::pair<void*, void*> >& internal_fields) = 0; |
5436 /** | 5434 /** |
5437 * V8 will call this method at the end of the gc cycle. Allocation is *not* | 5435 * V8 will call this method at the end of the gc cycle. Allocation is *not* |
5438 * allowed in the TraceEpilogue. | 5436 * allowed in the TraceEpilogue. |
5439 */ | 5437 */ |
5440 virtual void TraceEpilogue(Isolate* isolate) = 0; | 5438 virtual void TraceEpilogue() = 0; |
5441 | 5439 |
5442 protected: | 5440 protected: |
5443 virtual ~EmbedderHeapTracer() = default; | 5441 virtual ~EmbedderHeapTracer() = default; |
5444 }; | 5442 }; |
5445 | 5443 |
5446 /** | 5444 /** |
5447 * Isolate represents an isolated instance of the V8 engine. V8 isolates have | 5445 * Isolate represents an isolated instance of the V8 engine. V8 isolates have |
5448 * completely separate states. Objects from one isolate must not be used in | 5446 * completely separate states. Objects from one isolate must not be used in |
5449 * other isolates. The embedder can create multiple isolates and use them in | 5447 * other isolates. The embedder can create multiple isolates and use them in |
5450 * parallel in multiple threads. An isolate can be entered by at most one | 5448 * parallel in multiple threads. An isolate can be entered by at most one |
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8773 */ | 8771 */ |
8774 | 8772 |
8775 | 8773 |
8776 } // namespace v8 | 8774 } // namespace v8 |
8777 | 8775 |
8778 | 8776 |
8779 #undef TYPE_CHECK | 8777 #undef TYPE_CHECK |
8780 | 8778 |
8781 | 8779 |
8782 #endif // INCLUDE_V8_H_ | 8780 #endif // INCLUDE_V8_H_ |
OLD | NEW |