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

Side by Side Diff: src/global-handles.h

Issue 863443005: Support old and new weak handle API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Undo cast that was not needed. Created 5 years, 11 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 | « src/api.cc ('k') | src/global-handles.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_GLOBAL_HANDLES_H_ 5 #ifndef V8_GLOBAL_HANDLES_H_
6 #define V8_GLOBAL_HANDLES_H_ 6 #define V8_GLOBAL_HANDLES_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "include/v8-profiler.h" 9 #include "include/v8-profiler.h"
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // default the handle still contains a pointer to the object that is being 138 // default the handle still contains a pointer to the object that is being
139 // collected. For this reason the object is not collected until the next 139 // collected. For this reason the object is not collected until the next
140 // GC. For a phantom weak handle the handle is cleared (set to a Smi) 140 // GC. For a phantom weak handle the handle is cleared (set to a Smi)
141 // before the callback is invoked, but the handle can still be identified 141 // before the callback is invoked, but the handle can still be identified
142 // in the callback by using the location() of the handle. 142 // in the callback by using the location() of the handle.
143 static void MakeWeak(Object** location, void* parameter, 143 static void MakeWeak(Object** location, void* parameter,
144 WeakCallback weak_callback); 144 WeakCallback weak_callback);
145 145
146 // It would be nice to template this one, but it's really hard to get 146 // It would be nice to template this one, but it's really hard to get
147 // the template instantiator to work right if you do. 147 // the template instantiator to work right if you do.
148 static void MakePhantom( 148 static void MakePhantom(Object** location, void* parameter,
149 Object** location, void* parameter, int number_of_internal_fields, 149 int number_of_internal_fields,
150 PhantomCallbackData<void, void, void>::Callback weak_callback); 150 PhantomCallbackData<void>::Callback weak_callback);
151 151
152 void RecordStats(HeapStats* stats); 152 void RecordStats(HeapStats* stats);
153 153
154 // Returns the current number of weak handles. 154 // Returns the current number of weak handles.
155 int NumberOfWeakHandles(); 155 int NumberOfWeakHandles();
156 156
157 // Returns the current number of weak handles to global objects. 157 // Returns the current number of weak handles to global objects.
158 // These handles are also included in NumberOfWeakHandles(). 158 // These handles are also included in NumberOfWeakHandles().
159 int NumberOfGlobalObjectWeakHandles(); 159 int NumberOfGlobalObjectWeakHandles();
160 160
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 List<PendingPhantomCallback> pending_phantom_callbacks_; 338 List<PendingPhantomCallback> pending_phantom_callbacks_;
339 339
340 friend class Isolate; 340 friend class Isolate;
341 341
342 DISALLOW_COPY_AND_ASSIGN(GlobalHandles); 342 DISALLOW_COPY_AND_ASSIGN(GlobalHandles);
343 }; 343 };
344 344
345 345
346 class GlobalHandles::PendingPhantomCallback { 346 class GlobalHandles::PendingPhantomCallback {
347 public: 347 public:
348 typedef PhantomCallbackData<void, void, void> Data; 348 typedef PhantomCallbackData<void> Data;
349 PendingPhantomCallback(Node* node, Data data, Data::Callback callback) 349 PendingPhantomCallback(Node* node, Data data, Data::Callback callback)
350 : node_(node), data_(data), callback_(callback) {} 350 : node_(node), data_(data), callback_(callback) {}
351 351
352 void invoke(); 352 void invoke();
353 353
354 Node* node() { return node_; } 354 Node* node() { return node_; }
355 355
356 private: 356 private:
357 Node* node_; 357 Node* node_;
358 Data data_; 358 Data data_;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 List<int> new_space_indices_; 426 List<int> new_space_indices_;
427 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]; 427 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES];
428 428
429 DISALLOW_COPY_AND_ASSIGN(EternalHandles); 429 DISALLOW_COPY_AND_ASSIGN(EternalHandles);
430 }; 430 };
431 431
432 432
433 } } // namespace v8::internal 433 } } // namespace v8::internal
434 434
435 #endif // V8_GLOBAL_HANDLES_H_ 435 #endif // V8_GLOBAL_HANDLES_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/global-handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698