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

Side by Side Diff: include/v8.h

Issue 13786002: [WIP] New GC related APIs. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: use old testing machinery Created 7 years, 8 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
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 explicit UniqueId(intptr_t data)
149 : data_(data) {}
150
151 bool operator==(const UniqueId& other) const {
152 return data_ == other.data_;
153 }
154
155 bool operator!=(const UniqueId& other) const {
156 return data_ != other.data_;
157 }
158
159 bool operator<(const UniqueId& other) const {
160 return data_ < other.data_;
161 }
162
163 private:
164 intptr_t data_;
165 };
166
145 167
146 // --- Weak Handles --- 168 // --- Weak Handles ---
147 169
148 170
149 /** 171 /**
150 * A weak reference callback function. 172 * A weak reference callback function.
151 * 173 *
152 * This callback should either explicitly invoke Dispose on |object| if 174 * This callback should either explicitly invoke Dispose on |object| if
153 * V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWeak. 175 * V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWeak.
154 * 176 *
(...skipping 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after
3436 * 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.
3437 * After each garbage collection, object groups are removed. It is 3459 * After each garbage collection, object groups are removed. It is
3438 * intended to be used in the before-garbage-collection callback 3460 * intended to be used in the before-garbage-collection callback
3439 * function, for instance to simulate DOM tree connections among JS 3461 * function, for instance to simulate DOM tree connections among JS
3440 * wrapper objects. Object groups for all dependent handles need to 3462 * wrapper objects. Object groups for all dependent handles need to
3441 * be provided for kGCTypeMarkSweepCompact collections, for all other 3463 * be provided for kGCTypeMarkSweepCompact collections, for all other
3442 * garbage collection types it is sufficient to provide object groups 3464 * garbage collection types it is sufficient to provide object groups
3443 * for partially dependent handles only. 3465 * for partially dependent handles only.
3444 * See v8-profiler.h for RetainedObjectInfo interface description. 3466 * See v8-profiler.h for RetainedObjectInfo interface description.
3445 */ 3467 */
3468 // TODO(marja): deprecate AddObjectGroup. Use SetObjectGroupID and
3469 // SetRetainedObjectInfo instead.
3446 static void AddObjectGroup(Persistent<Value>* objects, 3470 static void AddObjectGroup(Persistent<Value>* objects,
3447 size_t length, 3471 size_t length,
3448 RetainedObjectInfo* info = NULL); 3472 RetainedObjectInfo* info = NULL);
3449 static void AddObjectGroup(Isolate* isolate, 3473 static void AddObjectGroup(Isolate* isolate,
3450 Persistent<Value>* objects, 3474 Persistent<Value>* objects,
3451 size_t length, 3475 size_t length,
3452 RetainedObjectInfo* info = NULL); 3476 RetainedObjectInfo* info = NULL);
3453 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
3454 /** 3486 /**
3455 * Allows the host application to declare implicit references between 3487 * Allows the host application to declare implicit references between
3456 * the objects: if |parent| is alive, all |children| are alive too. 3488 * the objects: if |parent| is alive, all |children| are alive too.
3457 * After each garbage collection, all implicit references 3489 * After each garbage collection, all implicit references
3458 * 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
3459 * callback function. 3491 * callback function.
3460 */ 3492 */
3461 static void AddImplicitReferences(Persistent<Object> parent, 3493 static void AddImplicitReferences(Persistent<Object> parent,
3462 Persistent<Value>* children, 3494 Persistent<Value>* children,
3463 size_t length); 3495 size_t length);
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
5050 5082
5051 5083
5052 } // namespace v8 5084 } // namespace v8
5053 5085
5054 5086
5055 #undef V8EXPORT 5087 #undef V8EXPORT
5056 #undef TYPE_CHECK 5088 #undef TYPE_CHECK
5057 5089
5058 5090
5059 #endif // V8_H_ 5091 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698