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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 template <class T> class Persistent; | 135 template <class T> class Persistent; |
136 | 136 |
137 namespace internal { | 137 namespace internal { |
138 class Arguments; | 138 class Arguments; |
139 class Heap; | 139 class Heap; |
140 class HeapObject; | 140 class HeapObject; |
141 class Isolate; | 141 class Isolate; |
142 class Object; | 142 class Object; |
143 } | 143 } |
144 | 144 |
145 // Generic-purpose unique identifier. | |
146 class UniqueId { | |
147 public: | |
148 UniqueId() | |
Sven Panne
2013/04/10 10:58:52
Do we need this? I can't imagine a use case, Uniqu
marja
2013/04/10 13:14:51
Removed.
| |
149 : data_(0) {} | |
150 | |
151 explicit UniqueId(intptr_t data) | |
152 : data_(data) {} | |
153 | |
154 bool operator==(const UniqueId& other) const { | |
155 return data_ == other.data_; | |
156 } | |
157 | |
158 bool operator!=(const UniqueId& other) const { | |
159 return data_ == other.data_; | |
160 } | |
161 | |
162 bool operator<(const UniqueId& other) const { | |
163 return data_ < other.data_; | |
164 } | |
165 | |
166 private: | |
167 intptr_t data_; | |
168 }; | |
169 | |
145 | 170 |
146 // --- Weak Handles --- | 171 // --- Weak Handles --- |
147 | 172 |
148 | 173 |
149 /** | 174 /** |
150 * A weak reference callback function. | 175 * A weak reference callback function. |
151 * | 176 * |
152 * This callback should either explicitly invoke Dispose on |object| if | 177 * This callback should either explicitly invoke Dispose on |object| if |
153 * V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWeak. | 178 * V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWeak. |
154 * | 179 * |
(...skipping 3278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3433 * object in the group is alive, all objects in the group are alive. | 3458 * object in the group is alive, all objects in the group are alive. |
3434 * After each garbage collection, object groups are removed. It is | 3459 * After each garbage collection, object groups are removed. It is |
3435 * intended to be used in the before-garbage-collection callback | 3460 * intended to be used in the before-garbage-collection callback |
3436 * function, for instance to simulate DOM tree connections among JS | 3461 * function, for instance to simulate DOM tree connections among JS |
3437 * wrapper objects. Object groups for all dependent handles need to | 3462 * wrapper objects. Object groups for all dependent handles need to |
3438 * be provided for kGCTypeMarkSweepCompact collections, for all other | 3463 * be provided for kGCTypeMarkSweepCompact collections, for all other |
3439 * garbage collection types it is sufficient to provide object groups | 3464 * garbage collection types it is sufficient to provide object groups |
3440 * for partially dependent handles only. | 3465 * for partially dependent handles only. |
3441 * See v8-profiler.h for RetainedObjectInfo interface description. | 3466 * See v8-profiler.h for RetainedObjectInfo interface description. |
3442 */ | 3467 */ |
3468 // TODO(marja): deprecate AddObjectGroup. Use SetObjectGroupID and | |
3469 // SetRetainedObjectInfo instead. | |
3443 static void AddObjectGroup(Persistent<Value>* objects, | 3470 static void AddObjectGroup(Persistent<Value>* objects, |
3444 size_t length, | 3471 size_t length, |
3445 RetainedObjectInfo* info = NULL); | 3472 RetainedObjectInfo* info = NULL); |
3446 static void AddObjectGroup(Isolate* isolate, | 3473 static void AddObjectGroup(Isolate* isolate, |
3447 Persistent<Value>* objects, | 3474 Persistent<Value>* objects, |
3448 size_t length, | 3475 size_t length, |
3449 RetainedObjectInfo* info = NULL); | 3476 RetainedObjectInfo* info = NULL); |
3450 | 3477 |
3478 static void SetObjectGroupId(Isolate* isolate, | |
3479 const Persistent<Value>& object, | |
3480 UniqueId id); | |
3481 | |
3482 static void SetRetainedObjectInfo(Isolate* isolate, | |
3483 UniqueId id, | |
3484 RetainedObjectInfo* info); | |
3485 | |
3451 /** | 3486 /** |
3452 * Allows the host application to declare implicit references between | 3487 * Allows the host application to declare implicit references between |
3453 * the objects: if |parent| is alive, all |children| are alive too. | 3488 * the objects: if |parent| is alive, all |children| are alive too. |
3454 * After each garbage collection, all implicit references | 3489 * After each garbage collection, all implicit references |
3455 * are removed. It is intended to be used in the before-garbage-collection | 3490 * are removed. It is intended to be used in the before-garbage-collection |
3456 * callback function. | 3491 * callback function. |
3457 */ | 3492 */ |
3458 static void AddImplicitReferences(Persistent<Object> parent, | 3493 static void AddImplicitReferences(Persistent<Object> parent, |
3459 Persistent<Value>* children, | 3494 Persistent<Value>* children, |
3460 size_t length); | 3495 size_t length); |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5039 | 5074 |
5040 | 5075 |
5041 } // namespace v8 | 5076 } // namespace v8 |
5042 | 5077 |
5043 | 5078 |
5044 #undef V8EXPORT | 5079 #undef V8EXPORT |
5045 #undef TYPE_CHECK | 5080 #undef TYPE_CHECK |
5046 | 5081 |
5047 | 5082 |
5048 #endif // V8_H_ | 5083 #endif // V8_H_ |
OLD | NEW |