Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: include/v8.h

Issue 7344013: Expose APIs for detecting boxed primitives, native errors and Math. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 #endif // _WIN32 74 #endif // _WIN32
75 75
76 /** 76 /**
77 * The v8 JavaScript engine. 77 * The v8 JavaScript engine.
78 */ 78 */
79 namespace v8 { 79 namespace v8 {
80 80
81 class Context; 81 class Context;
82 class String; 82 class String;
83 class BoxedString;
83 class Value; 84 class Value;
84 class Utils; 85 class Utils;
85 class Number; 86 class Number;
87 class BoxedNumber;
86 class Object; 88 class Object;
87 class Array; 89 class Array;
88 class Int32; 90 class Int32;
89 class Uint32; 91 class Uint32;
90 class External; 92 class External;
91 class Primitive; 93 class Primitive;
92 class Boolean; 94 class Boolean;
95 class BoxedBoolean;
93 class Integer; 96 class Integer;
94 class Function; 97 class Function;
95 class Date; 98 class Date;
96 class ImplementationUtilities; 99 class ImplementationUtilities;
97 class Signature; 100 class Signature;
98 template <class T> class Handle; 101 template <class T> class Handle;
99 template <class T> class Local; 102 template <class T> class Local;
100 template <class T> class Persistent; 103 template <class T> class Persistent;
101 class FunctionTemplate; 104 class FunctionTemplate;
102 class ObjectTemplate; 105 class ObjectTemplate;
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 * Returns true if this value is a 32-bit unsigned integer. 925 * Returns true if this value is a 32-bit unsigned integer.
923 */ 926 */
924 V8EXPORT bool IsUint32() const; 927 V8EXPORT bool IsUint32() const;
925 928
926 /** 929 /**
927 * Returns true if this value is a Date. 930 * Returns true if this value is a Date.
928 */ 931 */
929 V8EXPORT bool IsDate() const; 932 V8EXPORT bool IsDate() const;
930 933
931 /** 934 /**
935 * Returns true if this value is a boxed Boolean.
936 */
937 V8EXPORT bool IsBoxedBoolean() const;
Vyacheslav Egorov (Chromium) 2011/07/12 20:38:12 Lets call them IsXXXObject instead of IsBoxedXXX.
zarko 2011/07/12 21:42:06 Done.
938
939 /**
940 * Returns true if this value is a boxed Number.
941 */
942 V8EXPORT bool IsBoxedNumber() const;
943
944 /**
945 * Returns true if this value is a boxed String.
946 */
947 V8EXPORT bool IsBoxedString() const;
948
949 /**
950 * Returns true if this value is a NativeError.
951 */
952 V8EXPORT bool IsNativeError() const;
953
954 /**
955 * Returns true if this value is the native Math object.
956 */
957 V8EXPORT bool IsMath() const;
958
959 /**
932 * Returns true if this value is a RegExp. 960 * Returns true if this value is a RegExp.
933 */ 961 */
934 V8EXPORT bool IsRegExp() const; 962 V8EXPORT bool IsRegExp() const;
935 963
936 V8EXPORT Local<Boolean> ToBoolean() const; 964 V8EXPORT Local<Boolean> ToBoolean() const;
937 V8EXPORT Local<Number> ToNumber() const; 965 V8EXPORT Local<Number> ToNumber() const;
938 V8EXPORT Local<String> ToString() const; 966 V8EXPORT Local<String> ToString() const;
939 V8EXPORT Local<String> ToDetailString() const; 967 V8EXPORT Local<String> ToDetailString() const;
940 V8EXPORT Local<Object> ToObject() const; 968 V8EXPORT Local<Object> ToObject() const;
941 V8EXPORT Local<Integer> ToInteger() const; 969 V8EXPORT Local<Integer> ToInteger() const;
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 * negatively impact the performance of date operations. 1766 * negatively impact the performance of date operations.
1739 */ 1767 */
1740 V8EXPORT static void DateTimeConfigurationChangeNotification(); 1768 V8EXPORT static void DateTimeConfigurationChangeNotification();
1741 1769
1742 private: 1770 private:
1743 V8EXPORT static void CheckCast(v8::Value* obj); 1771 V8EXPORT static void CheckCast(v8::Value* obj);
1744 }; 1772 };
1745 1773
1746 1774
1747 /** 1775 /**
1776 * An instance of the built-in Number constructor (ECMA-262, 15.7).
1777 */
1778 class BoxedNumber : public Object {
Vyacheslav Egorov (Chromium) 2011/07/12 20:38:12 XXXObject
zarko 2011/07/12 21:42:06 Done.
1779 public:
1780 V8EXPORT static Local<Value> New(double value);
1781
1782 /**
1783 * A specialization of Value::NumberValue that is more efficient
1784 * because we know the structure of this object.
1785 */
1786 V8EXPORT double NumberValue() const;
1787
1788 static inline BoxedNumber* Cast(v8::Value* obj);
1789
1790 private:
1791 V8EXPORT static void CheckCast(v8::Value* obj);
1792 };
1793
1794
1795 /**
1796 * An instance of the built-in Boolean constructor (ECMA-262, 15.6).
1797 */
1798 class BoxedBoolean : public Object {
1799 public:
1800 V8EXPORT static Local<Value> New(bool value);
1801
1802 /**
1803 * A specialization of Value::BooleanValue that is more efficient
1804 * because we know the structure of this object.
1805 */
1806 V8EXPORT bool BooleanValue() const;
1807
1808 static inline BoxedBoolean* Cast(v8::Value* obj);
1809
1810 private:
1811 V8EXPORT static void CheckCast(v8::Value* obj);
1812 };
1813
1814
1815 /**
1816 * An instance of the built-in String constructor (ECMA-262, 15.5).
1817 */
1818 class BoxedString : public Object {
1819 public:
1820 V8EXPORT static Local<Value> New(Handle<String> value);
1821
1822 /**
1823 * Returns the String held by the box.
1824 */
1825 V8EXPORT Local<String> StringValue() const;
1826
1827 static inline BoxedString* Cast(v8::Value* obj);
1828
1829 private:
1830 V8EXPORT static void CheckCast(v8::Value* obj);
1831 };
1832
1833
1834 /**
1748 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). 1835 * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
1749 */ 1836 */
1750 class RegExp : public Object { 1837 class RegExp : public Object {
1751 public: 1838 public:
1752 /** 1839 /**
1753 * Regular expression flag bits. They can be or'ed to enable a set 1840 * Regular expression flag bits. They can be or'ed to enable a set
1754 * of flags. 1841 * of flags.
1755 */ 1842 */
1756 enum Flags { 1843 enum Flags {
1757 kNone = 0, 1844 kNone = 0,
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4028 4115
4029 4116
4030 Date* Date::Cast(v8::Value* value) { 4117 Date* Date::Cast(v8::Value* value) {
4031 #ifdef V8_ENABLE_CHECKS 4118 #ifdef V8_ENABLE_CHECKS
4032 CheckCast(value); 4119 CheckCast(value);
4033 #endif 4120 #endif
4034 return static_cast<Date*>(value); 4121 return static_cast<Date*>(value);
4035 } 4122 }
4036 4123
4037 4124
4125 BoxedString* BoxedString::Cast(v8::Value* value) {
4126 #ifdef V8_ENABLE_CHECKS
4127 CheckCast(value);
4128 #endif
4129 return static_cast<BoxedString*>(value);
4130 }
4131
4132
4133 BoxedNumber* BoxedNumber::Cast(v8::Value* value) {
4134 #ifdef V8_ENABLE_CHECKS
4135 CheckCast(value);
4136 #endif
4137 return static_cast<BoxedNumber*>(value);
4138 }
4139
4140
4141 BoxedBoolean* BoxedBoolean::Cast(v8::Value* value) {
4142 #ifdef V8_ENABLE_CHECKS
4143 CheckCast(value);
4144 #endif
4145 return static_cast<BoxedBoolean*>(value);
4146 }
4147
4148
4038 RegExp* RegExp::Cast(v8::Value* value) { 4149 RegExp* RegExp::Cast(v8::Value* value) {
4039 #ifdef V8_ENABLE_CHECKS 4150 #ifdef V8_ENABLE_CHECKS
4040 CheckCast(value); 4151 CheckCast(value);
4041 #endif 4152 #endif
4042 return static_cast<RegExp*>(value); 4153 return static_cast<RegExp*>(value);
4043 } 4154 }
4044 4155
4045 4156
4046 Object* Object::Cast(v8::Value* value) { 4157 Object* Object::Cast(v8::Value* value) {
4047 #ifdef V8_ENABLE_CHECKS 4158 #ifdef V8_ENABLE_CHECKS
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4103 4214
4104 4215
4105 } // namespace v8 4216 } // namespace v8
4106 4217
4107 4218
4108 #undef V8EXPORT 4219 #undef V8EXPORT
4109 #undef TYPE_CHECK 4220 #undef TYPE_CHECK
4110 4221
4111 4222
4112 #endif // V8_H_ 4223 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698