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 3852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3863 | 3863 |
3864 enum GCCallbackFlags { | 3864 enum GCCallbackFlags { |
3865 kNoGCCallbackFlags = 0, | 3865 kNoGCCallbackFlags = 0, |
3866 kGCCallbackFlagCompacted = 1 << 0, | 3866 kGCCallbackFlagCompacted = 1 << 0, |
3867 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1 | 3867 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1 |
3868 }; | 3868 }; |
3869 | 3869 |
3870 typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags); | 3870 typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags); |
3871 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); | 3871 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); |
3872 | 3872 |
3873 typedef void (*GCCallback)(); | |
3874 | |
3875 | 3873 |
3876 /** | 3874 /** |
3877 * Collection of V8 heap information. | 3875 * Collection of V8 heap information. |
3878 * | 3876 * |
3879 * Instances of this class can be passed to v8::V8::HeapStatistics to | 3877 * Instances of this class can be passed to v8::V8::HeapStatistics to |
3880 * get heap statistics from V8. | 3878 * get heap statistics from V8. |
3881 */ | 3879 */ |
3882 class V8_EXPORT HeapStatistics { | 3880 class V8_EXPORT HeapStatistics { |
3883 public: | 3881 public: |
3884 HeapStatistics(); | 3882 HeapStatistics(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4048 | 4046 |
4049 /** | 4047 /** |
4050 * Allows the host application to declare implicit references from an object | 4048 * Allows the host application to declare implicit references from an object |
4051 * to another object. If the parent object is alive, the child object is alive | 4049 * to another object. If the parent object is alive, the child object is alive |
4052 * too. After each garbage collection, all implicit references are removed. It | 4050 * too. After each garbage collection, all implicit references are removed. It |
4053 * is intended to be used in the before-garbage-collection callback function. | 4051 * is intended to be used in the before-garbage-collection callback function. |
4054 */ | 4052 */ |
4055 void SetReference(const Persistent<Object>& parent, | 4053 void SetReference(const Persistent<Object>& parent, |
4056 const Persistent<Value>& child); | 4054 const Persistent<Value>& child); |
4057 | 4055 |
| 4056 typedef void (*GCPrologueCallback)(Isolate* isolate, |
| 4057 GCType type, |
| 4058 GCCallbackFlags flags); |
| 4059 typedef void (*GCEpilogueCallback)(Isolate* isolate, |
| 4060 GCType type, |
| 4061 GCCallbackFlags flags); |
| 4062 |
| 4063 /** |
| 4064 * Enables the host application to receive a notification before a |
| 4065 * garbage collection. Allocations are not allowed in the |
| 4066 * callback function, you therefore cannot manipulate objects (set |
| 4067 * or delete properties for example) since it is possible such |
| 4068 * operations will result in the allocation of objects. It is possible |
| 4069 * to specify the GCType filter for your callback. But it is not possible to |
| 4070 * register the same callback function two times with different |
| 4071 * GCType filters. |
| 4072 */ |
| 4073 void AddGCPrologueCallback( |
| 4074 GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); |
| 4075 |
| 4076 /** |
| 4077 * This function removes callback which was installed by |
| 4078 * AddGCPrologueCallback function. |
| 4079 */ |
| 4080 void RemoveGCPrologueCallback(GCPrologueCallback callback); |
| 4081 |
| 4082 /** |
| 4083 * Enables the host application to receive a notification after a |
| 4084 * garbage collection. Allocations are not allowed in the |
| 4085 * callback function, you therefore cannot manipulate objects (set |
| 4086 * or delete properties for example) since it is possible such |
| 4087 * operations will result in the allocation of objects. It is possible |
| 4088 * to specify the GCType filter for your callback. But it is not possible to |
| 4089 * register the same callback function two times with different |
| 4090 * GCType filters. |
| 4091 */ |
| 4092 void AddGCEpilogueCallback( |
| 4093 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); |
| 4094 |
| 4095 /** |
| 4096 * This function removes callback which was installed by |
| 4097 * AddGCEpilogueCallback function. |
| 4098 */ |
| 4099 void RemoveGCEpilogueCallback(GCEpilogueCallback callback); |
| 4100 |
4058 private: | 4101 private: |
4059 Isolate(); | 4102 Isolate(); |
4060 Isolate(const Isolate&); | 4103 Isolate(const Isolate&); |
4061 ~Isolate(); | 4104 ~Isolate(); |
4062 Isolate& operator=(const Isolate&); | 4105 Isolate& operator=(const Isolate&); |
4063 void* operator new(size_t size); | 4106 void* operator new(size_t size); |
4064 void operator delete(void*, size_t); | 4107 void operator delete(void*, size_t); |
4065 }; | 4108 }; |
4066 | 4109 |
4067 | 4110 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4405 static void AddGCPrologueCallback( | 4448 static void AddGCPrologueCallback( |
4406 GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); | 4449 GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); |
4407 | 4450 |
4408 /** | 4451 /** |
4409 * This function removes callback which was installed by | 4452 * This function removes callback which was installed by |
4410 * AddGCPrologueCallback function. | 4453 * AddGCPrologueCallback function. |
4411 */ | 4454 */ |
4412 static void RemoveGCPrologueCallback(GCPrologueCallback callback); | 4455 static void RemoveGCPrologueCallback(GCPrologueCallback callback); |
4413 | 4456 |
4414 /** | 4457 /** |
4415 * The function is deprecated. Please use AddGCPrologueCallback instead. | |
4416 * Enables the host application to receive a notification before a | |
4417 * garbage collection. Allocations are not allowed in the | |
4418 * callback function, you therefore cannot manipulate objects (set | |
4419 * or delete properties for example) since it is possible such | |
4420 * operations will result in the allocation of objects. | |
4421 */ | |
4422 V8_DEPRECATED(static void SetGlobalGCPrologueCallback(GCCallback)); | |
4423 | |
4424 /** | |
4425 * Enables the host application to receive a notification after a | 4458 * Enables the host application to receive a notification after a |
4426 * garbage collection. Allocations are not allowed in the | 4459 * garbage collection. Allocations are not allowed in the |
4427 * callback function, you therefore cannot manipulate objects (set | 4460 * callback function, you therefore cannot manipulate objects (set |
4428 * or delete properties for example) since it is possible such | 4461 * or delete properties for example) since it is possible such |
4429 * operations will result in the allocation of objects. It is possible | 4462 * operations will result in the allocation of objects. It is possible |
4430 * to specify the GCType filter for your callback. But it is not possible to | 4463 * to specify the GCType filter for your callback. But it is not possible to |
4431 * register the same callback function two times with different | 4464 * register the same callback function two times with different |
4432 * GCType filters. | 4465 * GCType filters. |
4433 */ | 4466 */ |
4434 static void AddGCEpilogueCallback( | 4467 static void AddGCEpilogueCallback( |
4435 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); | 4468 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); |
4436 | 4469 |
4437 /** | 4470 /** |
4438 * This function removes callback which was installed by | 4471 * This function removes callback which was installed by |
4439 * AddGCEpilogueCallback function. | 4472 * AddGCEpilogueCallback function. |
4440 */ | 4473 */ |
4441 static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); | 4474 static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); |
4442 | 4475 |
4443 /** | 4476 /** |
4444 * The function is deprecated. Please use AddGCEpilogueCallback instead. | |
4445 * Enables the host application to receive a notification after a | |
4446 * major garbage collection. Allocations are not allowed in the | |
4447 * callback function, you therefore cannot manipulate objects (set | |
4448 * or delete properties for example) since it is possible such | |
4449 * operations will result in the allocation of objects. | |
4450 */ | |
4451 V8_DEPRECATED(static void SetGlobalGCEpilogueCallback(GCCallback)); | |
4452 | |
4453 /** | |
4454 * Enables the host application to provide a mechanism to be notified | 4477 * Enables the host application to provide a mechanism to be notified |
4455 * and perform custom logging when V8 Allocates Executable Memory. | 4478 * and perform custom logging when V8 Allocates Executable Memory. |
4456 */ | 4479 */ |
4457 static void AddMemoryAllocationCallback(MemoryAllocationCallback callback, | 4480 static void AddMemoryAllocationCallback(MemoryAllocationCallback callback, |
4458 ObjectSpace space, | 4481 ObjectSpace space, |
4459 AllocationAction action); | 4482 AllocationAction action); |
4460 | 4483 |
4461 /** | 4484 /** |
4462 * Removes callback that was installed by AddMemoryAllocationCallback. | 4485 * Removes callback that was installed by AddMemoryAllocationCallback. |
4463 */ | 4486 */ |
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6431 */ | 6454 */ |
6432 | 6455 |
6433 | 6456 |
6434 } // namespace v8 | 6457 } // namespace v8 |
6435 | 6458 |
6436 | 6459 |
6437 #undef TYPE_CHECK | 6460 #undef TYPE_CHECK |
6438 | 6461 |
6439 | 6462 |
6440 #endif // V8_H_ | 6463 #endif // V8_H_ |
OLD | NEW |