| 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 3571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3582 * Neuters this ArrayBuffer and all its views (typed arrays). | 3582 * Neuters this ArrayBuffer and all its views (typed arrays). |
| 3583 * Neutering sets the byte length of the buffer and all typed arrays to zero, | 3583 * Neutering sets the byte length of the buffer and all typed arrays to zero, |
| 3584 * preventing JavaScript from ever accessing underlying backing store. | 3584 * preventing JavaScript from ever accessing underlying backing store. |
| 3585 * ArrayBuffer should have been externalized and must be neuterable. | 3585 * ArrayBuffer should have been externalized and must be neuterable. |
| 3586 */ | 3586 */ |
| 3587 void Neuter(); | 3587 void Neuter(); |
| 3588 | 3588 |
| 3589 /** | 3589 /** |
| 3590 * Make this ArrayBuffer external. The pointer to underlying memory block | 3590 * Make this ArrayBuffer external. The pointer to underlying memory block |
| 3591 * and byte length are returned as |Contents| structure. After ArrayBuffer | 3591 * and byte length are returned as |Contents| structure. After ArrayBuffer |
| 3592 * had been etxrenalized, it does no longer owns the memory block. The caller | 3592 * had been externalized, it does no longer own the memory block. The caller |
| 3593 * should take steps to free memory when it is no longer needed. | 3593 * should take steps to free memory when it is no longer needed. |
| 3594 * | 3594 * |
| 3595 * The memory block is guaranteed to be allocated with |Allocator::Allocate| | 3595 * The memory block is guaranteed to be allocated with |Allocator::Allocate| |
| 3596 * that has been set via Isolate::CreateParams. | 3596 * that has been set via Isolate::CreateParams. |
| 3597 */ | 3597 */ |
| 3598 Contents Externalize(); | 3598 Contents Externalize(); |
| 3599 | 3599 |
| 3600 /** | 3600 /** |
| 3601 * Get a pointer to the ArrayBuffer's underlying memory block without | 3601 * Get a pointer to the ArrayBuffer's underlying memory block without |
| 3602 * externalizing it. If the ArrayBuffer is not externalized, this pointer | 3602 * externalizing it. If the ArrayBuffer is not externalized, this pointer |
| 3603 * will become invalid as soon as the ArrayBuffer became garbage collected. | 3603 * will become invalid as soon as the ArrayBuffer gets garbage collected. |
| 3604 * | 3604 * |
| 3605 * The embedder should make sure to hold a strong reference to the | 3605 * The embedder should make sure to hold a strong reference to the |
| 3606 * ArrayBuffer while accessing this pointer. | 3606 * ArrayBuffer while accessing this pointer. |
| 3607 * | 3607 * |
| 3608 * The memory block is guaranteed to be allocated with |Allocator::Allocate|. | 3608 * The memory block is guaranteed to be allocated with |Allocator::Allocate|. |
| 3609 */ | 3609 */ |
| 3610 Contents GetContents(); | 3610 Contents GetContents(); |
| 3611 | 3611 |
| 3612 V8_INLINE static ArrayBuffer* Cast(Value* obj); | 3612 V8_INLINE static ArrayBuffer* Cast(Value* obj); |
| 3613 | 3613 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3645 * Size of a view in bytes. | 3645 * Size of a view in bytes. |
| 3646 */ | 3646 */ |
| 3647 size_t ByteLength(); | 3647 size_t ByteLength(); |
| 3648 | 3648 |
| 3649 /** | 3649 /** |
| 3650 * Copy the contents of the ArrayBufferView's buffer to an embedder defined | 3650 * Copy the contents of the ArrayBufferView's buffer to an embedder defined |
| 3651 * memory without additional overhead that calling ArrayBufferView::Buffer | 3651 * memory without additional overhead that calling ArrayBufferView::Buffer |
| 3652 * might incur. | 3652 * might incur. |
| 3653 * | 3653 * |
| 3654 * Will write at most min(|byte_length|, ByteLength) bytes starting at | 3654 * Will write at most min(|byte_length|, ByteLength) bytes starting at |
| 3655 * ByteOffset of the underling buffer to the memory starting at |dest|. | 3655 * ByteOffset of the underlying buffer to the memory starting at |dest|. |
| 3656 * Returns the number of bytes actually written. | 3656 * Returns the number of bytes actually written. |
| 3657 */ | 3657 */ |
| 3658 size_t CopyContents(void* dest, size_t byte_length); | 3658 size_t CopyContents(void* dest, size_t byte_length); |
| 3659 | 3659 |
| 3660 /** | 3660 /** |
| 3661 * Returns true if ArrayBufferView's backing ArrayBuffer has already been | 3661 * Returns true if ArrayBufferView's backing ArrayBuffer has already been |
| 3662 * allocated. | 3662 * allocated. |
| 3663 */ | 3663 */ |
| 3664 bool HasBuffer() const; | 3664 bool HasBuffer() const; |
| 3665 | 3665 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3932 | 3932 |
| 3933 /** | 3933 /** |
| 3934 * Returns true if SharedArrayBuffer is externalized, that is, does not | 3934 * Returns true if SharedArrayBuffer is externalized, that is, does not |
| 3935 * own its memory block. | 3935 * own its memory block. |
| 3936 */ | 3936 */ |
| 3937 bool IsExternal() const; | 3937 bool IsExternal() const; |
| 3938 | 3938 |
| 3939 /** | 3939 /** |
| 3940 * Make this SharedArrayBuffer external. The pointer to underlying memory | 3940 * Make this SharedArrayBuffer external. The pointer to underlying memory |
| 3941 * block and byte length are returned as |Contents| structure. After | 3941 * block and byte length are returned as |Contents| structure. After |
| 3942 * SharedArrayBuffer had been etxrenalized, it does no longer owns the memory | 3942 * SharedArrayBuffer had been externalized, it does no longer own the memory |
| 3943 * block. The caller should take steps to free memory when it is no longer | 3943 * block. The caller should take steps to free memory when it is no longer |
| 3944 * needed. | 3944 * needed. |
| 3945 * | 3945 * |
| 3946 * The memory block is guaranteed to be allocated with |Allocator::Allocate| | 3946 * The memory block is guaranteed to be allocated with |Allocator::Allocate| |
| 3947 * by the allocator specified in | 3947 * by the allocator specified in |
| 3948 * v8::Isolate::CreateParams::array_buffer_allocator. | 3948 * v8::Isolate::CreateParams::array_buffer_allocator. |
| 3949 * | 3949 * |
| 3950 */ | 3950 */ |
| 3951 Contents Externalize(); | 3951 Contents Externalize(); |
| 3952 | 3952 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4395 | 4395 |
| 4396 /** | 4396 /** |
| 4397 * A FunctionTemplate is used to create functions at runtime. There | 4397 * A FunctionTemplate is used to create functions at runtime. There |
| 4398 * can only be one function created from a FunctionTemplate in a | 4398 * can only be one function created from a FunctionTemplate in a |
| 4399 * context. The lifetime of the created function is equal to the | 4399 * context. The lifetime of the created function is equal to the |
| 4400 * lifetime of the context. So in case the embedder needs to create | 4400 * lifetime of the context. So in case the embedder needs to create |
| 4401 * temporary functions that can be collected using Scripts is | 4401 * temporary functions that can be collected using Scripts is |
| 4402 * preferred. | 4402 * preferred. |
| 4403 * | 4403 * |
| 4404 * Any modification of a FunctionTemplate after first instantiation will trigger | 4404 * Any modification of a FunctionTemplate after first instantiation will trigger |
| 4405 *a crash. | 4405 * a crash. |
| 4406 * | 4406 * |
| 4407 * A FunctionTemplate can have properties, these properties are added to the | 4407 * A FunctionTemplate can have properties, these properties are added to the |
| 4408 * function object when it is created. | 4408 * function object when it is created. |
| 4409 * | 4409 * |
| 4410 * A FunctionTemplate has a corresponding instance template which is | 4410 * A FunctionTemplate has a corresponding instance template which is |
| 4411 * used to create object instances when the function is used as a | 4411 * used to create object instances when the function is used as a |
| 4412 * constructor. Properties added to the instance template are added to | 4412 * constructor. Properties added to the instance template are added to |
| 4413 * each object instance. | 4413 * each object instance. |
| 4414 * | 4414 * |
| 4415 * A FunctionTemplate can have a prototype template. The prototype template | 4415 * A FunctionTemplate can have a prototype template. The prototype template |
| (...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7220 | 7220 |
| 7221 /** | 7221 /** |
| 7222 * Sets the embedder data with the given index, growing the data as | 7222 * Sets the embedder data with the given index, growing the data as |
| 7223 * needed. Note that index 0 currently has a special meaning for Chrome's | 7223 * needed. Note that index 0 currently has a special meaning for Chrome's |
| 7224 * debugger. | 7224 * debugger. |
| 7225 */ | 7225 */ |
| 7226 void SetEmbedderData(int index, Local<Value> value); | 7226 void SetEmbedderData(int index, Local<Value> value); |
| 7227 | 7227 |
| 7228 /** | 7228 /** |
| 7229 * Gets a 2-byte-aligned native pointer from the embedder data with the given | 7229 * Gets a 2-byte-aligned native pointer from the embedder data with the given |
| 7230 * index, which must have bees set by a previous call to | 7230 * index, which must have been set by a previous call to |
| 7231 * SetAlignedPointerInEmbedderData with the same index. Note that index 0 | 7231 * SetAlignedPointerInEmbedderData with the same index. Note that index 0 |
| 7232 * currently has a special meaning for Chrome's debugger. | 7232 * currently has a special meaning for Chrome's debugger. |
| 7233 */ | 7233 */ |
| 7234 V8_INLINE void* GetAlignedPointerFromEmbedderData(int index); | 7234 V8_INLINE void* GetAlignedPointerFromEmbedderData(int index); |
| 7235 | 7235 |
| 7236 /** | 7236 /** |
| 7237 * Sets a 2-byte-aligned native pointer in the embedder data with the given | 7237 * Sets a 2-byte-aligned native pointer in the embedder data with the given |
| 7238 * index, growing the data as needed. Note that index 0 currently has a | 7238 * index, growing the data as needed. Note that index 0 currently has a |
| 7239 * special meaning for Chrome's debugger. | 7239 * special meaning for Chrome's debugger. |
| 7240 */ | 7240 */ |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7300 | 7300 |
| 7301 | 7301 |
| 7302 /** | 7302 /** |
| 7303 * Multiple threads in V8 are allowed, but only one thread at a time is allowed | 7303 * Multiple threads in V8 are allowed, but only one thread at a time is allowed |
| 7304 * to use any given V8 isolate, see the comments in the Isolate class. The | 7304 * to use any given V8 isolate, see the comments in the Isolate class. The |
| 7305 * definition of 'using a V8 isolate' includes accessing handles or holding onto | 7305 * definition of 'using a V8 isolate' includes accessing handles or holding onto |
| 7306 * object pointers obtained from V8 handles while in the particular V8 isolate. | 7306 * object pointers obtained from V8 handles while in the particular V8 isolate. |
| 7307 * It is up to the user of V8 to ensure, perhaps with locking, that this | 7307 * It is up to the user of V8 to ensure, perhaps with locking, that this |
| 7308 * constraint is not violated. In addition to any other synchronization | 7308 * constraint is not violated. In addition to any other synchronization |
| 7309 * mechanism that may be used, the v8::Locker and v8::Unlocker classes must be | 7309 * mechanism that may be used, the v8::Locker and v8::Unlocker classes must be |
| 7310 * used to signal thead switches to V8. | 7310 * used to signal thread switches to V8. |
| 7311 * | 7311 * |
| 7312 * v8::Locker is a scoped lock object. While it's active, i.e. between its | 7312 * v8::Locker is a scoped lock object. While it's active, i.e. between its |
| 7313 * construction and destruction, the current thread is allowed to use the locked | 7313 * construction and destruction, the current thread is allowed to use the locked |
| 7314 * isolate. V8 guarantees that an isolate can be locked by at most one thread at | 7314 * isolate. V8 guarantees that an isolate can be locked by at most one thread at |
| 7315 * any time. In other words, the scope of a v8::Locker is a critical section. | 7315 * any time. In other words, the scope of a v8::Locker is a critical section. |
| 7316 * | 7316 * |
| 7317 * Sample usage: | 7317 * Sample usage: |
| 7318 * \code | 7318 * \code |
| 7319 * ... | 7319 * ... |
| 7320 * { | 7320 * { |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8914 */ | 8914 */ |
| 8915 | 8915 |
| 8916 | 8916 |
| 8917 } // namespace v8 | 8917 } // namespace v8 |
| 8918 | 8918 |
| 8919 | 8919 |
| 8920 #undef TYPE_CHECK | 8920 #undef TYPE_CHECK |
| 8921 | 8921 |
| 8922 | 8922 |
| 8923 #endif // INCLUDE_V8_H_ | 8923 #endif // INCLUDE_V8_H_ |
| OLD | NEW |