Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: include/v8.h

Issue 24065005: new gc callbacks with isolate parameters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/heap.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after
3860 kGCTypeMarkSweepCompact = 1 << 1, 3860 kGCTypeMarkSweepCompact = 1 << 1,
3861 kGCTypeAll = kGCTypeScavenge | kGCTypeMarkSweepCompact 3861 kGCTypeAll = kGCTypeScavenge | kGCTypeMarkSweepCompact
3862 }; 3862 };
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);
Sven Panne 2013/09/17 11:25:19 Does this even compile with the new definitions be
dcarney 2013/09/17 11:30:39 Sure. They are in the v8::Isolate:: namespace. I
3871 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); 3871 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags);
3872 3872
3873 typedef void (*GCCallback)(); 3873 typedef void (*GCCallback)();
Sven Panne 2013/09/17 11:25:19 We can remove this, I think...
dcarney 2013/09/17 11:30:39 on it.
3874 3874
3875 3875
3876 /** 3876 /**
3877 * Collection of V8 heap information. 3877 * Collection of V8 heap information.
3878 * 3878 *
3879 * Instances of this class can be passed to v8::V8::HeapStatistics to 3879 * Instances of this class can be passed to v8::V8::HeapStatistics to
3880 * get heap statistics from V8. 3880 * get heap statistics from V8.
3881 */ 3881 */
3882 class V8_EXPORT HeapStatistics { 3882 class V8_EXPORT HeapStatistics {
3883 public: 3883 public:
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4048 4048
4049 /** 4049 /**
4050 * Allows the host application to declare implicit references from an object 4050 * 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 4051 * 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 4052 * too. After each garbage collection, all implicit references are removed. It
4053 * is intended to be used in the before-garbage-collection callback function. 4053 * is intended to be used in the before-garbage-collection callback function.
4054 */ 4054 */
4055 void SetReference(const Persistent<Object>& parent, 4055 void SetReference(const Persistent<Object>& parent,
4056 const Persistent<Value>& child); 4056 const Persistent<Value>& child);
4057 4057
4058 typedef void (*GCPrologueCallback)(Isolate* isolate,
4059 GCType type,
4060 GCCallbackFlags flags);
4061 typedef void (*GCEpilogueCallback)(Isolate* isolate,
4062 GCType type,
4063 GCCallbackFlags flags);
4064
4065 /**
4066 * Enables the host application to receive a notification before a
4067 * garbage collection. Allocations are not allowed in the
4068 * callback function, you therefore cannot manipulate objects (set
4069 * or delete properties for example) since it is possible such
4070 * operations will result in the allocation of objects. It is possible
4071 * to specify the GCType filter for your callback. But it is not possible to
4072 * register the same callback function two times with different
4073 * GCType filters.
4074 */
4075 void AddGCPrologueCallback(
4076 GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll);
4077
4078 /**
4079 * This function removes callback which was installed by
4080 * AddGCPrologueCallback function.
4081 */
4082 void RemoveGCPrologueCallback(GCPrologueCallback callback);
4083
4084 /**
4085 * Enables the host application to receive a notification after a
4086 * garbage collection. Allocations are not allowed in the
4087 * callback function, you therefore cannot manipulate objects (set
4088 * or delete properties for example) since it is possible such
4089 * operations will result in the allocation of objects. It is possible
4090 * to specify the GCType filter for your callback. But it is not possible to
4091 * register the same callback function two times with different
4092 * GCType filters.
4093 */
4094 void AddGCEpilogueCallback(
4095 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll);
4096
4097 /**
4098 * This function removes callback which was installed by
4099 * AddGCEpilogueCallback function.
4100 */
4101 void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
4102
4058 private: 4103 private:
4059 Isolate(); 4104 Isolate();
4060 Isolate(const Isolate&); 4105 Isolate(const Isolate&);
4061 ~Isolate(); 4106 ~Isolate();
4062 Isolate& operator=(const Isolate&); 4107 Isolate& operator=(const Isolate&);
4063 void* operator new(size_t size); 4108 void* operator new(size_t size);
4064 void operator delete(void*, size_t); 4109 void operator delete(void*, size_t);
4065 }; 4110 };
4066 4111
4067 4112
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
4405 static void AddGCPrologueCallback( 4450 static void AddGCPrologueCallback(
4406 GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); 4451 GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll);
4407 4452
4408 /** 4453 /**
4409 * This function removes callback which was installed by 4454 * This function removes callback which was installed by
4410 * AddGCPrologueCallback function. 4455 * AddGCPrologueCallback function.
4411 */ 4456 */
4412 static void RemoveGCPrologueCallback(GCPrologueCallback callback); 4457 static void RemoveGCPrologueCallback(GCPrologueCallback callback);
4413 4458
4414 /** 4459 /**
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 4460 * Enables the host application to receive a notification after a
4426 * garbage collection. Allocations are not allowed in the 4461 * garbage collection. Allocations are not allowed in the
4427 * callback function, you therefore cannot manipulate objects (set 4462 * callback function, you therefore cannot manipulate objects (set
4428 * or delete properties for example) since it is possible such 4463 * or delete properties for example) since it is possible such
4429 * operations will result in the allocation of objects. It is possible 4464 * 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 4465 * to specify the GCType filter for your callback. But it is not possible to
4431 * register the same callback function two times with different 4466 * register the same callback function two times with different
4432 * GCType filters. 4467 * GCType filters.
4433 */ 4468 */
4434 static void AddGCEpilogueCallback( 4469 static void AddGCEpilogueCallback(
4435 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); 4470 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll);
4436 4471
4437 /** 4472 /**
4438 * This function removes callback which was installed by 4473 * This function removes callback which was installed by
4439 * AddGCEpilogueCallback function. 4474 * AddGCEpilogueCallback function.
4440 */ 4475 */
4441 static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); 4476 static void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
4442 4477
4443 /** 4478 /**
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 4479 * Enables the host application to provide a mechanism to be notified
4455 * and perform custom logging when V8 Allocates Executable Memory. 4480 * and perform custom logging when V8 Allocates Executable Memory.
4456 */ 4481 */
4457 static void AddMemoryAllocationCallback(MemoryAllocationCallback callback, 4482 static void AddMemoryAllocationCallback(MemoryAllocationCallback callback,
4458 ObjectSpace space, 4483 ObjectSpace space,
4459 AllocationAction action); 4484 AllocationAction action);
4460 4485
4461 /** 4486 /**
4462 * Removes callback that was installed by AddMemoryAllocationCallback. 4487 * Removes callback that was installed by AddMemoryAllocationCallback.
4463 */ 4488 */
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
6431 */ 6456 */
6432 6457
6433 6458
6434 } // namespace v8 6459 } // namespace v8
6435 6460
6436 6461
6437 #undef TYPE_CHECK 6462 #undef TYPE_CHECK
6438 6463
6439 6464
6440 #endif // V8_H_ 6465 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698