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

Side by Side Diff: include/v8.h

Issue 149133004: A64: Synchronize with r17807. (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/all.gyp ('k') | include/v8-defaults.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 class ObjectTemplate; 107 class ObjectTemplate;
108 class Primitive; 108 class Primitive;
109 class RawOperationDescriptor; 109 class RawOperationDescriptor;
110 class Signature; 110 class Signature;
111 class StackFrame; 111 class StackFrame;
112 class StackTrace; 112 class StackTrace;
113 class String; 113 class String;
114 class StringObject; 114 class StringObject;
115 class Symbol; 115 class Symbol;
116 class SymbolObject; 116 class SymbolObject;
117 class Private;
117 class Uint32; 118 class Uint32;
118 class Utils; 119 class Utils;
119 class Value; 120 class Value;
120 template <class T> class Handle; 121 template <class T> class Handle;
121 template <class T> class Local; 122 template <class T> class Local;
122 template <class T> class Eternal; 123 template <class T> class Eternal;
123 template<class T> class NonCopyablePersistentTraits; 124 template<class T> class NonCopyablePersistentTraits;
124 template<class T, 125 template<class T,
125 class M = NonCopyablePersistentTraits<T> > class Persistent; 126 class M = NonCopyablePersistentTraits<T> > class Persistent;
126 template<class T, class P> class WeakCallbackObject; 127 template<class T, class P> class WeakCallbackObject;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 template<class F> friend class Local; 322 template<class F> friend class Local;
322 template<class F> friend class FunctionCallbackInfo; 323 template<class F> friend class FunctionCallbackInfo;
323 template<class F> friend class PropertyCallbackInfo; 324 template<class F> friend class PropertyCallbackInfo;
324 template<class F> friend class internal::CustomArguments; 325 template<class F> friend class internal::CustomArguments;
325 friend Handle<Primitive> Undefined(Isolate* isolate); 326 friend Handle<Primitive> Undefined(Isolate* isolate);
326 friend Handle<Primitive> Null(Isolate* isolate); 327 friend Handle<Primitive> Null(Isolate* isolate);
327 friend Handle<Boolean> True(Isolate* isolate); 328 friend Handle<Boolean> True(Isolate* isolate);
328 friend Handle<Boolean> False(Isolate* isolate); 329 friend Handle<Boolean> False(Isolate* isolate);
329 friend class Context; 330 friend class Context;
330 friend class HandleScope; 331 friend class HandleScope;
332 friend class Object;
333 friend class Private;
331 334
332 V8_INLINE static Handle<T> New(Isolate* isolate, T* that); 335 V8_INLINE static Handle<T> New(Isolate* isolate, T* that);
333 336
334 T* val_; 337 T* val_;
335 }; 338 };
336 339
337 340
338 /** 341 /**
339 * A light-weight stack-allocated object handle. All operations 342 * A light-weight stack-allocated object handle. All operations
340 * that return objects from within v8 return them in local handles. They 343 * that return objects from within v8 return them in local handles. They
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 /** 1922 /**
1920 * A JavaScript symbol (ECMA-262 edition 6) 1923 * A JavaScript symbol (ECMA-262 edition 6)
1921 * 1924 *
1922 * This is an experimental feature. Use at your own risk. 1925 * This is an experimental feature. Use at your own risk.
1923 */ 1926 */
1924 class V8_EXPORT Symbol : public Primitive { 1927 class V8_EXPORT Symbol : public Primitive {
1925 public: 1928 public:
1926 // Returns the print name string of the symbol, or undefined if none. 1929 // Returns the print name string of the symbol, or undefined if none.
1927 Local<Value> Name() const; 1930 Local<Value> Name() const;
1928 1931
1929 // Create a symbol without a print name. 1932 // Create a symbol. If data is not NULL, it will be used as a print name.
1930 static Local<Symbol> New(Isolate* isolate); 1933 static Local<Symbol> New(
1931 1934 Isolate *isolate, const char* data = NULL, int length = -1);
1932 // Create a symbol with a print name.
1933 static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1);
1934 1935
1935 V8_INLINE static Symbol* Cast(v8::Value* obj); 1936 V8_INLINE static Symbol* Cast(v8::Value* obj);
1936 private: 1937 private:
1937 Symbol(); 1938 Symbol();
1938 static void CheckCast(v8::Value* obj); 1939 static void CheckCast(v8::Value* obj);
1939 }; 1940 };
1940 1941
1941 1942
1942 /** 1943 /**
1944 * A private symbol
1945 *
1946 * This is an experimental feature. Use at your own risk.
1947 */
1948 class V8_EXPORT Private : public Data {
1949 public:
1950 // Returns the print name string of the private symbol, or undefined if none.
1951 Local<Value> Name() const;
1952
1953 // Create a private symbol. If data is not NULL, it will be the print name.
1954 static Local<Private> New(
1955 Isolate *isolate, const char* data = NULL, int length = -1);
1956
1957 private:
1958 Private();
1959 };
1960
1961
1962 /**
1943 * A JavaScript number value (ECMA-262, 4.3.20) 1963 * A JavaScript number value (ECMA-262, 4.3.20)
1944 */ 1964 */
1945 class V8_EXPORT Number : public Primitive { 1965 class V8_EXPORT Number : public Primitive {
1946 public: 1966 public:
1947 double Value() const; 1967 double Value() const;
1948 static Local<Number> New(double value); 1968 static Local<Number> New(double value);
1949 static Local<Number> New(Isolate* isolate, double value); 1969 static Local<Number> New(Isolate* isolate, double value);
1950 V8_INLINE static Number* Cast(v8::Value* obj); 1970 V8_INLINE static Number* Cast(v8::Value* obj);
1951 private: 1971 private:
1952 Number(); 1972 Number();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 AccessControl settings = DEFAULT, 2122 AccessControl settings = DEFAULT,
2103 PropertyAttribute attribute = None); 2123 PropertyAttribute attribute = None);
2104 2124
2105 // This function is not yet stable and should not be used at this time. 2125 // This function is not yet stable and should not be used at this time.
2106 bool SetDeclaredAccessor(Local<String> name, 2126 bool SetDeclaredAccessor(Local<String> name,
2107 Local<DeclaredAccessorDescriptor> descriptor, 2127 Local<DeclaredAccessorDescriptor> descriptor,
2108 PropertyAttribute attribute = None, 2128 PropertyAttribute attribute = None,
2109 AccessControl settings = DEFAULT); 2129 AccessControl settings = DEFAULT);
2110 2130
2111 /** 2131 /**
2132 * Functionality for private properties.
2133 * This is an experimental feature, use at your own risk.
2134 * Note: Private properties are inherited. Do not rely on this, since it may
2135 * change.
2136 */
2137 bool HasPrivate(Handle<Private> key);
2138 bool SetPrivate(Handle<Private> key, Handle<Value> value);
2139 bool DeletePrivate(Handle<Private> key);
2140 Local<Value> GetPrivate(Handle<Private> key);
2141
2142 /**
2112 * Returns an array containing the names of the enumerable properties 2143 * Returns an array containing the names of the enumerable properties
2113 * of this object, including properties from prototype objects. The 2144 * of this object, including properties from prototype objects. The
2114 * array returned by this method contains the same values as would 2145 * array returned by this method contains the same values as would
2115 * be enumerated by a for-in statement over this object. 2146 * be enumerated by a for-in statement over this object.
2116 */ 2147 */
2117 Local<Array> GetPropertyNames(); 2148 Local<Array> GetPropertyNames();
2118 2149
2119 /** 2150 /**
2120 * This function has the same functionality as GetPropertyNames but 2151 * This function has the same functionality as GetPropertyNames but
2121 * the returned array doesn't contain the names of properties from 2152 * the returned array doesn't contain the names of properties from
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 static void CheckCast(v8::Value* obj); 3066 static void CheckCast(v8::Value* obj);
3036 }; 3067 };
3037 3068
3038 3069
3039 /** 3070 /**
3040 * A JavaScript value that wraps a C++ void*. This type of value is mainly used 3071 * A JavaScript value that wraps a C++ void*. This type of value is mainly used
3041 * to associate C++ data structures with JavaScript objects. 3072 * to associate C++ data structures with JavaScript objects.
3042 */ 3073 */
3043 class V8_EXPORT External : public Value { 3074 class V8_EXPORT External : public Value {
3044 public: 3075 public:
3076 static Local<External> New(Isolate* isolate, void* value);
3077 // Deprecated, do not use.
3045 static Local<External> New(void* value); 3078 static Local<External> New(void* value);
3046 V8_INLINE static External* Cast(Value* obj); 3079 V8_INLINE static External* Cast(Value* obj);
3047 void* Value() const; 3080 void* Value() const;
3048 private: 3081 private:
3049 static void CheckCast(v8::Value* obj); 3082 static void CheckCast(v8::Value* obj);
3050 }; 3083 };
3051 3084
3052 3085
3053 // --- Templates --- 3086 // --- Templates ---
3054 3087
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
3763 * You must set the heap size before initializing the VM - the size cannot be 3796 * You must set the heap size before initializing the VM - the size cannot be
3764 * adjusted after the VM is initialized. 3797 * adjusted after the VM is initialized.
3765 * 3798 *
3766 * If you are using threads then you should hold the V8::Locker lock while 3799 * If you are using threads then you should hold the V8::Locker lock while
3767 * setting the stack limit and you must set a non-default stack limit separately 3800 * setting the stack limit and you must set a non-default stack limit separately
3768 * for each thread. 3801 * for each thread.
3769 */ 3802 */
3770 class V8_EXPORT ResourceConstraints { 3803 class V8_EXPORT ResourceConstraints {
3771 public: 3804 public:
3772 ResourceConstraints(); 3805 ResourceConstraints();
3806
3807 /**
3808 * Configures the constraints with reasonable default values based on the
3809 * capabilities of the current device the VM is running on.
3810 *
3811 * \param physical_memory The total amount of physical memory on the current
3812 * device, in bytes.
3813 */
3814 void ConfigureDefaults(uint64_t physical_memory);
3815
3773 int max_young_space_size() const { return max_young_space_size_; } 3816 int max_young_space_size() const { return max_young_space_size_; }
3774 void set_max_young_space_size(int value) { max_young_space_size_ = value; } 3817 void set_max_young_space_size(int value) { max_young_space_size_ = value; }
3775 int max_old_space_size() const { return max_old_space_size_; } 3818 int max_old_space_size() const { return max_old_space_size_; }
3776 void set_max_old_space_size(int value) { max_old_space_size_ = value; } 3819 void set_max_old_space_size(int value) { max_old_space_size_ = value; }
3777 int max_executable_size() { return max_executable_size_; } 3820 int max_executable_size() { return max_executable_size_; }
3778 void set_max_executable_size(int value) { max_executable_size_ = value; } 3821 void set_max_executable_size(int value) { max_executable_size_ = value; }
3779 uint32_t* stack_limit() const { return stack_limit_; } 3822 uint32_t* stack_limit() const { return stack_limit_; }
3780 // Sets an address beyond which the VM's stack may not grow. 3823 // Sets an address beyond which the VM's stack may not grow.
3781 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } 3824 void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
3782 3825
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
5196 5239
5197 class V8_EXPORT Locker { 5240 class V8_EXPORT Locker {
5198 public: 5241 public:
5199 /** 5242 /**
5200 * Initialize Locker for a given Isolate. 5243 * Initialize Locker for a given Isolate.
5201 */ 5244 */
5202 V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); } 5245 V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); }
5203 5246
5204 ~Locker(); 5247 ~Locker();
5205 5248
5206 /** 5249 V8_DEPRECATED("This will be remvoed.",
5207 * Start preemption. 5250 static void StartPreemption(Isolate *isolate, int every_n_ms));
5208 *
5209 * When preemption is started, a timer is fired every n milliseconds
5210 * that will switch between multiple threads that are in contention
5211 * for the V8 lock.
5212 */
5213 static void StartPreemption(Isolate* isolate, int every_n_ms);
5214 5251
5215 /** 5252 V8_DEPRECATED("This will be removed",
5216 * Stop preemption. 5253 static void StopPreemption(Isolate* isolate));
5217 */
5218 static void StopPreemption(Isolate* isolate);
5219 5254
5220 /** 5255 /**
5221 * Returns whether or not the locker for a given isolate, is locked by the 5256 * Returns whether or not the locker for a given isolate, is locked by the
5222 * current thread. 5257 * current thread.
5223 */ 5258 */
5224 static bool IsLocked(Isolate* isolate); 5259 static bool IsLocked(Isolate* isolate);
5225 5260
5226 /** 5261 /**
5227 * Returns whether v8::Locker is being used by this V8 instance. 5262 * Returns whether v8::Locker is being used by this V8 instance.
5228 */ 5263 */
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
5812 if (V8_LIKELY(I::IsValidSmi(i))) { 5847 if (V8_LIKELY(I::IsValidSmi(i))) {
5813 *value_ = I::IntToSmi(i); 5848 *value_ = I::IntToSmi(i);
5814 return; 5849 return;
5815 } 5850 }
5816 Set(Integer::New(i, GetIsolate())); 5851 Set(Integer::New(i, GetIsolate()));
5817 } 5852 }
5818 5853
5819 template<typename T> 5854 template<typename T>
5820 void ReturnValue<T>::Set(uint32_t i) { 5855 void ReturnValue<T>::Set(uint32_t i) {
5821 TYPE_CHECK(T, Integer); 5856 TYPE_CHECK(T, Integer);
5822 typedef internal::Internals I;
5823 // Can't simply use INT32_MAX here for whatever reason. 5857 // Can't simply use INT32_MAX here for whatever reason.
5824 bool fits_into_int32_t = (i & (1U << 31)) == 0; 5858 bool fits_into_int32_t = (i & (1U << 31)) == 0;
5825 if (V8_LIKELY(fits_into_int32_t)) { 5859 if (V8_LIKELY(fits_into_int32_t)) {
5826 Set(static_cast<int32_t>(i)); 5860 Set(static_cast<int32_t>(i));
5827 return; 5861 return;
5828 } 5862 }
5829 Set(Integer::NewFromUnsigned(i, GetIsolate())); 5863 Set(Integer::NewFromUnsigned(i, GetIsolate()));
5830 } 5864 }
5831 5865
5832 template<typename T> 5866 template<typename T>
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
6505 */ 6539 */
6506 6540
6507 6541
6508 } // namespace v8 6542 } // namespace v8
6509 6543
6510 6544
6511 #undef TYPE_CHECK 6545 #undef TYPE_CHECK
6512 6546
6513 6547
6514 #endif // V8_H_ 6548 #endif // V8_H_
OLDNEW
« no previous file with comments | « build/all.gyp ('k') | include/v8-defaults.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698