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 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; | 1729 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; |
1730 | 1730 |
1731 V8_INLINE static String* Cast(v8::Value* obj); | 1731 V8_INLINE static String* Cast(v8::Value* obj); |
1732 | 1732 |
1733 /** | 1733 /** |
1734 * Allocates a new string from either UTF-8 encoded or ASCII data. | 1734 * Allocates a new string from either UTF-8 encoded or ASCII data. |
1735 * The second parameter 'length' gives the buffer length. If omitted, | 1735 * The second parameter 'length' gives the buffer length. If omitted, |
1736 * the function calls 'strlen' to determine the buffer length. | 1736 * the function calls 'strlen' to determine the buffer length. |
1737 */ | 1737 */ |
1738 V8_DEPRECATED( | 1738 V8_DEPRECATED( |
1739 "Use NewFromOneByte instead", | 1739 "Use NewFromUtf8 instead", |
1740 V8_INLINE static Local<String> New(const char* data, int length = -1)); | 1740 V8_INLINE static Local<String> New(const char* data, int length = -1)); |
1741 | 1741 |
1742 /** Allocates a new string from 16-bit character codes.*/ | 1742 /** Allocates a new string from 16-bit character codes.*/ |
1743 V8_DEPRECATED( | 1743 V8_DEPRECATED( |
1744 "Use NewFromTwoByte instead", | 1744 "Use NewFromTwoByte instead", |
1745 V8_INLINE static Local<String> New( | 1745 V8_INLINE static Local<String> New( |
1746 const uint16_t* data, int length = -1)); | 1746 const uint16_t* data, int length = -1)); |
1747 | 1747 |
1748 /** | 1748 /** |
1749 * Creates an internalized string (historically called a "symbol", | 1749 * Creates an internalized string (historically called a "symbol", |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 int GetScriptColumnNumber() const; | 2528 int GetScriptColumnNumber() const; |
2529 | 2529 |
2530 /** | 2530 /** |
2531 * Tells whether this function is builtin. | 2531 * Tells whether this function is builtin. |
2532 */ | 2532 */ |
2533 bool IsBuiltin() const; | 2533 bool IsBuiltin() const; |
2534 | 2534 |
2535 /** | 2535 /** |
2536 * Returns scriptId object. | 2536 * Returns scriptId object. |
2537 */ | 2537 */ |
2538 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId()) const; | 2538 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId() const); |
2539 | 2539 |
2540 /** | 2540 /** |
2541 * Returns scriptId. | 2541 * Returns scriptId. |
2542 */ | 2542 */ |
2543 int ScriptId() const; | 2543 int ScriptId() const; |
2544 | 2544 |
2545 ScriptOrigin GetScriptOrigin() const; | 2545 ScriptOrigin GetScriptOrigin() const; |
2546 V8_INLINE static Function* Cast(Value* obj); | 2546 V8_INLINE static Function* Cast(Value* obj); |
2547 static const int kLineOffsetNotFound; | 2547 static const int kLineOffsetNotFound; |
2548 | 2548 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 | 2892 |
2893 /** | 2893 /** |
2894 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2894 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
2895 */ | 2895 */ |
2896 class V8_EXPORT Date : public Object { | 2896 class V8_EXPORT Date : public Object { |
2897 public: | 2897 public: |
2898 static Local<Value> New(double time); | 2898 static Local<Value> New(double time); |
2899 | 2899 |
2900 V8_DEPRECATED( | 2900 V8_DEPRECATED( |
2901 "Use ValueOf instead", | 2901 "Use ValueOf instead", |
2902 double NumberValue()) const { return ValueOf(); } | 2902 double NumberValue() const) { return ValueOf(); } |
2903 | 2903 |
2904 /** | 2904 /** |
2905 * A specialization of Value::NumberValue that is more efficient | 2905 * A specialization of Value::NumberValue that is more efficient |
2906 * because we know the structure of this object. | 2906 * because we know the structure of this object. |
2907 */ | 2907 */ |
2908 double ValueOf() const; | 2908 double ValueOf() const; |
2909 | 2909 |
2910 V8_INLINE static Date* Cast(v8::Value* obj); | 2910 V8_INLINE static Date* Cast(v8::Value* obj); |
2911 | 2911 |
2912 /** | 2912 /** |
(...skipping 17 matching lines...) Expand all Loading... |
2930 | 2930 |
2931 /** | 2931 /** |
2932 * A Number object (ECMA-262, 4.3.21). | 2932 * A Number object (ECMA-262, 4.3.21). |
2933 */ | 2933 */ |
2934 class V8_EXPORT NumberObject : public Object { | 2934 class V8_EXPORT NumberObject : public Object { |
2935 public: | 2935 public: |
2936 static Local<Value> New(double value); | 2936 static Local<Value> New(double value); |
2937 | 2937 |
2938 V8_DEPRECATED( | 2938 V8_DEPRECATED( |
2939 "Use ValueOf instead", | 2939 "Use ValueOf instead", |
2940 double NumberValue()) const { return ValueOf(); } | 2940 double NumberValue() const) { return ValueOf(); } |
2941 | 2941 |
2942 /** | 2942 /** |
2943 * Returns the Number held by the object. | 2943 * Returns the Number held by the object. |
2944 */ | 2944 */ |
2945 double ValueOf() const; | 2945 double ValueOf() const; |
2946 | 2946 |
2947 V8_INLINE static NumberObject* Cast(v8::Value* obj); | 2947 V8_INLINE static NumberObject* Cast(v8::Value* obj); |
2948 | 2948 |
2949 private: | 2949 private: |
2950 static void CheckCast(v8::Value* obj); | 2950 static void CheckCast(v8::Value* obj); |
2951 }; | 2951 }; |
2952 | 2952 |
2953 | 2953 |
2954 /** | 2954 /** |
2955 * A Boolean object (ECMA-262, 4.3.15). | 2955 * A Boolean object (ECMA-262, 4.3.15). |
2956 */ | 2956 */ |
2957 class V8_EXPORT BooleanObject : public Object { | 2957 class V8_EXPORT BooleanObject : public Object { |
2958 public: | 2958 public: |
2959 static Local<Value> New(bool value); | 2959 static Local<Value> New(bool value); |
2960 | 2960 |
2961 V8_DEPRECATED( | 2961 V8_DEPRECATED( |
2962 "Use ValueOf instead", | 2962 "Use ValueOf instead", |
2963 bool BooleanValue()) const { return ValueOf(); } | 2963 bool BooleanValue() const) { return ValueOf(); } |
2964 | 2964 |
2965 /** | 2965 /** |
2966 * Returns the Boolean held by the object. | 2966 * Returns the Boolean held by the object. |
2967 */ | 2967 */ |
2968 bool ValueOf() const; | 2968 bool ValueOf() const; |
2969 | 2969 |
2970 V8_INLINE static BooleanObject* Cast(v8::Value* obj); | 2970 V8_INLINE static BooleanObject* Cast(v8::Value* obj); |
2971 | 2971 |
2972 private: | 2972 private: |
2973 static void CheckCast(v8::Value* obj); | 2973 static void CheckCast(v8::Value* obj); |
2974 }; | 2974 }; |
2975 | 2975 |
2976 | 2976 |
2977 /** | 2977 /** |
2978 * A String object (ECMA-262, 4.3.18). | 2978 * A String object (ECMA-262, 4.3.18). |
2979 */ | 2979 */ |
2980 class V8_EXPORT StringObject : public Object { | 2980 class V8_EXPORT StringObject : public Object { |
2981 public: | 2981 public: |
2982 static Local<Value> New(Handle<String> value); | 2982 static Local<Value> New(Handle<String> value); |
2983 | 2983 |
2984 V8_DEPRECATED( | 2984 V8_DEPRECATED( |
2985 "Use ValueOf instead", | 2985 "Use ValueOf instead", |
2986 Local<String> StringValue()) const { return ValueOf(); } | 2986 Local<String> StringValue() const) { return ValueOf(); } |
2987 | 2987 |
2988 /** | 2988 /** |
2989 * Returns the String held by the object. | 2989 * Returns the String held by the object. |
2990 */ | 2990 */ |
2991 Local<String> ValueOf() const; | 2991 Local<String> ValueOf() const; |
2992 | 2992 |
2993 V8_INLINE static StringObject* Cast(v8::Value* obj); | 2993 V8_INLINE static StringObject* Cast(v8::Value* obj); |
2994 | 2994 |
2995 private: | 2995 private: |
2996 static void CheckCast(v8::Value* obj); | 2996 static void CheckCast(v8::Value* obj); |
2997 }; | 2997 }; |
2998 | 2998 |
2999 | 2999 |
3000 /** | 3000 /** |
3001 * A Symbol object (ECMA-262 edition 6). | 3001 * A Symbol object (ECMA-262 edition 6). |
3002 * | 3002 * |
3003 * This is an experimental feature. Use at your own risk. | 3003 * This is an experimental feature. Use at your own risk. |
3004 */ | 3004 */ |
3005 class V8_EXPORT SymbolObject : public Object { | 3005 class V8_EXPORT SymbolObject : public Object { |
3006 public: | 3006 public: |
3007 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); | 3007 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); |
3008 | 3008 |
3009 V8_DEPRECATED( | 3009 V8_DEPRECATED( |
3010 "Use ValueOf instead", | 3010 "Use ValueOf instead", |
3011 Local<Symbol> SymbolValue()) const { return ValueOf(); } | 3011 Local<Symbol> SymbolValue() const) { return ValueOf(); } |
3012 | 3012 |
3013 /** | 3013 /** |
3014 * Returns the Symbol held by the object. | 3014 * Returns the Symbol held by the object. |
3015 */ | 3015 */ |
3016 Local<Symbol> ValueOf() const; | 3016 Local<Symbol> ValueOf() const; |
3017 | 3017 |
3018 V8_INLINE static SymbolObject* Cast(v8::Value* obj); | 3018 V8_INLINE static SymbolObject* Cast(v8::Value* obj); |
3019 | 3019 |
3020 private: | 3020 private: |
3021 static void CheckCast(v8::Value* obj); | 3021 static void CheckCast(v8::Value* obj); |
(...skipping 3018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6040 } | 6040 } |
6041 | 6041 |
6042 | 6042 |
6043 Handle<Boolean> Boolean::New(bool value) { | 6043 Handle<Boolean> Boolean::New(bool value) { |
6044 Isolate* isolate = Isolate::GetCurrent(); | 6044 Isolate* isolate = Isolate::GetCurrent(); |
6045 return value ? True(isolate) : False(isolate); | 6045 return value ? True(isolate) : False(isolate); |
6046 } | 6046 } |
6047 | 6047 |
6048 | 6048 |
6049 void Template::Set(const char* name, v8::Handle<Data> value) { | 6049 void Template::Set(const char* name, v8::Handle<Data> value) { |
6050 Set(v8::String::New(name), value); | 6050 Set(v8::String::NewFromUtf8(Isolate::GetCurrent(), name), value); |
6051 } | 6051 } |
6052 | 6052 |
6053 | 6053 |
6054 Local<Value> Object::GetInternalField(int index) { | 6054 Local<Value> Object::GetInternalField(int index) { |
6055 #ifndef V8_ENABLE_CHECKS | 6055 #ifndef V8_ENABLE_CHECKS |
6056 typedef internal::Object O; | 6056 typedef internal::Object O; |
6057 typedef internal::HeapObject HO; | 6057 typedef internal::HeapObject HO; |
6058 typedef internal::Internals I; | 6058 typedef internal::Internals I; |
6059 O* obj = *reinterpret_cast<O**>(this); | 6059 O* obj = *reinterpret_cast<O**>(this); |
6060 // Fast path: If the object is a plain JSObject, which is the common case, we | 6060 // Fast path: If the object is a plain JSObject, which is the common case, we |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6593 */ | 6593 */ |
6594 | 6594 |
6595 | 6595 |
6596 } // namespace v8 | 6596 } // namespace v8 |
6597 | 6597 |
6598 | 6598 |
6599 #undef TYPE_CHECK | 6599 #undef TYPE_CHECK |
6600 | 6600 |
6601 | 6601 |
6602 #endif // V8_H_ | 6602 #endif // V8_H_ |
OLD | NEW |