| OLD | NEW |
| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool operator<(const ObjectGroupRetainerInfo& other) const { | 91 bool operator<(const ObjectGroupRetainerInfo& other) const { |
| 92 return id < other.id; | 92 return id < other.id; |
| 93 } | 93 } |
| 94 | 94 |
| 95 UniqueId id; | 95 UniqueId id; |
| 96 RetainedObjectInfo* info; | 96 RetainedObjectInfo* info; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 | |
| 100 enum WeaknessType { | 99 enum WeaknessType { |
| 101 NORMAL_WEAK, // Embedder gets a handle to the dying object. | 100 NORMAL_WEAK, // Embedder gets a handle to the dying object. |
| 102 // In the following cases, the embedder gets the parameter they passed in | 101 // In the following cases, the embedder gets the parameter they passed in |
| 103 // earlier, and 0 or 2 first internal fields. Note that the internal | 102 // earlier, and 0 or 2 first internal fields. Note that the internal |
| 104 // fields must contain aligned non-V8 pointers. Getting pointers to V8 | 103 // fields must contain aligned non-V8 pointers. Getting pointers to V8 |
| 105 // objects through this interface would be GC unsafe so in that case the | 104 // objects through this interface would be GC unsafe so in that case the |
| 106 // embedder gets a null pointer instead. | 105 // embedder gets a null pointer instead. |
| 107 PHANTOM_WEAK, | 106 PHANTOM_WEAK, |
| 108 PHANTOM_WEAK_2_INTERNAL_FIELDS | 107 PHANTOM_WEAK_2_INTERNAL_FIELDS, |
| 108 // Like NORMAL_WEAK, but uses WeakCallbackInfo instead of WeakCallbackData. |
| 109 FINALIZER_WEAK, |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 | |
| 112 class GlobalHandles { | 112 class GlobalHandles { |
| 113 public: | 113 public: |
| 114 ~GlobalHandles(); | 114 ~GlobalHandles(); |
| 115 | 115 |
| 116 // Creates a new global handle that is alive until Destroy is called. | 116 // Creates a new global handle that is alive until Destroy is called. |
| 117 Handle<Object> Create(Object* value); | 117 Handle<Object> Create(Object* value); |
| 118 | 118 |
| 119 // Copy a global handle | 119 // Copy a global handle |
| 120 static Handle<Object> CopyGlobal(Object** location); | 120 static Handle<Object> CopyGlobal(Object** location); |
| 121 | 121 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]; | 455 int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES]; |
| 456 | 456 |
| 457 DISALLOW_COPY_AND_ASSIGN(EternalHandles); | 457 DISALLOW_COPY_AND_ASSIGN(EternalHandles); |
| 458 }; | 458 }; |
| 459 | 459 |
| 460 | 460 |
| 461 } // namespace internal | 461 } // namespace internal |
| 462 } // namespace v8 | 462 } // namespace v8 |
| 463 | 463 |
| 464 #endif // V8_GLOBAL_HANDLES_H_ | 464 #endif // V8_GLOBAL_HANDLES_H_ |
| OLD | NEW |