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 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2580 Handle<Function> setter = Handle<Function>(), | 2580 Handle<Function> setter = Handle<Function>(), |
2581 PropertyAttribute attribute = None, | 2581 PropertyAttribute attribute = None, |
2582 AccessControl settings = DEFAULT); | 2582 AccessControl settings = DEFAULT); |
2583 | 2583 |
2584 /** | 2584 /** |
2585 * Functionality for private properties. | 2585 * Functionality for private properties. |
2586 * This is an experimental feature, use at your own risk. | 2586 * This is an experimental feature, use at your own risk. |
2587 * Note: Private properties are inherited. Do not rely on this, since it may | 2587 * Note: Private properties are inherited. Do not rely on this, since it may |
2588 * change. | 2588 * change. |
2589 */ | 2589 */ |
| 2590 // TODO(dcarney): convert these or remove? |
2590 bool HasPrivate(Handle<Private> key); | 2591 bool HasPrivate(Handle<Private> key); |
2591 bool SetPrivate(Handle<Private> key, Handle<Value> value); | 2592 bool SetPrivate(Handle<Private> key, Handle<Value> value); |
2592 bool DeletePrivate(Handle<Private> key); | 2593 bool DeletePrivate(Handle<Private> key); |
2593 Local<Value> GetPrivate(Handle<Private> key); | 2594 Local<Value> GetPrivate(Handle<Private> key); |
2594 | 2595 |
2595 /** | 2596 /** |
2596 * Returns an array containing the names of the enumerable properties | 2597 * Returns an array containing the names of the enumerable properties |
2597 * of this object, including properties from prototype objects. The | 2598 * of this object, including properties from prototype objects. The |
2598 * array returned by this method contains the same values as would | 2599 * array returned by this method contains the same values as would |
2599 * be enumerated by a for-in statement over this object. | 2600 * be enumerated by a for-in statement over this object. |
2600 */ | 2601 */ |
| 2602 // TODO(dcarney): deprecate |
2601 Local<Array> GetPropertyNames(); | 2603 Local<Array> GetPropertyNames(); |
| 2604 MaybeLocal<Array> GetPropertyNames(Local<Context> context); |
2602 | 2605 |
2603 /** | 2606 /** |
2604 * This function has the same functionality as GetPropertyNames but | 2607 * This function has the same functionality as GetPropertyNames but |
2605 * the returned array doesn't contain the names of properties from | 2608 * the returned array doesn't contain the names of properties from |
2606 * prototype objects. | 2609 * prototype objects. |
2607 */ | 2610 */ |
| 2611 // TODO(dcarney): deprecate |
2608 Local<Array> GetOwnPropertyNames(); | 2612 Local<Array> GetOwnPropertyNames(); |
| 2613 MaybeLocal<Array> GetOwnPropertyNames(Local<Context> context); |
2609 | 2614 |
2610 /** | 2615 /** |
2611 * Get the prototype object. This does not skip objects marked to | 2616 * Get the prototype object. This does not skip objects marked to |
2612 * be skipped by __proto__ and it does not consult the security | 2617 * be skipped by __proto__ and it does not consult the security |
2613 * handler. | 2618 * handler. |
2614 */ | 2619 */ |
2615 Local<Value> GetPrototype(); | 2620 Local<Value> GetPrototype(); |
2616 | 2621 |
2617 /** | 2622 /** |
2618 * Set the prototype object. This does not skip objects marked to | 2623 * Set the prototype object. This does not skip objects marked to |
2619 * be skipped by __proto__ and it does not consult the security | 2624 * be skipped by __proto__ and it does not consult the security |
2620 * handler. | 2625 * handler. |
2621 */ | 2626 */ |
| 2627 // TODO(dcarney): deprecate |
2622 bool SetPrototype(Handle<Value> prototype); | 2628 bool SetPrototype(Handle<Value> prototype); |
| 2629 Maybe<bool> SetPrototype(Local<Context> context, Local<Value> prototype); |
2623 | 2630 |
2624 /** | 2631 /** |
2625 * Finds an instance of the given function template in the prototype | 2632 * Finds an instance of the given function template in the prototype |
2626 * chain. | 2633 * chain. |
2627 */ | 2634 */ |
2628 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); | 2635 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); |
2629 | 2636 |
2630 /** | 2637 /** |
2631 * Call builtin Object.prototype.toString on this object. | 2638 * Call builtin Object.prototype.toString on this object. |
2632 * This is different from Value::ToString() that may call | 2639 * This is different from Value::ToString() that may call |
2633 * user-defined toString function. This one does not. | 2640 * user-defined toString function. This one does not. |
2634 */ | 2641 */ |
| 2642 // TODO(dcarney): convert this - needs recursion currently. |
2635 Local<String> ObjectProtoToString(); | 2643 Local<String> ObjectProtoToString(); |
2636 | 2644 |
2637 /** | 2645 /** |
2638 * Returns the name of the function invoked as a constructor for this object. | 2646 * Returns the name of the function invoked as a constructor for this object. |
2639 */ | 2647 */ |
2640 Local<String> GetConstructorName(); | 2648 Local<String> GetConstructorName(); |
2641 | 2649 |
2642 /** Gets the number of internal fields for this Object. */ | 2650 /** Gets the number of internal fields for this Object. */ |
2643 int InternalFieldCount(); | 2651 int InternalFieldCount(); |
2644 | 2652 |
(...skipping 23 matching lines...) Expand all Loading... |
2668 } | 2676 } |
2669 | 2677 |
2670 /** | 2678 /** |
2671 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such | 2679 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such |
2672 * a field, GetAlignedPointerFromInternalField must be used, everything else | 2680 * a field, GetAlignedPointerFromInternalField must be used, everything else |
2673 * leads to undefined behavior. | 2681 * leads to undefined behavior. |
2674 */ | 2682 */ |
2675 void SetAlignedPointerInInternalField(int index, void* value); | 2683 void SetAlignedPointerInInternalField(int index, void* value); |
2676 | 2684 |
2677 // Testers for local properties. | 2685 // Testers for local properties. |
| 2686 // TODO(dcarney): deprecate |
2678 bool HasOwnProperty(Handle<String> key); | 2687 bool HasOwnProperty(Handle<String> key); |
| 2688 Maybe<bool> HasOwnProperty(Local<Context> context, Local<Name> key); |
| 2689 // TODO(dcarney): deprecate |
2679 bool HasRealNamedProperty(Handle<String> key); | 2690 bool HasRealNamedProperty(Handle<String> key); |
| 2691 Maybe<bool> HasRealNamedProperty(Local<Context> context, Local<Name> key); |
| 2692 // TODO(dcarney): deprecate |
2680 bool HasRealIndexedProperty(uint32_t index); | 2693 bool HasRealIndexedProperty(uint32_t index); |
| 2694 Maybe<bool> HasRealIndexedProperty(Local<Context> context, uint32_t index); |
| 2695 // TODO(dcarney): deprecate |
2681 bool HasRealNamedCallbackProperty(Handle<String> key); | 2696 bool HasRealNamedCallbackProperty(Handle<String> key); |
| 2697 Maybe<bool> HasRealNamedCallbackProperty(Local<Context> context, |
| 2698 Local<Name> key); |
2682 | 2699 |
2683 /** | 2700 /** |
2684 * If result.IsEmpty() no real property was located in the prototype chain. | 2701 * If result.IsEmpty() no real property was located in the prototype chain. |
2685 * This means interceptors in the prototype chain are not called. | 2702 * This means interceptors in the prototype chain are not called. |
2686 */ | 2703 */ |
| 2704 // TODO(dcarney): deprecate |
2687 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key); | 2705 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key); |
| 2706 MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain(Local<Context> context, |
| 2707 Local<Name> key); |
2688 | 2708 |
2689 /** | 2709 /** |
2690 * Gets the property attributes of a real property in the prototype chain, | 2710 * Gets the property attributes of a real property in the prototype chain, |
2691 * which can be None or any combination of ReadOnly, DontEnum and DontDelete. | 2711 * which can be None or any combination of ReadOnly, DontEnum and DontDelete. |
2692 * Interceptors in the prototype chain are not called. | 2712 * Interceptors in the prototype chain are not called. |
2693 */ | 2713 */ |
| 2714 // TODO(dcarney): deprecate |
2694 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( | 2715 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( |
2695 Handle<String> key); | 2716 Handle<String> key); |
| 2717 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( |
| 2718 Local<Context> context, Local<Name> key); |
2696 | 2719 |
2697 /** | 2720 /** |
2698 * If result.IsEmpty() no real property was located on the object or | 2721 * If result.IsEmpty() no real property was located on the object or |
2699 * in the prototype chain. | 2722 * in the prototype chain. |
2700 * This means interceptors in the prototype chain are not called. | 2723 * This means interceptors in the prototype chain are not called. |
2701 */ | 2724 */ |
| 2725 // TODO(dcarney): deprecate |
2702 Local<Value> GetRealNamedProperty(Handle<String> key); | 2726 Local<Value> GetRealNamedProperty(Handle<String> key); |
| 2727 MaybeLocal<Value> GetRealNamedProperty(Local<Context> context, |
| 2728 Local<Name> key); |
2703 | 2729 |
2704 /** | 2730 /** |
2705 * Gets the property attributes of a real property which can be | 2731 * Gets the property attributes of a real property which can be |
2706 * None or any combination of ReadOnly, DontEnum and DontDelete. | 2732 * None or any combination of ReadOnly, DontEnum and DontDelete. |
2707 * Interceptors in the prototype chain are not called. | 2733 * Interceptors in the prototype chain are not called. |
2708 */ | 2734 */ |
| 2735 // TODO(dcarney): deprecate |
2709 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(Handle<String> key); | 2736 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(Handle<String> key); |
| 2737 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes( |
| 2738 Local<Context> context, Local<Name> key); |
2710 | 2739 |
2711 /** Tests for a named lookup interceptor.*/ | 2740 /** Tests for a named lookup interceptor.*/ |
2712 bool HasNamedLookupInterceptor(); | 2741 bool HasNamedLookupInterceptor(); |
2713 | 2742 |
2714 /** Tests for an index lookup interceptor.*/ | 2743 /** Tests for an index lookup interceptor.*/ |
2715 bool HasIndexedLookupInterceptor(); | 2744 bool HasIndexedLookupInterceptor(); |
2716 | 2745 |
2717 /** | 2746 /** |
2718 * Turns on access check on the object if the object is an instance of | 2747 * Turns on access check on the object if the object is an instance of |
2719 * a template that has access check callbacks. If an object has no | 2748 * a template that has access check callbacks. If an object has no |
2720 * access check info, the object cannot be accessed by anyone. | 2749 * access check info, the object cannot be accessed by anyone. |
2721 */ | 2750 */ |
| 2751 // TODO(dcarney): deprecate |
2722 void TurnOnAccessCheck(); | 2752 void TurnOnAccessCheck(); |
2723 | 2753 |
2724 /** | 2754 /** |
2725 * Returns the identity hash for this object. The current implementation | 2755 * Returns the identity hash for this object. The current implementation |
2726 * uses a hidden property on the object to store the identity hash. | 2756 * uses a hidden property on the object to store the identity hash. |
2727 * | 2757 * |
2728 * The return value will never be 0. Also, it is not guaranteed to be | 2758 * The return value will never be 0. Also, it is not guaranteed to be |
2729 * unique. | 2759 * unique. |
2730 */ | 2760 */ |
2731 int GetIdentityHash(); | 2761 int GetIdentityHash(); |
2732 | 2762 |
2733 /** | 2763 /** |
2734 * Access hidden properties on JavaScript objects. These properties are | 2764 * Access hidden properties on JavaScript objects. These properties are |
2735 * hidden from the executing JavaScript and only accessible through the V8 | 2765 * hidden from the executing JavaScript and only accessible through the V8 |
2736 * C++ API. Hidden properties introduced by V8 internally (for example the | 2766 * C++ API. Hidden properties introduced by V8 internally (for example the |
2737 * identity hash) are prefixed with "v8::". | 2767 * identity hash) are prefixed with "v8::". |
2738 */ | 2768 */ |
| 2769 // TODO(dcarney): convert these? |
2739 bool SetHiddenValue(Handle<String> key, Handle<Value> value); | 2770 bool SetHiddenValue(Handle<String> key, Handle<Value> value); |
2740 Local<Value> GetHiddenValue(Handle<String> key); | 2771 Local<Value> GetHiddenValue(Handle<String> key); |
2741 bool DeleteHiddenValue(Handle<String> key); | 2772 bool DeleteHiddenValue(Handle<String> key); |
2742 | 2773 |
2743 /** | 2774 /** |
2744 * Clone this object with a fast but shallow copy. Values will point | 2775 * Clone this object with a fast but shallow copy. Values will point |
2745 * to the same values as the original object. | 2776 * to the same values as the original object. |
2746 */ | 2777 */ |
| 2778 // TODO(dcarney): convert this? |
2747 Local<Object> Clone(); | 2779 Local<Object> Clone(); |
2748 | 2780 |
2749 /** | 2781 /** |
2750 * Returns the context in which the object was created. | 2782 * Returns the context in which the object was created. |
2751 */ | 2783 */ |
2752 Local<Context> CreationContext(); | 2784 Local<Context> CreationContext(); |
2753 | 2785 |
2754 /** | 2786 /** |
2755 * Set the backing store of the indexed properties to be managed by the | 2787 * Set the backing store of the indexed properties to be managed by the |
2756 * embedding layer. Access to the indexed properties will follow the rules | 2788 * embedding layer. Access to the indexed properties will follow the rules |
(...skipping 4927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7684 */ | 7716 */ |
7685 | 7717 |
7686 | 7718 |
7687 } // namespace v8 | 7719 } // namespace v8 |
7688 | 7720 |
7689 | 7721 |
7690 #undef TYPE_CHECK | 7722 #undef TYPE_CHECK |
7691 | 7723 |
7692 | 7724 |
7693 #endif // V8_H_ | 7725 #endif // V8_H_ |
OLD | NEW |