| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 // --- S t a t i c s --- | 1974 // --- S t a t i c s --- |
| 1975 | 1975 |
| 1976 | 1976 |
| 1977 Handle<Primitive> V8EXPORT Undefined(); | 1977 Handle<Primitive> V8EXPORT Undefined(); |
| 1978 Handle<Primitive> V8EXPORT Null(); | 1978 Handle<Primitive> V8EXPORT Null(); |
| 1979 Handle<Boolean> V8EXPORT True(); | 1979 Handle<Boolean> V8EXPORT True(); |
| 1980 Handle<Boolean> V8EXPORT False(); | 1980 Handle<Boolean> V8EXPORT False(); |
| 1981 | 1981 |
| 1982 | 1982 |
| 1983 /** | 1983 /** |
| 1984 * A set of constraints that specifies the limits of the runtime's | 1984 * A set of constraints that specifies the limits of the runtime's memory use. |
| 1985 * memory use. | 1985 * You must set the heap size before initializing the VM - the size cannot be |
| 1986 * adjusted after the VM is initialized. |
| 1987 * |
| 1988 * If you are using threads then you should hold the V8::Locker lock while |
| 1989 * setting the stack limit and you must set a non-default stack limit separately |
| 1990 * for each thread. |
| 1986 */ | 1991 */ |
| 1987 class V8EXPORT ResourceConstraints { | 1992 class V8EXPORT ResourceConstraints { |
| 1988 public: | 1993 public: |
| 1989 ResourceConstraints(); | 1994 ResourceConstraints(); |
| 1990 int max_young_space_size() const { return max_young_space_size_; } | 1995 int max_young_space_size() const { return max_young_space_size_; } |
| 1991 void set_max_young_space_size(int value) { max_young_space_size_ = value; } | 1996 void set_max_young_space_size(int value) { max_young_space_size_ = value; } |
| 1992 int max_old_space_size() const { return max_old_space_size_; } | 1997 int max_old_space_size() const { return max_old_space_size_; } |
| 1993 void set_max_old_space_size(int value) { max_old_space_size_ = value; } | 1998 void set_max_old_space_size(int value) { max_old_space_size_ = value; } |
| 1994 uint32_t* stack_limit() const { return stack_limit_; } | 1999 uint32_t* stack_limit() const { return stack_limit_; } |
| 2000 // Sets an address beyond which the VM's stack may not grow. |
| 1995 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } | 2001 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } |
| 1996 private: | 2002 private: |
| 1997 int max_young_space_size_; | 2003 int max_young_space_size_; |
| 1998 int max_old_space_size_; | 2004 int max_old_space_size_; |
| 1999 uint32_t* stack_limit_; | 2005 uint32_t* stack_limit_; |
| 2000 }; | 2006 }; |
| 2001 | 2007 |
| 2002 | 2008 |
| 2003 bool SetResourceConstraints(ResourceConstraints* constraints); | 2009 bool SetResourceConstraints(ResourceConstraints* constraints); |
| 2004 | 2010 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 * object in the group is alive, all objects in the group are alive. | 2198 * object in the group is alive, all objects in the group are alive. |
| 2193 * After each garbage collection, object groups are removed. It is | 2199 * After each garbage collection, object groups are removed. It is |
| 2194 * intended to be used in the before-garbage-collection callback | 2200 * intended to be used in the before-garbage-collection callback |
| 2195 * function, for instance to simulate DOM tree connections among JS | 2201 * function, for instance to simulate DOM tree connections among JS |
| 2196 * wrapper objects. | 2202 * wrapper objects. |
| 2197 */ | 2203 */ |
| 2198 static void AddObjectGroup(Persistent<Value>* objects, size_t length); | 2204 static void AddObjectGroup(Persistent<Value>* objects, size_t length); |
| 2199 | 2205 |
| 2200 /** | 2206 /** |
| 2201 * Initializes from snapshot if possible. Otherwise, attempts to | 2207 * Initializes from snapshot if possible. Otherwise, attempts to |
| 2202 * initialize from scratch. | 2208 * initialize from scratch. This function is called implicitly if |
| 2209 * you use the API without calling it first. |
| 2203 */ | 2210 */ |
| 2204 static bool Initialize(); | 2211 static bool Initialize(); |
| 2205 | 2212 |
| 2206 /** | 2213 /** |
| 2207 * Adjusts the amount of registered external memory. Used to give | 2214 * Adjusts the amount of registered external memory. Used to give |
| 2208 * V8 an indication of the amount of externally allocated memory | 2215 * V8 an indication of the amount of externally allocated memory |
| 2209 * that is kept alive by JavaScript objects. V8 uses this to decide | 2216 * that is kept alive by JavaScript objects. V8 uses this to decide |
| 2210 * when to perform global garbage collections. Registering | 2217 * when to perform global garbage collections. Registering |
| 2211 * externally allocated memory will trigger global garbage | 2218 * externally allocated memory will trigger global garbage |
| 2212 * collections more often than otherwise in an attempt to garbage | 2219 * collections more often than otherwise in an attempt to garbage |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 // These constants are compiler dependent so their values must be | 2749 // These constants are compiler dependent so their values must be |
| 2743 // defined within the implementation. | 2750 // defined within the implementation. |
| 2744 V8EXPORT static int kJSObjectType; | 2751 V8EXPORT static int kJSObjectType; |
| 2745 V8EXPORT static int kFirstNonstringType; | 2752 V8EXPORT static int kFirstNonstringType; |
| 2746 V8EXPORT static int kProxyType; | 2753 V8EXPORT static int kProxyType; |
| 2747 | 2754 |
| 2748 static inline bool HasHeapObjectTag(internal::Object* value) { | 2755 static inline bool HasHeapObjectTag(internal::Object* value) { |
| 2749 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | 2756 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == |
| 2750 kHeapObjectTag); | 2757 kHeapObjectTag); |
| 2751 } | 2758 } |
| 2752 | 2759 |
| 2753 static inline bool HasSmiTag(internal::Object* value) { | 2760 static inline bool HasSmiTag(internal::Object* value) { |
| 2754 return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); | 2761 return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); |
| 2755 } | 2762 } |
| 2756 | 2763 |
| 2757 static inline int SmiValue(internal::Object* value) { | 2764 static inline int SmiValue(internal::Object* value) { |
| 2758 return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> kSmiTagSize; | 2765 return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> kSmiTagSize; |
| 2759 } | 2766 } |
| 2760 | 2767 |
| 2761 static inline bool IsExternalTwoByteString(int instance_type) { | 2768 static inline bool IsExternalTwoByteString(int instance_type) { |
| 2762 int representation = (instance_type & kFullStringRepresentationMask); | 2769 int representation = (instance_type & kFullStringRepresentationMask); |
| 2763 return representation == kExternalTwoByteRepresentationTag; | 2770 return representation == kExternalTwoByteRepresentationTag; |
| 2764 } | 2771 } |
| 2765 | 2772 |
| 2766 template <typename T> | 2773 template <typename T> |
| 2767 static inline T ReadField(Object* ptr, int offset) { | 2774 static inline T ReadField(Object* ptr, int offset) { |
| 2768 uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag; | 2775 uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag; |
| 2769 return *reinterpret_cast<T*>(addr); | 2776 return *reinterpret_cast<T*>(addr); |
| 2770 } | 2777 } |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 | 3103 |
| 3097 } // namespace v8 | 3104 } // namespace v8 |
| 3098 | 3105 |
| 3099 | 3106 |
| 3100 #undef V8EXPORT | 3107 #undef V8EXPORT |
| 3101 #undef V8EXPORT_INLINE | 3108 #undef V8EXPORT_INLINE |
| 3102 #undef TYPE_CHECK | 3109 #undef TYPE_CHECK |
| 3103 | 3110 |
| 3104 | 3111 |
| 3105 #endif // V8_H_ | 3112 #endif // V8_H_ |
| OLD | NEW |