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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 // --- Handles --- | 222 // --- Handles --- |
223 | 223 |
224 #define TYPE_CHECK(T, S) \ | 224 #define TYPE_CHECK(T, S) \ |
225 while (false) { \ | 225 while (false) { \ |
226 *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ | 226 *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ |
227 } | 227 } |
228 | 228 |
229 | 229 |
230 #define V8_USE_UNSAFE_HANDLES | 230 #define V8_USE_UNSAFE_HANDLES |
| 231 #define V8_USE_OLD_STYLE_PERSISTENT_HANDLE_VISITORS |
231 | 232 |
232 /** | 233 /** |
233 * An object reference managed by the v8 garbage collector. | 234 * An object reference managed by the v8 garbage collector. |
234 * | 235 * |
235 * All objects returned from v8 have to be tracked by the garbage | 236 * All objects returned from v8 have to be tracked by the garbage |
236 * collector so that it knows that the objects are still alive. Also, | 237 * collector so that it knows that the objects are still alive. Also, |
237 * because the garbage collector may move objects, it is unsafe to | 238 * because the garbage collector may move objects, it is unsafe to |
238 * point directly to an object. Instead, all objects are stored in | 239 * point directly to an object. Instead, all objects are stored in |
239 * handles which are known by the garbage collector and updated | 240 * handles which are known by the garbage collector and updated |
240 * whenever an object moves. Handles should always be passed by value | 241 * whenever an object moves. Handles should always be passed by value |
(...skipping 3859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 virtual void VisitExternalString(Handle<String> string) {} | 4101 virtual void VisitExternalString(Handle<String> string) {} |
4101 }; | 4102 }; |
4102 | 4103 |
4103 | 4104 |
4104 /** | 4105 /** |
4105 * Interface for iterating through all the persistent handles in the heap. | 4106 * Interface for iterating through all the persistent handles in the heap. |
4106 */ | 4107 */ |
4107 class V8EXPORT PersistentHandleVisitor { // NOLINT | 4108 class V8EXPORT PersistentHandleVisitor { // NOLINT |
4108 public: | 4109 public: |
4109 virtual ~PersistentHandleVisitor() {} | 4110 virtual ~PersistentHandleVisitor() {} |
| 4111 #ifdef V8_USE_OLD_STYLE_PERSISTENT_HANDLE_VISITORS |
4110 virtual void VisitPersistentHandle(Persistent<Value> value, | 4112 virtual void VisitPersistentHandle(Persistent<Value> value, |
4111 uint16_t class_id) {} | 4113 uint16_t class_id) {} |
| 4114 #else |
| 4115 virtual void VisitPersistentHandle(Persistent<Value>* value, |
| 4116 uint16_t class_id) {} |
| 4117 #endif |
4112 }; | 4118 }; |
4113 | 4119 |
4114 | 4120 |
4115 /** | 4121 /** |
4116 * Asserts that no action is performed that could cause a handle's value | 4122 * Asserts that no action is performed that could cause a handle's value |
4117 * to be modified. Useful when otherwise unsafe handle operations need to | 4123 * to be modified. Useful when otherwise unsafe handle operations need to |
4118 * be performed. | 4124 * be performed. |
4119 */ | 4125 */ |
4120 class V8EXPORT AssertNoGCScope { | 4126 class V8EXPORT AssertNoGCScope { |
4121 #ifndef DEBUG | 4127 #ifndef DEBUG |
(...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6343 | 6349 |
6344 | 6350 |
6345 } // namespace v8 | 6351 } // namespace v8 |
6346 | 6352 |
6347 | 6353 |
6348 #undef V8EXPORT | 6354 #undef V8EXPORT |
6349 #undef TYPE_CHECK | 6355 #undef TYPE_CHECK |
6350 | 6356 |
6351 | 6357 |
6352 #endif // V8_H_ | 6358 #endif // V8_H_ |
OLD | NEW |