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 5481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5492 * thread at any given time. The Locker/Unlocker API must be used to | 5492 * thread at any given time. The Locker/Unlocker API must be used to |
5493 * synchronize. | 5493 * synchronize. |
5494 */ | 5494 */ |
5495 class V8_EXPORT Isolate { | 5495 class V8_EXPORT Isolate { |
5496 public: | 5496 public: |
5497 /** | 5497 /** |
5498 * Initial configuration parameters for a new Isolate. | 5498 * Initial configuration parameters for a new Isolate. |
5499 */ | 5499 */ |
5500 struct CreateParams { | 5500 struct CreateParams { |
5501 CreateParams() | 5501 CreateParams() |
5502 : entry_hook(NULL), | 5502 : entry_hook(nullptr), |
5503 code_event_handler(NULL), | 5503 code_event_handler(nullptr), |
5504 snapshot_blob(NULL), | 5504 snapshot_blob(nullptr), |
5505 counter_lookup_callback(NULL), | 5505 counter_lookup_callback(nullptr), |
5506 create_histogram_callback(NULL), | 5506 create_histogram_callback(nullptr), |
5507 add_histogram_sample_callback(NULL), | 5507 add_histogram_sample_callback(nullptr), |
5508 array_buffer_allocator(NULL) {} | 5508 array_buffer_allocator(nullptr), |
| 5509 external_references(nullptr) {} |
5509 | 5510 |
5510 /** | 5511 /** |
5511 * The optional entry_hook allows the host application to provide the | 5512 * The optional entry_hook allows the host application to provide the |
5512 * address of a function that's invoked on entry to every V8-generated | 5513 * address of a function that's invoked on entry to every V8-generated |
5513 * function. Note that entry_hook is invoked at the very start of each | 5514 * function. Note that entry_hook is invoked at the very start of each |
5514 * generated function. Furthermore, if an entry_hook is given, V8 will | 5515 * generated function. Furthermore, if an entry_hook is given, V8 will |
5515 * not use a snapshot, including custom snapshots. | 5516 * not use a snapshot, including custom snapshots. |
5516 */ | 5517 */ |
5517 FunctionEntryHook entry_hook; | 5518 FunctionEntryHook entry_hook; |
5518 | 5519 |
(...skipping 27 matching lines...) Expand all Loading... |
5546 * function. | 5547 * function. |
5547 */ | 5548 */ |
5548 CreateHistogramCallback create_histogram_callback; | 5549 CreateHistogramCallback create_histogram_callback; |
5549 AddHistogramSampleCallback add_histogram_sample_callback; | 5550 AddHistogramSampleCallback add_histogram_sample_callback; |
5550 | 5551 |
5551 /** | 5552 /** |
5552 * The ArrayBuffer::Allocator to use for allocating and freeing the backing | 5553 * The ArrayBuffer::Allocator to use for allocating and freeing the backing |
5553 * store of ArrayBuffers. | 5554 * store of ArrayBuffers. |
5554 */ | 5555 */ |
5555 ArrayBuffer::Allocator* array_buffer_allocator; | 5556 ArrayBuffer::Allocator* array_buffer_allocator; |
| 5557 |
| 5558 /** |
| 5559 * Specifies an optional nullptr-terminated array of raw addresses in the |
| 5560 * embedder that V8 can match against during serialization and use for |
| 5561 * deserialization. This array and its content must stay valid for the |
| 5562 * entire lifetime of the isolate. |
| 5563 */ |
| 5564 intptr_t* external_references; |
5556 }; | 5565 }; |
5557 | 5566 |
5558 | 5567 |
5559 /** | 5568 /** |
5560 * Stack-allocated class which sets the isolate for all operations | 5569 * Stack-allocated class which sets the isolate for all operations |
5561 * executed within a local scope. | 5570 * executed within a local scope. |
5562 */ | 5571 */ |
5563 class V8_EXPORT Scope { | 5572 class V8_EXPORT Scope { |
5564 public: | 5573 public: |
5565 explicit Scope(Isolate* isolate) : isolate_(isolate) { | 5574 explicit Scope(Isolate* isolate) : isolate_(isolate) { |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6774 * Helper class to create a snapshot data blob. | 6783 * Helper class to create a snapshot data blob. |
6775 */ | 6784 */ |
6776 class SnapshotCreator { | 6785 class SnapshotCreator { |
6777 public: | 6786 public: |
6778 enum class FunctionCodeHandling { kClear, kKeep }; | 6787 enum class FunctionCodeHandling { kClear, kKeep }; |
6779 | 6788 |
6780 /** | 6789 /** |
6781 * Create and enter an isolate, and set it up for serialization. | 6790 * Create and enter an isolate, and set it up for serialization. |
6782 * The isolate is either created from scratch or from an existing snapshot. | 6791 * The isolate is either created from scratch or from an existing snapshot. |
6783 * The caller keeps ownership of the argument snapshot. | 6792 * The caller keeps ownership of the argument snapshot. |
| 6793 * \param existing_blob existing snapshot from which to create this one. |
| 6794 * \param external_references a null-terminated array of external references |
| 6795 * that must be equivalent to CreateParams::external_references. |
6784 */ | 6796 */ |
6785 explicit SnapshotCreator(StartupData* existing_blob = nullptr); | 6797 SnapshotCreator(intptr_t* external_references = nullptr, |
| 6798 StartupData* existing_blob = nullptr); |
6786 | 6799 |
6787 ~SnapshotCreator(); | 6800 ~SnapshotCreator(); |
6788 | 6801 |
6789 /** | 6802 /** |
6790 * \returns the isolate prepared by the snapshot creator. | 6803 * \returns the isolate prepared by the snapshot creator. |
6791 */ | 6804 */ |
6792 Isolate* GetIsolate(); | 6805 Isolate* GetIsolate(); |
6793 | 6806 |
6794 /** | 6807 /** |
6795 * Add a context to be included in the snapshot blob. | 6808 * Add a context to be included in the snapshot blob. |
6796 * \returns the index of the context in the snapshot blob. | 6809 * \returns the index of the context in the snapshot blob. |
6797 */ | 6810 */ |
6798 size_t AddContext(Local<Context> context); | 6811 size_t AddContext(Local<Context> context); |
6799 | 6812 |
6800 /** | 6813 /** |
6801 * Created a snapshot data blob. | 6814 * Created a snapshot data blob. |
| 6815 * This must not be called from within a handle scope. |
6802 * \param function_code_handling whether to include compiled function code | 6816 * \param function_code_handling whether to include compiled function code |
6803 * in the snapshot. | 6817 * in the snapshot. |
6804 * \returns { nullptr, 0 } on failure, and a startup snapshot on success. The | 6818 * \returns { nullptr, 0 } on failure, and a startup snapshot on success. The |
6805 * caller acquires ownership of the data array in the return value. | 6819 * caller acquires ownership of the data array in the return value. |
6806 */ | 6820 */ |
6807 StartupData CreateBlob(FunctionCodeHandling function_code_handling); | 6821 StartupData CreateBlob(FunctionCodeHandling function_code_handling); |
6808 | 6822 |
6809 private: | 6823 private: |
6810 void* data_; | 6824 void* data_; |
6811 | 6825 |
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8859 */ | 8873 */ |
8860 | 8874 |
8861 | 8875 |
8862 } // namespace v8 | 8876 } // namespace v8 |
8863 | 8877 |
8864 | 8878 |
8865 #undef TYPE_CHECK | 8879 #undef TYPE_CHECK |
8866 | 8880 |
8867 | 8881 |
8868 #endif // INCLUDE_V8_H_ | 8882 #endif // INCLUDE_V8_H_ |
OLD | NEW |