OLD | NEW |
1 // Copyright 2007-2009 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 |
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 typedef void (*AddHistogramSampleCallback)(void* histogram, int sample); | 2151 typedef void (*AddHistogramSampleCallback)(void* histogram, int sample); |
2152 | 2152 |
2153 // --- F a i l e d A c c e s s C h e c k C a l l b a c k --- | 2153 // --- F a i l e d A c c e s s C h e c k C a l l b a c k --- |
2154 typedef void (*FailedAccessCheckCallback)(Local<Object> target, | 2154 typedef void (*FailedAccessCheckCallback)(Local<Object> target, |
2155 AccessType type, | 2155 AccessType type, |
2156 Local<Value> data); | 2156 Local<Value> data); |
2157 | 2157 |
2158 // --- G a r b a g e C o l l e c t i o n C a l l b a c k s | 2158 // --- G a r b a g e C o l l e c t i o n C a l l b a c k s |
2159 | 2159 |
2160 /** | 2160 /** |
2161 * Applications can register a callback function which is called | 2161 * Applications can register callback functions which will be called |
2162 * before and after a major garbage collection. Allocations are not | 2162 * before and after a garbage collection. Allocations are not |
2163 * allowed in the callback function, you therefore cannot manipulate | 2163 * allowed in the callback functions, you therefore cannot manipulate |
2164 * objects (set or delete properties for example) since it is possible | 2164 * objects (set or delete properties for example) since it is possible |
2165 * such operations will result in the allocation of objects. | 2165 * such operations will result in the allocation of objects. |
2166 */ | 2166 */ |
| 2167 enum GCType { |
| 2168 kGCTypeScavenge = 1 << 0, |
| 2169 kGCTypeMarkSweepCompact = 1 << 1, |
| 2170 kGCTypeAll = kGCTypeScavenge | kGCTypeMarkSweepCompact |
| 2171 }; |
| 2172 |
| 2173 enum GCCallbackFlags { |
| 2174 kNoGCCallbackFlags = 0, |
| 2175 kGCCallbackFlagCompacted = 1 << 0 |
| 2176 }; |
| 2177 |
| 2178 typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags); |
| 2179 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); |
| 2180 |
2167 typedef void (*GCCallback)(); | 2181 typedef void (*GCCallback)(); |
2168 | 2182 |
2169 | 2183 |
2170 // --- C o n t e x t G e n e r a t o r --- | 2184 // --- C o n t e x t G e n e r a t o r --- |
2171 | 2185 |
2172 /** | 2186 /** |
2173 * Applications must provide a callback function which is called to generate | 2187 * Applications must provide a callback function which is called to generate |
2174 * a context if a context was not deserialized from the snapshot. | 2188 * a context if a context was not deserialized from the snapshot. |
2175 */ | 2189 */ |
2176 typedef Persistent<Context> (*ContextGenerator)(); | 2190 typedef Persistent<Context> (*ContextGenerator)(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 * Enables the computation of a sliding window of states. The sliding | 2306 * Enables the computation of a sliding window of states. The sliding |
2293 * window information is recorded in statistics counters. | 2307 * window information is recorded in statistics counters. |
2294 */ | 2308 */ |
2295 static void EnableSlidingStateWindow(); | 2309 static void EnableSlidingStateWindow(); |
2296 | 2310 |
2297 /** Callback function for reporting failed access checks.*/ | 2311 /** Callback function for reporting failed access checks.*/ |
2298 static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback); | 2312 static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback); |
2299 | 2313 |
2300 /** | 2314 /** |
2301 * Enables the host application to receive a notification before a | 2315 * Enables the host application to receive a notification before a |
2302 * major garbage colletion. Allocations are not allowed in the | 2316 * garbage collection. Allocations are not allowed in the |
| 2317 * callback function, you therefore cannot manipulate objects (set |
| 2318 * or delete properties for example) since it is possible such |
| 2319 * operations will result in the allocation of objects. It is possible |
| 2320 * to specify the GCType filter for your callback. But it is not possible to |
| 2321 * register the same callback function two times with different |
| 2322 * GCType filters. |
| 2323 */ |
| 2324 static void AddGCPrologueCallback( |
| 2325 GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); |
| 2326 |
| 2327 /** |
| 2328 * This function removes callback which was installed by |
| 2329 * AddGCPrologueCallback function. |
| 2330 */ |
| 2331 static void RemoveGCPrologueCallback(GCPrologueCallback callback); |
| 2332 |
| 2333 /** |
| 2334 * The function is deprecated. Please use AddGCPrologueCallback instead. |
| 2335 * Enables the host application to receive a notification before a |
| 2336 * garbage collection. Allocations are not allowed in the |
2303 * callback function, you therefore cannot manipulate objects (set | 2337 * callback function, you therefore cannot manipulate objects (set |
2304 * or delete properties for example) since it is possible such | 2338 * or delete properties for example) since it is possible such |
2305 * operations will result in the allocation of objects. | 2339 * operations will result in the allocation of objects. |
2306 */ | 2340 */ |
2307 static void SetGlobalGCPrologueCallback(GCCallback); | 2341 static void SetGlobalGCPrologueCallback(GCCallback); |
2308 | 2342 |
2309 /** | 2343 /** |
2310 * Enables the host application to receive a notification after a | 2344 * Enables the host application to receive a notification after a |
| 2345 * garbage collection. Allocations are not allowed in the |
| 2346 * callback function, you therefore cannot manipulate objects (set |
| 2347 * or delete properties for example) since it is possible such |
| 2348 * operations will result in the allocation of objects. It is possible |
| 2349 * to specify the GCType filter for your callback. But it is not possible to |
| 2350 * register the same callback function two times with different |
| 2351 * GCType filters. |
| 2352 */ |
| 2353 static void AddGCEpilogueCallback( |
| 2354 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); |
| 2355 |
| 2356 /** |
| 2357 * This function removes callback which was installed by |
| 2358 * AddGCEpilogueCallback function. |
| 2359 */ |
| 2360 static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); |
| 2361 |
| 2362 /** |
| 2363 * The function is deprecated. Please use AddGCEpilogueCallback instead. |
| 2364 * Enables the host application to receive a notification after a |
2311 * major garbage collection. Allocations are not allowed in the | 2365 * major garbage collection. Allocations are not allowed in the |
2312 * callback function, you therefore cannot manipulate objects (set | 2366 * callback function, you therefore cannot manipulate objects (set |
2313 * or delete properties for example) since it is possible such | 2367 * or delete properties for example) since it is possible such |
2314 * operations will result in the allocation of objects. | 2368 * operations will result in the allocation of objects. |
2315 */ | 2369 */ |
2316 static void SetGlobalGCEpilogueCallback(GCCallback); | 2370 static void SetGlobalGCEpilogueCallback(GCCallback); |
2317 | 2371 |
2318 /** | 2372 /** |
2319 * Allows the host application to group objects together. If one | 2373 * Allows the host application to group objects together. If one |
2320 * object in the group is alive, all objects in the group are alive. | 2374 * object in the group is alive, all objects in the group are alive. |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 | 3377 |
3324 } // namespace v8 | 3378 } // namespace v8 |
3325 | 3379 |
3326 | 3380 |
3327 #undef V8EXPORT | 3381 #undef V8EXPORT |
3328 #undef V8EXPORT_INLINE | 3382 #undef V8EXPORT_INLINE |
3329 #undef TYPE_CHECK | 3383 #undef TYPE_CHECK |
3330 | 3384 |
3331 | 3385 |
3332 #endif // V8_H_ | 3386 #endif // V8_H_ |
OLD | NEW |