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

Side by Side Diff: include/v8.h

Issue 148593004: A64: Synchronize with r18084. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « build/standalone.gypi ('k') | include/v8-platform.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 class HeapProfiler; 98 class HeapProfiler;
99 class ImplementationUtilities; 99 class ImplementationUtilities;
100 class Int32; 100 class Int32;
101 class Integer; 101 class Integer;
102 class Isolate; 102 class Isolate;
103 class Number; 103 class Number;
104 class NumberObject; 104 class NumberObject;
105 class Object; 105 class Object;
106 class ObjectOperationDescriptor; 106 class ObjectOperationDescriptor;
107 class ObjectTemplate; 107 class ObjectTemplate;
108 class Platform;
108 class Primitive; 109 class Primitive;
109 class RawOperationDescriptor; 110 class RawOperationDescriptor;
110 class Signature; 111 class Signature;
111 class StackFrame; 112 class StackFrame;
112 class StackTrace; 113 class StackTrace;
113 class String; 114 class String;
114 class StringObject; 115 class StringObject;
115 class Symbol; 116 class Symbol;
116 class SymbolObject; 117 class SymbolObject;
117 class Private; 118 class Private;
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 */ 1130 */
1130 int GetEndColumn() const; 1131 int GetEndColumn() const;
1131 1132
1132 /** 1133 /**
1133 * Passes on the value set by the embedder when it fed the script from which 1134 * Passes on the value set by the embedder when it fed the script from which
1134 * this Message was generated to V8. 1135 * this Message was generated to V8.
1135 */ 1136 */
1136 bool IsSharedCrossOrigin() const; 1137 bool IsSharedCrossOrigin() const;
1137 1138
1138 // TODO(1245381): Print to a string instead of on a FILE. 1139 // TODO(1245381): Print to a string instead of on a FILE.
1140 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out);
1141 // Will be deprecated soon.
1139 static void PrintCurrentStackTrace(FILE* out); 1142 static void PrintCurrentStackTrace(FILE* out);
1140 1143
1141 static const int kNoLineNumberInfo = 0; 1144 static const int kNoLineNumberInfo = 0;
1142 static const int kNoColumnInfo = 0; 1145 static const int kNoColumnInfo = 0;
1143 static const int kNoScriptIdInfo = 0; 1146 static const int kNoScriptIdInfo = 0;
1144 }; 1147 };
1145 1148
1146 1149
1147 /** 1150 /**
1148 * Representation of a JavaScript stack trace. The information collected is a 1151 * Representation of a JavaScript stack trace. The information collected is a
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 Local<Array> AsArray(); 1187 Local<Array> AsArray();
1185 1188
1186 /** 1189 /**
1187 * Grab a snapshot of the current JavaScript execution stack. 1190 * Grab a snapshot of the current JavaScript execution stack.
1188 * 1191 *
1189 * \param frame_limit The maximum number of stack frames we want to capture. 1192 * \param frame_limit The maximum number of stack frames we want to capture.
1190 * \param options Enumerates the set of things we will capture for each 1193 * \param options Enumerates the set of things we will capture for each
1191 * StackFrame. 1194 * StackFrame.
1192 */ 1195 */
1193 static Local<StackTrace> CurrentStackTrace( 1196 static Local<StackTrace> CurrentStackTrace(
1197 Isolate* isolate,
1198 int frame_limit,
1199 StackTraceOptions options = kOverview);
1200 // Will be deprecated soon.
1201 static Local<StackTrace> CurrentStackTrace(
1194 int frame_limit, 1202 int frame_limit,
1195 StackTraceOptions options = kOverview); 1203 StackTraceOptions options = kOverview);
1196 }; 1204 };
1197 1205
1198 1206
1199 /** 1207 /**
1200 * A single JavaScript stack frame. 1208 * A single JavaScript stack frame.
1201 */ 1209 */
1202 class V8_EXPORT StackFrame { 1210 class V8_EXPORT StackFrame {
1203 public: 1211 public:
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 class V8_EXPORT Primitive : public Value { }; 1524 class V8_EXPORT Primitive : public Value { };
1517 1525
1518 1526
1519 /** 1527 /**
1520 * A primitive boolean value (ECMA-262, 4.3.14). Either the true 1528 * A primitive boolean value (ECMA-262, 4.3.14). Either the true
1521 * or false value. 1529 * or false value.
1522 */ 1530 */
1523 class V8_EXPORT Boolean : public Primitive { 1531 class V8_EXPORT Boolean : public Primitive {
1524 public: 1532 public:
1525 bool Value() const; 1533 bool Value() const;
1534 V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value);
1535 // Will be deprecated soon.
1526 V8_INLINE static Handle<Boolean> New(bool value); 1536 V8_INLINE static Handle<Boolean> New(bool value);
1527 }; 1537 };
1528 1538
1529 1539
1530 /** 1540 /**
1531 * A JavaScript string value (ECMA-262, 4.3.17). 1541 * A JavaScript string value (ECMA-262, 4.3.17).
1532 */ 1542 */
1533 class V8_EXPORT String : public Primitive { 1543 class V8_EXPORT String : public Primitive {
1534 public: 1544 public:
1535 enum Encoding { 1545 enum Encoding {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; 1738 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
1729 1739
1730 V8_INLINE static String* Cast(v8::Value* obj); 1740 V8_INLINE static String* Cast(v8::Value* obj);
1731 1741
1732 /** 1742 /**
1733 * Allocates a new string from either UTF-8 encoded or ASCII data. 1743 * Allocates a new string from either UTF-8 encoded or ASCII data.
1734 * The second parameter 'length' gives the buffer length. If omitted, 1744 * The second parameter 'length' gives the buffer length. If omitted,
1735 * the function calls 'strlen' to determine the buffer length. 1745 * the function calls 'strlen' to determine the buffer length.
1736 */ 1746 */
1737 V8_DEPRECATED( 1747 V8_DEPRECATED(
1738 "Use NewFromOneByte instead", 1748 "Use NewFromUtf8 instead",
1739 V8_INLINE static Local<String> New(const char* data, int length = -1)); 1749 V8_INLINE static Local<String> New(const char* data, int length = -1));
1740 1750
1741 /** Allocates a new string from 16-bit character codes.*/ 1751 /** Allocates a new string from 16-bit character codes.*/
1742 V8_DEPRECATED( 1752 V8_DEPRECATED(
1743 "Use NewFromTwoByte instead", 1753 "Use NewFromTwoByte instead",
1744 V8_INLINE static Local<String> New( 1754 V8_INLINE static Local<String> New(
1745 const uint16_t* data, int length = -1)); 1755 const uint16_t* data, int length = -1));
1746 1756
1747 /** 1757 /**
1748 * Creates an internalized string (historically called a "symbol", 1758 * Creates an internalized string (historically called a "symbol",
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 static Local<String> Concat(Handle<String> left, Handle<String> right); 1794 static Local<String> Concat(Handle<String> left, Handle<String> right);
1785 1795
1786 /** 1796 /**
1787 * Creates a new external string using the data defined in the given 1797 * Creates a new external string using the data defined in the given
1788 * resource. When the external string is no longer live on V8's heap the 1798 * resource. When the external string is no longer live on V8's heap the
1789 * resource will be disposed by calling its Dispose method. The caller of 1799 * resource will be disposed by calling its Dispose method. The caller of
1790 * this function should not otherwise delete or modify the resource. Neither 1800 * this function should not otherwise delete or modify the resource. Neither
1791 * should the underlying buffer be deallocated or modified except through the 1801 * should the underlying buffer be deallocated or modified except through the
1792 * destructor of the external string resource. 1802 * destructor of the external string resource.
1793 */ 1803 */
1804 static Local<String> NewExternal(Isolate* isolate,
1805 ExternalStringResource* resource);
1806 // Will be deprecated soon.
1794 static Local<String> NewExternal(ExternalStringResource* resource); 1807 static Local<String> NewExternal(ExternalStringResource* resource);
1795 1808
1796 /** 1809 /**
1797 * Associate an external string resource with this string by transforming it 1810 * Associate an external string resource with this string by transforming it
1798 * in place so that existing references to this string in the JavaScript heap 1811 * in place so that existing references to this string in the JavaScript heap
1799 * will use the external string resource. The external string resource's 1812 * will use the external string resource. The external string resource's
1800 * character contents need to be equivalent to this string. 1813 * character contents need to be equivalent to this string.
1801 * Returns true if the string has been changed to be an external string. 1814 * Returns true if the string has been changed to be an external string.
1802 * The string is not modified if the operation fails. See NewExternal for 1815 * The string is not modified if the operation fails. See NewExternal for
1803 * information on the lifetime of the resource. 1816 * information on the lifetime of the resource.
1804 */ 1817 */
1805 bool MakeExternal(ExternalStringResource* resource); 1818 bool MakeExternal(ExternalStringResource* resource);
1806 1819
1807 /** 1820 /**
1808 * Creates a new external string using the ASCII data defined in the given 1821 * Creates a new external string using the ASCII data defined in the given
1809 * resource. When the external string is no longer live on V8's heap the 1822 * resource. When the external string is no longer live on V8's heap the
1810 * resource will be disposed by calling its Dispose method. The caller of 1823 * resource will be disposed by calling its Dispose method. The caller of
1811 * this function should not otherwise delete or modify the resource. Neither 1824 * this function should not otherwise delete or modify the resource. Neither
1812 * should the underlying buffer be deallocated or modified except through the 1825 * should the underlying buffer be deallocated or modified except through the
1813 * destructor of the external string resource. 1826 * destructor of the external string resource.
1814 */ 1827 */
1828 static Local<String> NewExternal(Isolate* isolate,
1829 ExternalAsciiStringResource* resource);
1830 // Will be deprecated soon.
1815 static Local<String> NewExternal(ExternalAsciiStringResource* resource); 1831 static Local<String> NewExternal(ExternalAsciiStringResource* resource);
1816 1832
1817 /** 1833 /**
1818 * Associate an external string resource with this string by transforming it 1834 * Associate an external string resource with this string by transforming it
1819 * in place so that existing references to this string in the JavaScript heap 1835 * in place so that existing references to this string in the JavaScript heap
1820 * will use the external string resource. The external string resource's 1836 * will use the external string resource. The external string resource's
1821 * character contents need to be equivalent to this string. 1837 * character contents need to be equivalent to this string.
1822 * Returns true if the string has been changed to be an external string. 1838 * Returns true if the string has been changed to be an external string.
1823 * The string is not modified if the operation fails. See NewExternal for 1839 * The string is not modified if the operation fails. See NewExternal for
1824 * information on the lifetime of the resource. 1840 * information on the lifetime of the resource.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 Private(); 1974 Private();
1959 }; 1975 };
1960 1976
1961 1977
1962 /** 1978 /**
1963 * A JavaScript number value (ECMA-262, 4.3.20) 1979 * A JavaScript number value (ECMA-262, 4.3.20)
1964 */ 1980 */
1965 class V8_EXPORT Number : public Primitive { 1981 class V8_EXPORT Number : public Primitive {
1966 public: 1982 public:
1967 double Value() const; 1983 double Value() const;
1984 static Local<Number> New(Isolate* isolate, double value);
1985 // Will be deprecated soon.
1968 static Local<Number> New(double value); 1986 static Local<Number> New(double value);
1969 static Local<Number> New(Isolate* isolate, double value);
1970 V8_INLINE static Number* Cast(v8::Value* obj); 1987 V8_INLINE static Number* Cast(v8::Value* obj);
1971 private: 1988 private:
1972 Number(); 1989 Number();
1973 static void CheckCast(v8::Value* obj); 1990 static void CheckCast(v8::Value* obj);
1974 }; 1991 };
1975 1992
1976 1993
1977 /** 1994 /**
1978 * A JavaScript value representing a signed integer. 1995 * A JavaScript value representing a signed integer.
1979 */ 1996 */
1980 class V8_EXPORT Integer : public Number { 1997 class V8_EXPORT Integer : public Number {
1981 public: 1998 public:
1999 static Local<Integer> New(Isolate* isolate, int32_t value);
2000 static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value);
2001 // Will be deprecated soon.
2002 static Local<Integer> New(int32_t value, Isolate*);
2003 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*);
1982 static Local<Integer> New(int32_t value); 2004 static Local<Integer> New(int32_t value);
1983 static Local<Integer> NewFromUnsigned(uint32_t value); 2005 static Local<Integer> NewFromUnsigned(uint32_t value);
1984 static Local<Integer> New(int32_t value, Isolate*);
1985 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*);
1986 int64_t Value() const; 2006 int64_t Value() const;
1987 V8_INLINE static Integer* Cast(v8::Value* obj); 2007 V8_INLINE static Integer* Cast(v8::Value* obj);
1988 private: 2008 private:
1989 Integer(); 2009 Integer();
1990 static void CheckCast(v8::Value* obj); 2010 static void CheckCast(v8::Value* obj);
1991 }; 2011 };
1992 2012
1993 2013
1994 /** 2014 /**
1995 * A JavaScript value representing a 32-bit signed integer. 2015 * A JavaScript value representing a 32-bit signed integer.
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 int argc, 2348 int argc,
2329 Handle<Value> argv[]); 2349 Handle<Value> argv[]);
2330 2350
2331 /** 2351 /**
2332 * Call an Object as a constructor if a callback is set by the 2352 * Call an Object as a constructor if a callback is set by the
2333 * ObjectTemplate::SetCallAsFunctionHandler method. 2353 * ObjectTemplate::SetCallAsFunctionHandler method.
2334 * Note: This method behaves like the Function::NewInstance method. 2354 * Note: This method behaves like the Function::NewInstance method.
2335 */ 2355 */
2336 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); 2356 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]);
2337 2357
2358 static Local<Object> New(Isolate* isolate);
2359 // Will be deprecated soon.
2338 static Local<Object> New(); 2360 static Local<Object> New();
2339 V8_INLINE static Object* Cast(Value* obj); 2361 V8_INLINE static Object* Cast(Value* obj);
2340 2362
2341 private: 2363 private:
2342 Object(); 2364 Object();
2343 static void CheckCast(Value* obj); 2365 static void CheckCast(Value* obj);
2344 Local<Value> SlowGetInternalField(int index); 2366 Local<Value> SlowGetInternalField(int index);
2345 void* SlowGetAlignedPointerFromInternalField(int index); 2367 void* SlowGetAlignedPointerFromInternalField(int index);
2346 }; 2368 };
2347 2369
2348 2370
2349 /** 2371 /**
2350 * An instance of the built-in array constructor (ECMA-262, 15.4.2). 2372 * An instance of the built-in array constructor (ECMA-262, 15.4.2).
2351 */ 2373 */
2352 class V8_EXPORT Array : public Object { 2374 class V8_EXPORT Array : public Object {
2353 public: 2375 public:
2354 uint32_t Length() const; 2376 uint32_t Length() const;
2355 2377
2356 /** 2378 /**
2357 * Clones an element at index |index|. Returns an empty 2379 * Clones an element at index |index|. Returns an empty
2358 * handle if cloning fails (for any reason). 2380 * handle if cloning fails (for any reason).
2359 */ 2381 */
2360 Local<Object> CloneElementAt(uint32_t index); 2382 Local<Object> CloneElementAt(uint32_t index);
2361 2383
2362 /** 2384 /**
2363 * Creates a JavaScript array with the given length. If the length 2385 * Creates a JavaScript array with the given length. If the length
2364 * is negative the returned array will have length 0. 2386 * is negative the returned array will have length 0.
2365 */ 2387 */
2388 static Local<Array> New(Isolate* isolate, int length = 0);
2389 // Will be deprecated soon.
2366 static Local<Array> New(int length = 0); 2390 static Local<Array> New(int length = 0);
2367 2391
2368 V8_INLINE static Array* Cast(Value* obj); 2392 V8_INLINE static Array* Cast(Value* obj);
2369 private: 2393 private:
2370 Array(); 2394 Array();
2371 static void CheckCast(Value* obj); 2395 static void CheckCast(Value* obj);
2372 }; 2396 };
2373 2397
2374 2398
2375 template<typename T> 2399 template<typename T>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 int GetScriptColumnNumber() const; 2551 int GetScriptColumnNumber() const;
2528 2552
2529 /** 2553 /**
2530 * Tells whether this function is builtin. 2554 * Tells whether this function is builtin.
2531 */ 2555 */
2532 bool IsBuiltin() const; 2556 bool IsBuiltin() const;
2533 2557
2534 /** 2558 /**
2535 * Returns scriptId object. 2559 * Returns scriptId object.
2536 */ 2560 */
2537 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId()) const; 2561 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId() const);
2538 2562
2539 /** 2563 /**
2540 * Returns scriptId. 2564 * Returns scriptId.
2541 */ 2565 */
2542 int ScriptId() const; 2566 int ScriptId() const;
2543 2567
2544 ScriptOrigin GetScriptOrigin() const; 2568 ScriptOrigin GetScriptOrigin() const;
2545 V8_INLINE static Function* Cast(Value* obj); 2569 V8_INLINE static Function* Cast(Value* obj);
2546 static const int kLineOffsetNotFound; 2570 static const int kLineOffsetNotFound;
2547 2571
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2619 * Data length in bytes. 2643 * Data length in bytes.
2620 */ 2644 */
2621 size_t ByteLength() const; 2645 size_t ByteLength() const;
2622 2646
2623 /** 2647 /**
2624 * Create a new ArrayBuffer. Allocate |byte_length| bytes. 2648 * Create a new ArrayBuffer. Allocate |byte_length| bytes.
2625 * Allocated memory will be owned by a created ArrayBuffer and 2649 * Allocated memory will be owned by a created ArrayBuffer and
2626 * will be deallocated when it is garbage-collected, 2650 * will be deallocated when it is garbage-collected,
2627 * unless the object is externalized. 2651 * unless the object is externalized.
2628 */ 2652 */
2653 static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length);
2654 // Will be deprecated soon.
2629 static Local<ArrayBuffer> New(size_t byte_length); 2655 static Local<ArrayBuffer> New(size_t byte_length);
2630 2656
2631 /** 2657 /**
2632 * Create a new ArrayBuffer over an existing memory block. 2658 * Create a new ArrayBuffer over an existing memory block.
2633 * The created array buffer is immediately in externalized state. 2659 * The created array buffer is immediately in externalized state.
2634 * The memory block will not be reclaimed when a created ArrayBuffer 2660 * The memory block will not be reclaimed when a created ArrayBuffer
2635 * is garbage-collected. 2661 * is garbage-collected.
2636 */ 2662 */
2663 static Local<ArrayBuffer> New(Isolate* isolate, void* data,
2664 size_t byte_length);
2665 // Will be deprecated soon.
2637 static Local<ArrayBuffer> New(void* data, size_t byte_length); 2666 static Local<ArrayBuffer> New(void* data, size_t byte_length);
2638 2667
2639 /** 2668 /**
2640 * Returns true if ArrayBuffer is extrenalized, that is, does not 2669 * Returns true if ArrayBuffer is extrenalized, that is, does not
2641 * own its memory block. 2670 * own its memory block.
2642 */ 2671 */
2643 bool IsExternal() const; 2672 bool IsExternal() const;
2644 2673
2645 /** 2674 /**
2646 * Neuters this ArrayBuffer and all its views (typed arrays). 2675 * Neuters this ArrayBuffer and all its views (typed arrays).
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 DataView(); 2916 DataView();
2888 static void CheckCast(Value* obj); 2917 static void CheckCast(Value* obj);
2889 }; 2918 };
2890 2919
2891 2920
2892 /** 2921 /**
2893 * An instance of the built-in Date constructor (ECMA-262, 15.9). 2922 * An instance of the built-in Date constructor (ECMA-262, 15.9).
2894 */ 2923 */
2895 class V8_EXPORT Date : public Object { 2924 class V8_EXPORT Date : public Object {
2896 public: 2925 public:
2926 static Local<Value> New(Isolate* isolate, double time);
2927 // Will be deprecated soon.
2897 static Local<Value> New(double time); 2928 static Local<Value> New(double time);
2898 2929
2899 V8_DEPRECATED( 2930 V8_DEPRECATED(
2900 "Use ValueOf instead", 2931 "Use ValueOf instead",
2901 double NumberValue()) const { return ValueOf(); } 2932 double NumberValue() const) { return ValueOf(); }
2902 2933
2903 /** 2934 /**
2904 * A specialization of Value::NumberValue that is more efficient 2935 * A specialization of Value::NumberValue that is more efficient
2905 * because we know the structure of this object. 2936 * because we know the structure of this object.
2906 */ 2937 */
2907 double ValueOf() const; 2938 double ValueOf() const;
2908 2939
2909 V8_INLINE static Date* Cast(v8::Value* obj); 2940 V8_INLINE static Date* Cast(v8::Value* obj);
2910 2941
2911 /** 2942 /**
2912 * Notification that the embedder has changed the time zone, 2943 * Notification that the embedder has changed the time zone,
2913 * daylight savings time, or other date / time configuration 2944 * daylight savings time, or other date / time configuration
2914 * parameters. V8 keeps a cache of various values used for 2945 * parameters. V8 keeps a cache of various values used for
2915 * date / time computation. This notification will reset 2946 * date / time computation. This notification will reset
2916 * those cached values for the current context so that date / 2947 * those cached values for the current context so that date /
2917 * time configuration changes would be reflected in the Date 2948 * time configuration changes would be reflected in the Date
2918 * object. 2949 * object.
2919 * 2950 *
2920 * This API should not be called more than needed as it will 2951 * This API should not be called more than needed as it will
2921 * negatively impact the performance of date operations. 2952 * negatively impact the performance of date operations.
2922 */ 2953 */
2954 static void DateTimeConfigurationChangeNotification(Isolate* isolate);
2955 // Will be deprecated soon.
2923 static void DateTimeConfigurationChangeNotification(); 2956 static void DateTimeConfigurationChangeNotification();
2924 2957
2925 private: 2958 private:
2926 static void CheckCast(v8::Value* obj); 2959 static void CheckCast(v8::Value* obj);
2927 }; 2960 };
2928 2961
2929 2962
2930 /** 2963 /**
2931 * A Number object (ECMA-262, 4.3.21). 2964 * A Number object (ECMA-262, 4.3.21).
2932 */ 2965 */
2933 class V8_EXPORT NumberObject : public Object { 2966 class V8_EXPORT NumberObject : public Object {
2934 public: 2967 public:
2968 static Local<Value> New(Isolate* isolate, double value);
2969 // Will be deprecated soon.
2935 static Local<Value> New(double value); 2970 static Local<Value> New(double value);
2936 2971
2937 V8_DEPRECATED( 2972 V8_DEPRECATED(
2938 "Use ValueOf instead", 2973 "Use ValueOf instead",
2939 double NumberValue()) const { return ValueOf(); } 2974 double NumberValue() const) { return ValueOf(); }
2940 2975
2941 /** 2976 /**
2942 * Returns the Number held by the object. 2977 * Returns the Number held by the object.
2943 */ 2978 */
2944 double ValueOf() const; 2979 double ValueOf() const;
2945 2980
2946 V8_INLINE static NumberObject* Cast(v8::Value* obj); 2981 V8_INLINE static NumberObject* Cast(v8::Value* obj);
2947 2982
2948 private: 2983 private:
2949 static void CheckCast(v8::Value* obj); 2984 static void CheckCast(v8::Value* obj);
2950 }; 2985 };
2951 2986
2952 2987
2953 /** 2988 /**
2954 * A Boolean object (ECMA-262, 4.3.15). 2989 * A Boolean object (ECMA-262, 4.3.15).
2955 */ 2990 */
2956 class V8_EXPORT BooleanObject : public Object { 2991 class V8_EXPORT BooleanObject : public Object {
2957 public: 2992 public:
2958 static Local<Value> New(bool value); 2993 static Local<Value> New(bool value);
2959 2994
2960 V8_DEPRECATED( 2995 V8_DEPRECATED(
2961 "Use ValueOf instead", 2996 "Use ValueOf instead",
2962 bool BooleanValue()) const { return ValueOf(); } 2997 bool BooleanValue() const) { return ValueOf(); }
2963 2998
2964 /** 2999 /**
2965 * Returns the Boolean held by the object. 3000 * Returns the Boolean held by the object.
2966 */ 3001 */
2967 bool ValueOf() const; 3002 bool ValueOf() const;
2968 3003
2969 V8_INLINE static BooleanObject* Cast(v8::Value* obj); 3004 V8_INLINE static BooleanObject* Cast(v8::Value* obj);
2970 3005
2971 private: 3006 private:
2972 static void CheckCast(v8::Value* obj); 3007 static void CheckCast(v8::Value* obj);
2973 }; 3008 };
2974 3009
2975 3010
2976 /** 3011 /**
2977 * A String object (ECMA-262, 4.3.18). 3012 * A String object (ECMA-262, 4.3.18).
2978 */ 3013 */
2979 class V8_EXPORT StringObject : public Object { 3014 class V8_EXPORT StringObject : public Object {
2980 public: 3015 public:
2981 static Local<Value> New(Handle<String> value); 3016 static Local<Value> New(Handle<String> value);
2982 3017
2983 V8_DEPRECATED( 3018 V8_DEPRECATED(
2984 "Use ValueOf instead", 3019 "Use ValueOf instead",
2985 Local<String> StringValue()) const { return ValueOf(); } 3020 Local<String> StringValue() const) { return ValueOf(); }
2986 3021
2987 /** 3022 /**
2988 * Returns the String held by the object. 3023 * Returns the String held by the object.
2989 */ 3024 */
2990 Local<String> ValueOf() const; 3025 Local<String> ValueOf() const;
2991 3026
2992 V8_INLINE static StringObject* Cast(v8::Value* obj); 3027 V8_INLINE static StringObject* Cast(v8::Value* obj);
2993 3028
2994 private: 3029 private:
2995 static void CheckCast(v8::Value* obj); 3030 static void CheckCast(v8::Value* obj);
2996 }; 3031 };
2997 3032
2998 3033
2999 /** 3034 /**
3000 * A Symbol object (ECMA-262 edition 6). 3035 * A Symbol object (ECMA-262 edition 6).
3001 * 3036 *
3002 * This is an experimental feature. Use at your own risk. 3037 * This is an experimental feature. Use at your own risk.
3003 */ 3038 */
3004 class V8_EXPORT SymbolObject : public Object { 3039 class V8_EXPORT SymbolObject : public Object {
3005 public: 3040 public:
3006 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); 3041 static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
3007 3042
3008 V8_DEPRECATED( 3043 V8_DEPRECATED(
3009 "Use ValueOf instead", 3044 "Use ValueOf instead",
3010 Local<Symbol> SymbolValue()) const { return ValueOf(); } 3045 Local<Symbol> SymbolValue() const) { return ValueOf(); }
3011 3046
3012 /** 3047 /**
3013 * Returns the Symbol held by the object. 3048 * Returns the Symbol held by the object.
3014 */ 3049 */
3015 Local<Symbol> ValueOf() const; 3050 Local<Symbol> ValueOf() const;
3016 3051
3017 V8_INLINE static SymbolObject* Cast(v8::Value* obj); 3052 V8_INLINE static SymbolObject* Cast(v8::Value* obj);
3018 3053
3019 private: 3054 private:
3020 static void CheckCast(v8::Value* obj); 3055 static void CheckCast(v8::Value* obj);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 3121
3087 3122
3088 /** 3123 /**
3089 * The superclass of object and function templates. 3124 * The superclass of object and function templates.
3090 */ 3125 */
3091 class V8_EXPORT Template : public Data { 3126 class V8_EXPORT Template : public Data {
3092 public: 3127 public:
3093 /** Adds a property to each instance created by this template.*/ 3128 /** Adds a property to each instance created by this template.*/
3094 void Set(Handle<String> name, Handle<Data> value, 3129 void Set(Handle<String> name, Handle<Data> value,
3095 PropertyAttribute attributes = None); 3130 PropertyAttribute attributes = None);
3131 V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value);
3132 // Will be deprecated soon.
3096 V8_INLINE void Set(const char* name, Handle<Data> value); 3133 V8_INLINE void Set(const char* name, Handle<Data> value);
3097 3134
3098 void SetAccessorProperty( 3135 void SetAccessorProperty(
3099 Local<String> name, 3136 Local<String> name,
3100 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), 3137 Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
3101 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), 3138 Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
3102 PropertyAttribute attribute = None, 3139 PropertyAttribute attribute = None,
3103 AccessControl settings = DEFAULT); 3140 AccessControl settings = DEFAULT);
3104 3141
3105 /** 3142 /**
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
3369 * \code 3406 * \code
3370 * child_func.prototype.__proto__ == function.prototype; 3407 * child_func.prototype.__proto__ == function.prototype;
3371 * child_instance.instance_accessor calls 'InstanceAccessorCallback' 3408 * child_instance.instance_accessor calls 'InstanceAccessorCallback'
3372 * child_instance.instance_property == 3; 3409 * child_instance.instance_property == 3;
3373 * \endcode 3410 * \endcode
3374 */ 3411 */
3375 class V8_EXPORT FunctionTemplate : public Template { 3412 class V8_EXPORT FunctionTemplate : public Template {
3376 public: 3413 public:
3377 /** Creates a function template.*/ 3414 /** Creates a function template.*/
3378 static Local<FunctionTemplate> New( 3415 static Local<FunctionTemplate> New(
3416 Isolate* isolate,
3417 FunctionCallback callback = 0,
3418 Handle<Value> data = Handle<Value>(),
3419 Handle<Signature> signature = Handle<Signature>(),
3420 int length = 0);
3421 // Will be deprecated soon.
3422 static Local<FunctionTemplate> New(
3379 FunctionCallback callback = 0, 3423 FunctionCallback callback = 0,
3380 Handle<Value> data = Handle<Value>(), 3424 Handle<Value> data = Handle<Value>(),
3381 Handle<Signature> signature = Handle<Signature>(), 3425 Handle<Signature> signature = Handle<Signature>(),
3382 int length = 0); 3426 int length = 0);
3383 3427
3384 /** Returns the unique function instance in the current execution context.*/ 3428 /** Returns the unique function instance in the current execution context.*/
3385 Local<Function> GetFunction(); 3429 Local<Function> GetFunction();
3386 3430
3387 /** 3431 /**
3388 * Set the call-handler callback for a FunctionTemplate. This 3432 * Set the call-handler callback for a FunctionTemplate. This
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3455 3499
3456 /** 3500 /**
3457 * An ObjectTemplate is used to create objects at runtime. 3501 * An ObjectTemplate is used to create objects at runtime.
3458 * 3502 *
3459 * Properties added to an ObjectTemplate are added to each object 3503 * Properties added to an ObjectTemplate are added to each object
3460 * created from the ObjectTemplate. 3504 * created from the ObjectTemplate.
3461 */ 3505 */
3462 class V8_EXPORT ObjectTemplate : public Template { 3506 class V8_EXPORT ObjectTemplate : public Template {
3463 public: 3507 public:
3464 /** Creates an ObjectTemplate. */ 3508 /** Creates an ObjectTemplate. */
3509 static Local<ObjectTemplate> New(Isolate* isolate);
3510 // Will be deprecated soon.
3465 static Local<ObjectTemplate> New(); 3511 static Local<ObjectTemplate> New();
3466 3512
3467 /** Creates a new instance of this template.*/ 3513 /** Creates a new instance of this template.*/
3468 Local<Object> NewInstance(); 3514 Local<Object> NewInstance();
3469 3515
3470 /** 3516 /**
3471 * Sets an accessor on the object template. 3517 * Sets an accessor on the object template.
3472 * 3518 *
3473 * Whenever the property with the given name is accessed on objects 3519 * Whenever the property with the given name is accessed on objects
3474 * created from this ObjectTemplate the getter and setter callbacks 3520 * created from this ObjectTemplate the getter and setter callbacks
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3596 int InternalFieldCount(); 3642 int InternalFieldCount();
3597 3643
3598 /** 3644 /**
3599 * Sets the number of internal fields for objects generated from 3645 * Sets the number of internal fields for objects generated from
3600 * this template. 3646 * this template.
3601 */ 3647 */
3602 void SetInternalFieldCount(int value); 3648 void SetInternalFieldCount(int value);
3603 3649
3604 private: 3650 private:
3605 ObjectTemplate(); 3651 ObjectTemplate();
3606 static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor); 3652 static Local<ObjectTemplate> New(internal::Isolate* isolate,
3653 Handle<FunctionTemplate> constructor);
3607 friend class FunctionTemplate; 3654 friend class FunctionTemplate;
3608 }; 3655 };
3609 3656
3610 3657
3611 /** 3658 /**
3612 * A Signature specifies which receivers and arguments are valid 3659 * A Signature specifies which receivers and arguments are valid
3613 * parameters to a function. 3660 * parameters to a function.
3614 */ 3661 */
3615 class V8_EXPORT Signature : public Data { 3662 class V8_EXPORT Signature : public Data {
3616 public: 3663 public:
3664 static Local<Signature> New(Isolate* isolate,
3665 Handle<FunctionTemplate> receiver =
3666 Handle<FunctionTemplate>(),
3667 int argc = 0,
3668 Handle<FunctionTemplate> argv[] = 0);
3669 // Will be deprecated soon.
3617 static Local<Signature> New(Handle<FunctionTemplate> receiver = 3670 static Local<Signature> New(Handle<FunctionTemplate> receiver =
3618 Handle<FunctionTemplate>(), 3671 Handle<FunctionTemplate>(),
3619 int argc = 0, 3672 int argc = 0,
3620 Handle<FunctionTemplate> argv[] = 0); 3673 Handle<FunctionTemplate> argv[] = 0);
3621 private: 3674 private:
3622 Signature(); 3675 Signature();
3623 }; 3676 };
3624 3677
3625 3678
3626 /** 3679 /**
3627 * An AccessorSignature specifies which receivers are valid parameters 3680 * An AccessorSignature specifies which receivers are valid parameters
3628 * to an accessor callback. 3681 * to an accessor callback.
3629 */ 3682 */
3630 class V8_EXPORT AccessorSignature : public Data { 3683 class V8_EXPORT AccessorSignature : public Data {
3631 public: 3684 public:
3685 static Local<AccessorSignature> New(Isolate* isolate,
3686 Handle<FunctionTemplate> receiver =
3687 Handle<FunctionTemplate>());
3688 // Will be deprecated soon.
3632 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver = 3689 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver =
3633 Handle<FunctionTemplate>()); 3690 Handle<FunctionTemplate>());
3691
3634 private: 3692 private:
3635 AccessorSignature(); 3693 AccessorSignature();
3636 }; 3694 };
3637 3695
3638 3696
3639 class V8_EXPORT DeclaredAccessorDescriptor : public Data { 3697 class V8_EXPORT DeclaredAccessorDescriptor : public Data {
3640 private: 3698 private:
3641 DeclaredAccessorDescriptor(); 3699 DeclaredAccessorDescriptor();
3642 }; 3700 };
3643 3701
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 class V8_EXPORT Extension { // NOLINT 3785 class V8_EXPORT Extension { // NOLINT
3728 public: 3786 public:
3729 // Note that the strings passed into this constructor must live as long 3787 // Note that the strings passed into this constructor must live as long
3730 // as the Extension itself. 3788 // as the Extension itself.
3731 Extension(const char* name, 3789 Extension(const char* name,
3732 const char* source = 0, 3790 const char* source = 0,
3733 int dep_count = 0, 3791 int dep_count = 0,
3734 const char** deps = 0, 3792 const char** deps = 0,
3735 int source_length = -1); 3793 int source_length = -1);
3736 virtual ~Extension() { } 3794 virtual ~Extension() { }
3795 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
3796 v8::Isolate* isolate, v8::Handle<v8::String> name) {
3797 return GetNativeFunction(name);
3798 }
3799 // Will be deprecated soon.
3737 virtual v8::Handle<v8::FunctionTemplate> 3800 virtual v8::Handle<v8::FunctionTemplate>
3738 GetNativeFunction(v8::Handle<v8::String> name) { 3801 GetNativeFunction(v8::Handle<v8::String> name) {
3739 return v8::Handle<v8::FunctionTemplate>(); 3802 return v8::Handle<v8::FunctionTemplate>();
3740 } 3803 }
3741 3804
3742 const char* name() const { return name_; } 3805 const char* name() const { return name_; }
3743 size_t source_length() const { return source_length_; } 3806 size_t source_length() const { return source_length_; }
3744 const String::ExternalAsciiStringResource* source() const { 3807 const String::ExternalAsciiStringResource* source() const {
3745 return &source_; } 3808 return &source_; }
3746 int dependency_count() { return dep_count_; } 3809 int dependency_count() { return dep_count_; }
(...skipping 24 matching lines...) Expand all
3771 class V8_EXPORT DeclareExtension { 3834 class V8_EXPORT DeclareExtension {
3772 public: 3835 public:
3773 V8_INLINE DeclareExtension(Extension* extension) { 3836 V8_INLINE DeclareExtension(Extension* extension) {
3774 RegisterExtension(extension); 3837 RegisterExtension(extension);
3775 } 3838 }
3776 }; 3839 };
3777 3840
3778 3841
3779 // --- Statics --- 3842 // --- Statics ---
3780 3843
3781
3782 Handle<Primitive> V8_EXPORT Undefined();
3783 Handle<Primitive> V8_EXPORT Null();
3784 Handle<Boolean> V8_EXPORT True();
3785 Handle<Boolean> V8_EXPORT False();
3786
3787 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate); 3844 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate);
3788 V8_INLINE Handle<Primitive> Null(Isolate* isolate); 3845 V8_INLINE Handle<Primitive> Null(Isolate* isolate);
3789 V8_INLINE Handle<Boolean> True(Isolate* isolate); 3846 V8_INLINE Handle<Boolean> True(Isolate* isolate);
3790 V8_INLINE Handle<Boolean> False(Isolate* isolate); 3847 V8_INLINE Handle<Boolean> False(Isolate* isolate);
3791 3848
3849 // Will be removed soon.
3850 Handle<Primitive> V8_EXPORT Undefined();
3851 Handle<Primitive> V8_EXPORT Null();
3852 Handle<Boolean> V8_EXPORT True();
3853 Handle<Boolean> V8_EXPORT False();
3854
3792 3855
3793 /** 3856 /**
3794 * A set of constraints that specifies the limits of the runtime's memory use. 3857 * A set of constraints that specifies the limits of the runtime's memory use.
3795 * You must set the heap size before initializing the VM - the size cannot be 3858 * You must set the heap size before initializing the VM - the size cannot be
3796 * adjusted after the VM is initialized. 3859 * adjusted after the VM is initialized.
3797 * 3860 *
3798 * If you are using threads then you should hold the V8::Locker lock while 3861 * If you are using threads then you should hold the V8::Locker lock while
3799 * setting the stack limit and you must set a non-default stack limit separately 3862 * setting the stack limit and you must set a non-default stack limit separately
3800 * for each thread. 3863 * for each thread.
3801 */ 3864 */
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
4046 * Requires: this == Isolate::GetCurrent(). 4109 * Requires: this == Isolate::GetCurrent().
4047 */ 4110 */
4048 void Exit(); 4111 void Exit();
4049 4112
4050 /** 4113 /**
4051 * Disposes the isolate. The isolate must not be entered by any 4114 * Disposes the isolate. The isolate must not be entered by any
4052 * thread to be disposable. 4115 * thread to be disposable.
4053 */ 4116 */
4054 void Dispose(); 4117 void Dispose();
4055 4118
4119 V8_DEPRECATED("Use SetData(0, data) instead.",
4120 V8_INLINE void SetData(void* data));
4121 V8_DEPRECATED("Use GetData(0) instead.", V8_INLINE void* GetData());
4122
4056 /** 4123 /**
4057 * Associate embedder-specific data with the isolate 4124 * Associate embedder-specific data with the isolate. |slot| has to be
4125 * between 0 and GetNumberOfDataSlots() - 1.
4058 */ 4126 */
4059 V8_INLINE void SetData(void* data); 4127 V8_INLINE void SetData(uint32_t slot, void* data);
4060 4128
4061 /** 4129 /**
4062 * Retrieve embedder-specific data from the isolate. 4130 * Retrieve embedder-specific data from the isolate.
4063 * Returns NULL if SetData has never been called. 4131 * Returns NULL if SetData has never been called for the given |slot|.
4064 */ 4132 */
4065 V8_INLINE void* GetData(); 4133 V8_INLINE void* GetData(uint32_t slot);
4134
4135 /**
4136 * Returns the maximum number of available embedder data slots. Valid slots
4137 * are in the range of 0 - GetNumberOfDataSlots() - 1.
4138 */
4139 V8_INLINE static uint32_t GetNumberOfDataSlots();
4066 4140
4067 /** 4141 /**
4068 * Get statistics about the heap memory usage. 4142 * Get statistics about the heap memory usage.
4069 */ 4143 */
4070 void GetHeapStatistics(HeapStatistics* heap_statistics); 4144 void GetHeapStatistics(HeapStatistics* heap_statistics);
4071 4145
4072 /** 4146 /**
4073 * Adjusts the amount of registered external memory. Used to give V8 an 4147 * Adjusts the amount of registered external memory. Used to give V8 an
4074 * indication of the amount of externally allocated memory that is kept alive 4148 * indication of the amount of externally allocated memory that is kept alive
4075 * by JavaScript objects. V8 uses this to decide when to perform global 4149 * by JavaScript objects. V8 uses this to decide when to perform global
4076 * garbage collections. Registering externally allocated memory will trigger 4150 * garbage collections. Registering externally allocated memory will trigger
4077 * global garbage collections more often than it would otherwise in an attempt 4151 * global garbage collections more often than it would otherwise in an attempt
4078 * to garbage collect the JavaScript objects that keep the externally 4152 * to garbage collect the JavaScript objects that keep the externally
4079 * allocated memory alive. 4153 * allocated memory alive.
4080 * 4154 *
4081 * \param change_in_bytes the change in externally allocated memory that is 4155 * \param change_in_bytes the change in externally allocated memory that is
4082 * kept alive by JavaScript objects. 4156 * kept alive by JavaScript objects.
4083 * \returns the adjusted value. 4157 * \returns the adjusted value.
4084 */ 4158 */
4085 intptr_t AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes); 4159 int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
4086 4160
4087 /** 4161 /**
4088 * Returns heap profiler for this isolate. Will return NULL until the isolate 4162 * Returns heap profiler for this isolate. Will return NULL until the isolate
4089 * is initialized. 4163 * is initialized.
4090 */ 4164 */
4091 HeapProfiler* GetHeapProfiler(); 4165 HeapProfiler* GetHeapProfiler();
4092 4166
4093 /** 4167 /**
4094 * Returns CPU profiler for this isolate. Will return NULL unless the isolate 4168 * Returns CPU profiler for this isolate. Will return NULL unless the isolate
4095 * is initialized. It is the embedder's responsibility to stop all CPU 4169 * is initialized. It is the embedder's responsibility to stop all CPU
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
4658 * \note the set of events declared in JitCodeEvent::EventType is expected to 4732 * \note the set of events declared in JitCodeEvent::EventType is expected to
4659 * grow over time, and the JitCodeEvent structure is expected to accrue 4733 * grow over time, and the JitCodeEvent structure is expected to accrue
4660 * new members. The \p event_handler function must ignore event codes 4734 * new members. The \p event_handler function must ignore event codes
4661 * it does not recognize to maintain future compatibility. 4735 * it does not recognize to maintain future compatibility.
4662 */ 4736 */
4663 static void SetJitCodeEventHandler(JitCodeEventOptions options, 4737 static void SetJitCodeEventHandler(JitCodeEventOptions options,
4664 JitCodeEventHandler event_handler); 4738 JitCodeEventHandler event_handler);
4665 4739
4666 V8_DEPRECATED( 4740 V8_DEPRECATED(
4667 "Use Isolate::AdjustAmountOfExternalAllocatedMemory instead", 4741 "Use Isolate::AdjustAmountOfExternalAllocatedMemory instead",
4668 static intptr_t AdjustAmountOfExternalAllocatedMemory( 4742 static int64_t AdjustAmountOfExternalAllocatedMemory(
4669 intptr_t change_in_bytes)); 4743 int64_t change_in_bytes));
4670 4744
4671 /** 4745 /**
4672 * Forcefully terminate the current thread of JavaScript execution 4746 * Forcefully terminate the current thread of JavaScript execution
4673 * in the given isolate. If no isolate is provided, the default 4747 * in the given isolate. If no isolate is provided, the default
4674 * isolate is used. 4748 * isolate is used.
4675 * 4749 *
4676 * This method can be used by any thread even if that thread has not 4750 * This method can be used by any thread even if that thread has not
4677 * acquired the V8 lock with a Locker object. 4751 * acquired the V8 lock with a Locker object.
4678 * 4752 *
4679 * \param isolate The isolate in which to terminate the current JS execution. 4753 * \param isolate The isolate in which to terminate the current JS execution.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
4771 * V8 had a chance to clean up. 4845 * V8 had a chance to clean up.
4772 */ 4846 */
4773 static int ContextDisposedNotification(); 4847 static int ContextDisposedNotification();
4774 4848
4775 /** 4849 /**
4776 * Initialize the ICU library bundled with V8. The embedder should only 4850 * Initialize the ICU library bundled with V8. The embedder should only
4777 * invoke this method when using the bundled ICU. Returns true on success. 4851 * invoke this method when using the bundled ICU. Returns true on success.
4778 */ 4852 */
4779 static bool InitializeICU(); 4853 static bool InitializeICU();
4780 4854
4855 /**
4856 * Sets the v8::Platform to use. This should be invoked before V8 is
4857 * initialized.
4858 */
4859 static void InitializePlatform(Platform* platform);
4860
4861 /**
4862 * Clears all references to the v8::Platform. This should be invoked after
4863 * V8 was disposed.
4864 */
4865 static void ShutdownPlatform();
4866
4781 private: 4867 private:
4782 V8(); 4868 V8();
4783 4869
4784 static internal::Object** GlobalizeReference(internal::Isolate* isolate, 4870 static internal::Object** GlobalizeReference(internal::Isolate* isolate,
4785 internal::Object** handle); 4871 internal::Object** handle);
4786 static internal::Object** CopyPersistent(internal::Object** handle); 4872 static internal::Object** CopyPersistent(internal::Object** handle);
4787 static void DisposeGlobal(internal::Object** global_handle); 4873 static void DisposeGlobal(internal::Object** global_handle);
4788 typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; 4874 typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback;
4789 typedef WeakCallbackData<Value, void>::Callback WeakCallback; 4875 typedef WeakCallbackData<Value, void>::Callback WeakCallback;
4790 static void MakeWeak(internal::Object** global_handle, 4876 static void MakeWeak(internal::Object** global_handle,
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
5244 5330
5245 class V8_EXPORT Locker { 5331 class V8_EXPORT Locker {
5246 public: 5332 public:
5247 /** 5333 /**
5248 * Initialize Locker for a given Isolate. 5334 * Initialize Locker for a given Isolate.
5249 */ 5335 */
5250 V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); } 5336 V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); }
5251 5337
5252 ~Locker(); 5338 ~Locker();
5253 5339
5254 V8_DEPRECATED("This will be remvoed.",
5255 static void StartPreemption(Isolate *isolate, int every_n_ms));
5256
5257 V8_DEPRECATED("This will be removed",
5258 static void StopPreemption(Isolate* isolate));
5259
5260 /** 5340 /**
5261 * Returns whether or not the locker for a given isolate, is locked by the 5341 * Returns whether or not the locker for a given isolate, is locked by the
5262 * current thread. 5342 * current thread.
5263 */ 5343 */
5264 static bool IsLocked(Isolate* isolate); 5344 static bool IsLocked(Isolate* isolate);
5265 5345
5266 /** 5346 /**
5267 * Returns whether v8::Locker is being used by this V8 instance. 5347 * Returns whether v8::Locker is being used by this V8 instance.
5268 */ 5348 */
5269 static bool IsActive(); 5349 static bool IsActive();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 static const int kForeignAddressOffset = kApiPointerSize; 5521 static const int kForeignAddressOffset = kApiPointerSize;
5442 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; 5522 static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
5443 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; 5523 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
5444 static const int kContextHeaderSize = 2 * kApiPointerSize; 5524 static const int kContextHeaderSize = 2 * kApiPointerSize;
5445 static const int kContextEmbedderDataIndex = 65; 5525 static const int kContextEmbedderDataIndex = 65;
5446 static const int kFullStringRepresentationMask = 0x07; 5526 static const int kFullStringRepresentationMask = 0x07;
5447 static const int kStringEncodingMask = 0x4; 5527 static const int kStringEncodingMask = 0x4;
5448 static const int kExternalTwoByteRepresentationTag = 0x02; 5528 static const int kExternalTwoByteRepresentationTag = 0x02;
5449 static const int kExternalAsciiRepresentationTag = 0x06; 5529 static const int kExternalAsciiRepresentationTag = 0x06;
5450 5530
5451 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; 5531 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize;
5452 static const int kIsolateRootsOffset = 3 * kApiPointerSize; 5532 static const int kIsolateRootsOffset = 5 * kApiPointerSize;
5453 static const int kUndefinedValueRootIndex = 5; 5533 static const int kUndefinedValueRootIndex = 5;
5454 static const int kNullValueRootIndex = 7; 5534 static const int kNullValueRootIndex = 7;
5455 static const int kTrueValueRootIndex = 8; 5535 static const int kTrueValueRootIndex = 8;
5456 static const int kFalseValueRootIndex = 9; 5536 static const int kFalseValueRootIndex = 9;
5457 static const int kEmptyStringRootIndex = 134; 5537 static const int kEmptyStringRootIndex = 134;
5458 5538
5459 static const int kNodeClassIdOffset = 1 * kApiPointerSize; 5539 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
5460 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; 5540 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
5461 static const int kNodeStateMask = 0xf; 5541 static const int kNodeStateMask = 0xf;
5462 static const int kNodeStateIsWeakValue = 2; 5542 static const int kNodeStateIsWeakValue = 2;
5463 static const int kNodeStateIsPendingValue = 3; 5543 static const int kNodeStateIsPendingValue = 3;
5464 static const int kNodeStateIsNearDeathValue = 4; 5544 static const int kNodeStateIsNearDeathValue = 4;
5465 static const int kNodeIsIndependentShift = 4; 5545 static const int kNodeIsIndependentShift = 4;
5466 static const int kNodeIsPartiallyDependentShift = 5; 5546 static const int kNodeIsPartiallyDependentShift = 5;
5467 5547
5468 static const int kJSObjectType = 0xb2; 5548 static const int kJSObjectType = 0xb2;
5469 static const int kFirstNonstringType = 0x80; 5549 static const int kFirstNonstringType = 0x80;
5470 static const int kOddballType = 0x83; 5550 static const int kOddballType = 0x83;
5471 static const int kForeignType = 0x87; 5551 static const int kForeignType = 0x87;
5472 5552
5473 static const int kUndefinedOddballKind = 5; 5553 static const int kUndefinedOddballKind = 5;
5474 static const int kNullOddballKind = 3; 5554 static const int kNullOddballKind = 3;
5475 5555
5556 static const uint32_t kNumIsolateDataSlots = 4;
5557
5476 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); 5558 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate);
5477 V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { 5559 V8_INLINE static void CheckInitialized(v8::Isolate* isolate) {
5478 #ifdef V8_ENABLE_CHECKS 5560 #ifdef V8_ENABLE_CHECKS
5479 CheckInitializedImpl(isolate); 5561 CheckInitializedImpl(isolate);
5480 #endif 5562 #endif
5481 } 5563 }
5482 5564
5483 V8_INLINE static bool HasHeapObjectTag(internal::Object* value) { 5565 V8_INLINE static bool HasHeapObjectTag(internal::Object* value) {
5484 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == 5566 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
5485 kHeapObjectTag); 5567 kHeapObjectTag);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5529 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; 5611 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5530 return *addr & kNodeStateMask; 5612 return *addr & kNodeStateMask;
5531 } 5613 }
5532 5614
5533 V8_INLINE static void UpdateNodeState(internal::Object** obj, 5615 V8_INLINE static void UpdateNodeState(internal::Object** obj,
5534 uint8_t value) { 5616 uint8_t value) {
5535 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; 5617 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
5536 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); 5618 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value);
5537 } 5619 }
5538 5620
5539 V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, void* data) { 5621 V8_INLINE static void SetEmbedderData(v8::Isolate *isolate,
5540 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + 5622 uint32_t slot,
5541 kIsolateEmbedderDataOffset; 5623 void *data) {
5624 uint8_t *addr = reinterpret_cast<uint8_t *>(isolate) +
5625 kIsolateEmbedderDataOffset + slot * kApiPointerSize;
5542 *reinterpret_cast<void**>(addr) = data; 5626 *reinterpret_cast<void**>(addr) = data;
5543 } 5627 }
5544 5628
5545 V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate) { 5629 V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate, uint32_t slot) {
5546 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + 5630 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
5547 kIsolateEmbedderDataOffset; 5631 kIsolateEmbedderDataOffset + slot * kApiPointerSize;
5548 return *reinterpret_cast<void**>(addr); 5632 return *reinterpret_cast<void**>(addr);
5549 } 5633 }
5550 5634
5551 V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate, 5635 V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate,
5552 int index) { 5636 int index) {
5553 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset; 5637 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset;
5554 return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize); 5638 return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize);
5555 } 5639 }
5556 5640
5557 template <typename T> V8_INLINE static T ReadField(Object* ptr, int offset) { 5641 template <typename T> V8_INLINE static T ReadField(Object* ptr, int offset) {
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
6002 6086
6003 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { 6087 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const {
6004 return resource_column_offset_; 6088 return resource_column_offset_;
6005 } 6089 }
6006 6090
6007 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { 6091 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const {
6008 return resource_is_shared_cross_origin_; 6092 return resource_is_shared_cross_origin_;
6009 } 6093 }
6010 6094
6011 6095
6096 Handle<Boolean> Boolean::New(Isolate* isolate, bool value) {
6097 return value ? True(isolate) : False(isolate);
6098 }
6099
6100
6012 Handle<Boolean> Boolean::New(bool value) { 6101 Handle<Boolean> Boolean::New(bool value) {
6013 Isolate* isolate = Isolate::GetCurrent(); 6102 return Boolean::New(Isolate::GetCurrent(), value);
6014 return value ? True(isolate) : False(isolate); 6103 }
6104
6105
6106 void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> value) {
6107 Set(v8::String::NewFromUtf8(isolate, name), value);
6015 } 6108 }
6016 6109
6017 6110
6018 void Template::Set(const char* name, v8::Handle<Data> value) { 6111 void Template::Set(const char* name, v8::Handle<Data> value) {
6019 Set(v8::String::New(name), value); 6112 Set(Isolate::GetCurrent(), name, value);
6020 } 6113 }
6021 6114
6022 6115
6023 Local<Value> Object::GetInternalField(int index) { 6116 Local<Value> Object::GetInternalField(int index) {
6024 #ifndef V8_ENABLE_CHECKS 6117 #ifndef V8_ENABLE_CHECKS
6025 typedef internal::Object O; 6118 typedef internal::Object O;
6026 typedef internal::HeapObject HO; 6119 typedef internal::HeapObject HO;
6027 typedef internal::Internals I; 6120 typedef internal::Internals I;
6028 O* obj = *reinterpret_cast<O**>(this); 6121 O* obj = *reinterpret_cast<O**>(this);
6029 // Fast path: If the object is a plain JSObject, which is the common case, we 6122 // Fast path: If the object is a plain JSObject, which is the common case, we
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
6463 typedef internal::Object* S; 6556 typedef internal::Object* S;
6464 typedef internal::Internals I; 6557 typedef internal::Internals I;
6465 I::CheckInitialized(isolate); 6558 I::CheckInitialized(isolate);
6466 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); 6559 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
6467 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); 6560 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
6468 } 6561 }
6469 6562
6470 6563
6471 void Isolate::SetData(void* data) { 6564 void Isolate::SetData(void* data) {
6472 typedef internal::Internals I; 6565 typedef internal::Internals I;
6473 I::SetEmbedderData(this, data); 6566 I::SetEmbedderData(this, 0, data);
6474 } 6567 }
6475 6568
6476 6569
6477 void* Isolate::GetData() { 6570 void* Isolate::GetData() {
6478 typedef internal::Internals I; 6571 typedef internal::Internals I;
6479 return I::GetEmbedderData(this); 6572 return I::GetEmbedderData(this, 0);
6480 } 6573 }
6481 6574
6482 6575
6576 void Isolate::SetData(uint32_t slot, void* data) {
6577 typedef internal::Internals I;
6578 I::SetEmbedderData(this, slot, data);
6579 }
6580
6581
6582 void* Isolate::GetData(uint32_t slot) {
6583 typedef internal::Internals I;
6584 return I::GetEmbedderData(this, slot);
6585 }
6586
6587
6588 uint32_t Isolate::GetNumberOfDataSlots() {
6589 typedef internal::Internals I;
6590 return I::kNumIsolateDataSlots;
6591 }
6592
6593
6483 template<typename T> 6594 template<typename T>
6484 void Isolate::SetObjectGroupId(const Persistent<T>& object, 6595 void Isolate::SetObjectGroupId(const Persistent<T>& object,
6485 UniqueId id) { 6596 UniqueId id) {
6486 TYPE_CHECK(Value, T); 6597 TYPE_CHECK(Value, T);
6487 SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id); 6598 SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id);
6488 } 6599 }
6489 6600
6490 6601
6491 template<typename T> 6602 template<typename T>
6492 void Isolate::SetReferenceFromGroup(UniqueId id, 6603 void Isolate::SetReferenceFromGroup(UniqueId id,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
6544 */ 6655 */
6545 6656
6546 6657
6547 } // namespace v8 6658 } // namespace v8
6548 6659
6549 6660
6550 #undef TYPE_CHECK 6661 #undef TYPE_CHECK
6551 6662
6552 6663
6553 #endif // V8_H_ 6664 #endif // V8_H_
OLDNEW
« no previous file with comments | « build/standalone.gypi ('k') | include/v8-platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698