OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 // --- Handles --- | 217 // --- Handles --- |
218 | 218 |
219 #define TYPE_CHECK(T, S) \ | 219 #define TYPE_CHECK(T, S) \ |
220 while (false) { \ | 220 while (false) { \ |
221 *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ | 221 *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ |
222 } | 222 } |
223 | 223 |
224 | 224 |
225 #define V8_USE_UNSAFE_HANDLES | 225 #define V8_USE_UNSAFE_HANDLES |
226 #define V8_USE_OLD_STYLE_PERSISTENT_HANDLE_VISITORS | |
227 | 226 |
228 /** | 227 /** |
229 * An object reference managed by the v8 garbage collector. | 228 * An object reference managed by the v8 garbage collector. |
230 * | 229 * |
231 * All objects returned from v8 have to be tracked by the garbage | 230 * All objects returned from v8 have to be tracked by the garbage |
232 * collector so that it knows that the objects are still alive. Also, | 231 * collector so that it knows that the objects are still alive. Also, |
233 * because the garbage collector may move objects, it is unsafe to | 232 * because the garbage collector may move objects, it is unsafe to |
234 * point directly to an object. Instead, all objects are stored in | 233 * point directly to an object. Instead, all objects are stored in |
235 * handles which are known by the garbage collector and updated | 234 * handles which are known by the garbage collector and updated |
236 * whenever an object moves. Handles should always be passed by value | 235 * whenever an object moves. Handles should always be passed by value |
(...skipping 3881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4118 virtual void VisitExternalString(Handle<String> string) {} | 4117 virtual void VisitExternalString(Handle<String> string) {} |
4119 }; | 4118 }; |
4120 | 4119 |
4121 | 4120 |
4122 /** | 4121 /** |
4123 * Interface for iterating through all the persistent handles in the heap. | 4122 * Interface for iterating through all the persistent handles in the heap. |
4124 */ | 4123 */ |
4125 class V8EXPORT PersistentHandleVisitor { // NOLINT | 4124 class V8EXPORT PersistentHandleVisitor { // NOLINT |
4126 public: | 4125 public: |
4127 virtual ~PersistentHandleVisitor() {} | 4126 virtual ~PersistentHandleVisitor() {} |
4128 #ifdef V8_USE_OLD_STYLE_PERSISTENT_HANDLE_VISITORS | |
4129 virtual void VisitPersistentHandle(Persistent<Value> value, | |
4130 uint16_t class_id) {} | |
4131 #else | |
4132 virtual void VisitPersistentHandle(Persistent<Value>* value, | 4127 virtual void VisitPersistentHandle(Persistent<Value>* value, |
4133 uint16_t class_id) {} | 4128 uint16_t class_id) {} |
4134 #endif | |
4135 }; | 4129 }; |
4136 | 4130 |
4137 | 4131 |
4138 /** | 4132 /** |
4139 * Asserts that no action is performed that could cause a handle's value | 4133 * Asserts that no action is performed that could cause a handle's value |
4140 * to be modified. Useful when otherwise unsafe handle operations need to | 4134 * to be modified. Useful when otherwise unsafe handle operations need to |
4141 * be performed. | 4135 * be performed. |
4142 */ | 4136 */ |
4143 class V8EXPORT AssertNoGCScope { | 4137 class V8EXPORT AssertNoGCScope { |
4144 #ifndef DEBUG | 4138 #ifndef DEBUG |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6282 | 6276 |
6283 | 6277 |
6284 } // namespace v8 | 6278 } // namespace v8 |
6285 | 6279 |
6286 | 6280 |
6287 #undef V8EXPORT | 6281 #undef V8EXPORT |
6288 #undef TYPE_CHECK | 6282 #undef TYPE_CHECK |
6289 | 6283 |
6290 | 6284 |
6291 #endif // V8_H_ | 6285 #endif // V8_H_ |
OLD | NEW |