OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2712 }; | 2712 }; |
2713 | 2713 |
2714 | 2714 |
2715 /** | 2715 /** |
2716 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2716 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
2717 */ | 2717 */ |
2718 class V8EXPORT Date : public Object { | 2718 class V8EXPORT Date : public Object { |
2719 public: | 2719 public: |
2720 static Local<Value> New(double time); | 2720 static Local<Value> New(double time); |
2721 | 2721 |
| 2722 // Deprecated, use Date::ValueOf() instead. |
| 2723 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2724 double NumberValue() const { return ValueOf(); } |
| 2725 |
2722 /** | 2726 /** |
2723 * A specialization of Value::NumberValue that is more efficient | 2727 * A specialization of Value::NumberValue that is more efficient |
2724 * because we know the structure of this object. | 2728 * because we know the structure of this object. |
2725 */ | 2729 */ |
2726 double NumberValue() const; | 2730 double ValueOf() const; |
2727 | 2731 |
2728 V8_INLINE(static Date* Cast(v8::Value* obj)); | 2732 V8_INLINE(static Date* Cast(v8::Value* obj)); |
2729 | 2733 |
2730 /** | 2734 /** |
2731 * Notification that the embedder has changed the time zone, | 2735 * Notification that the embedder has changed the time zone, |
2732 * daylight savings time, or other date / time configuration | 2736 * daylight savings time, or other date / time configuration |
2733 * parameters. V8 keeps a cache of various values used for | 2737 * parameters. V8 keeps a cache of various values used for |
2734 * date / time computation. This notification will reset | 2738 * date / time computation. This notification will reset |
2735 * those cached values for the current context so that date / | 2739 * those cached values for the current context so that date / |
2736 * time configuration changes would be reflected in the Date | 2740 * time configuration changes would be reflected in the Date |
2737 * object. | 2741 * object. |
2738 * | 2742 * |
2739 * This API should not be called more than needed as it will | 2743 * This API should not be called more than needed as it will |
2740 * negatively impact the performance of date operations. | 2744 * negatively impact the performance of date operations. |
2741 */ | 2745 */ |
2742 static void DateTimeConfigurationChangeNotification(); | 2746 static void DateTimeConfigurationChangeNotification(); |
2743 | 2747 |
2744 private: | 2748 private: |
2745 static void CheckCast(v8::Value* obj); | 2749 static void CheckCast(v8::Value* obj); |
2746 }; | 2750 }; |
2747 | 2751 |
2748 | 2752 |
2749 /** | 2753 /** |
2750 * A Number object (ECMA-262, 4.3.21). | 2754 * A Number object (ECMA-262, 4.3.21). |
2751 */ | 2755 */ |
2752 class V8EXPORT NumberObject : public Object { | 2756 class V8EXPORT NumberObject : public Object { |
2753 public: | 2757 public: |
2754 static Local<Value> New(double value); | 2758 static Local<Value> New(double value); |
2755 | 2759 |
| 2760 // Deprecated, use NumberObject::ValueOf() instead. |
| 2761 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2762 double NumberValue() const { return ValueOf(); } |
| 2763 |
2756 /** | 2764 /** |
2757 * Returns the Number held by the object. | 2765 * Returns the Number held by the object. |
2758 */ | 2766 */ |
2759 double NumberValue() const; | 2767 double ValueOf() const; |
2760 | 2768 |
2761 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); | 2769 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); |
2762 | 2770 |
2763 private: | 2771 private: |
2764 static void CheckCast(v8::Value* obj); | 2772 static void CheckCast(v8::Value* obj); |
2765 }; | 2773 }; |
2766 | 2774 |
2767 | 2775 |
2768 /** | 2776 /** |
2769 * A Boolean object (ECMA-262, 4.3.15). | 2777 * A Boolean object (ECMA-262, 4.3.15). |
2770 */ | 2778 */ |
2771 class V8EXPORT BooleanObject : public Object { | 2779 class V8EXPORT BooleanObject : public Object { |
2772 public: | 2780 public: |
2773 static Local<Value> New(bool value); | 2781 static Local<Value> New(bool value); |
2774 | 2782 |
| 2783 // Deprecated, use BooleanObject::ValueOf() instead. |
| 2784 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2785 bool BooleanValue() const { return ValueOf(); } |
| 2786 |
2775 /** | 2787 /** |
2776 * Returns the Boolean held by the object. | 2788 * Returns the Boolean held by the object. |
2777 */ | 2789 */ |
2778 bool BooleanValue() const; | 2790 bool ValueOf() const; |
2779 | 2791 |
2780 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); | 2792 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); |
2781 | 2793 |
2782 private: | 2794 private: |
2783 static void CheckCast(v8::Value* obj); | 2795 static void CheckCast(v8::Value* obj); |
2784 }; | 2796 }; |
2785 | 2797 |
2786 | 2798 |
2787 /** | 2799 /** |
2788 * A String object (ECMA-262, 4.3.18). | 2800 * A String object (ECMA-262, 4.3.18). |
2789 */ | 2801 */ |
2790 class V8EXPORT StringObject : public Object { | 2802 class V8EXPORT StringObject : public Object { |
2791 public: | 2803 public: |
2792 static Local<Value> New(Handle<String> value); | 2804 static Local<Value> New(Handle<String> value); |
2793 | 2805 |
| 2806 // Deprecated, use StringObject::ValueOf() instead. |
| 2807 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2808 Local<String> StringValue() const { return ValueOf(); } |
| 2809 |
2794 /** | 2810 /** |
2795 * Returns the String held by the object. | 2811 * Returns the String held by the object. |
2796 */ | 2812 */ |
2797 Local<String> StringValue() const; | 2813 Local<String> ValueOf() const; |
2798 | 2814 |
2799 V8_INLINE(static StringObject* Cast(v8::Value* obj)); | 2815 V8_INLINE(static StringObject* Cast(v8::Value* obj)); |
2800 | 2816 |
2801 private: | 2817 private: |
2802 static void CheckCast(v8::Value* obj); | 2818 static void CheckCast(v8::Value* obj); |
2803 }; | 2819 }; |
2804 | 2820 |
2805 | 2821 |
2806 /** | 2822 /** |
2807 * A Symbol object (ECMA-262 edition 6). | 2823 * A Symbol object (ECMA-262 edition 6). |
2808 * | 2824 * |
2809 * This is an experimental feature. Use at your own risk. | 2825 * This is an experimental feature. Use at your own risk. |
2810 */ | 2826 */ |
2811 class V8EXPORT SymbolObject : public Object { | 2827 class V8EXPORT SymbolObject : public Object { |
2812 public: | 2828 public: |
2813 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); | 2829 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); |
2814 | 2830 |
| 2831 // Deprecated, use SymbolObject::ValueOf() instead. |
| 2832 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
| 2833 Local<Symbol> SymbolValue() const { return ValueOf(); } |
| 2834 |
2815 /** | 2835 /** |
2816 * Returns the Symbol held by the object. | 2836 * Returns the Symbol held by the object. |
2817 */ | 2837 */ |
2818 Local<Symbol> SymbolValue() const; | 2838 Local<Symbol> ValueOf() const; |
2819 | 2839 |
2820 V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); | 2840 V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); |
2821 | 2841 |
2822 private: | 2842 private: |
2823 static void CheckCast(v8::Value* obj); | 2843 static void CheckCast(v8::Value* obj); |
2824 }; | 2844 }; |
2825 | 2845 |
2826 | 2846 |
2827 /** | 2847 /** |
2828 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | 2848 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
(...skipping 3652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6481 | 6501 |
6482 | 6502 |
6483 } // namespace v8 | 6503 } // namespace v8 |
6484 | 6504 |
6485 | 6505 |
6486 #undef V8EXPORT | 6506 #undef V8EXPORT |
6487 #undef TYPE_CHECK | 6507 #undef TYPE_CHECK |
6488 | 6508 |
6489 | 6509 |
6490 #endif // V8_H_ | 6510 #endif // V8_H_ |
OLD | NEW |