OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_HANDLES_H_ | 28 #ifndef V8_HANDLES_H_ |
29 #define V8_HANDLES_H_ | 29 #define V8_HANDLES_H_ |
30 | 30 |
31 #include "allocation.h" | 31 #include "allocation.h" |
32 #include "apiutils.h" | 32 #include "apiutils.h" |
| 33 #include "objects.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 // ---------------------------------------------------------------------------- | 38 // ---------------------------------------------------------------------------- |
38 // A Handle provides a reference to an object that survives relocation by | 39 // A Handle provides a reference to an object that survives relocation by |
39 // the garbage collector. | 40 // the garbage collector. |
40 // Handles are only valid within a HandleScope. | 41 // Handles are only valid within a HandleScope. |
41 // When a handle is created for an object a cell is allocated in the heap. | 42 // When a handle is created for an object a cell is allocated in the heap. |
42 | 43 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 }; | 99 }; |
99 | 100 |
100 | 101 |
101 // Convenience wrapper. | 102 // Convenience wrapper. |
102 template<class T> | 103 template<class T> |
103 inline Handle<T> handle(T* t, Isolate* isolate) { | 104 inline Handle<T> handle(T* t, Isolate* isolate) { |
104 return Handle<T>(t, isolate); | 105 return Handle<T>(t, isolate); |
105 } | 106 } |
106 | 107 |
107 | 108 |
| 109 // Convenience wrapper. |
| 110 template<class T> |
| 111 inline Handle<T> handle(T* t) { |
| 112 return Handle<T>(t, t->GetIsolate()); |
| 113 } |
| 114 |
| 115 |
108 class DeferredHandles; | 116 class DeferredHandles; |
109 class HandleScopeImplementer; | 117 class HandleScopeImplementer; |
110 | 118 |
111 | 119 |
112 // A stack-allocated class that governs a number of local handles. | 120 // A stack-allocated class that governs a number of local handles. |
113 // After a handle scope has been created, all local handles will be | 121 // After a handle scope has been created, all local handles will be |
114 // allocated within that handle scope until either the handle scope is | 122 // allocated within that handle scope until either the handle scope is |
115 // deleted or another handle scope is created. If there is already a | 123 // deleted or another handle scope is created. If there is already a |
116 // handle scope and a new one is created, all allocations will take | 124 // handle scope and a new one is created, all allocations will take |
117 // place in the new handle scope until it is deleted. After that, | 125 // place in the new handle scope until it is deleted. After that, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, Handle<Object> key); | 245 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, Handle<Object> key); |
238 | 246 |
239 Handle<Object> HasProperty(Handle<JSReceiver> obj, Handle<Object> key); | 247 Handle<Object> HasProperty(Handle<JSReceiver> obj, Handle<Object> key); |
240 | 248 |
241 Handle<Object> GetProperty(Handle<JSReceiver> obj, const char* name); | 249 Handle<Object> GetProperty(Handle<JSReceiver> obj, const char* name); |
242 | 250 |
243 Handle<Object> GetProperty(Isolate* isolate, | 251 Handle<Object> GetProperty(Isolate* isolate, |
244 Handle<Object> obj, | 252 Handle<Object> obj, |
245 Handle<Object> key); | 253 Handle<Object> key); |
246 | 254 |
247 Handle<Object> SetPrototype(Handle<JSObject> obj, Handle<Object> value); | |
248 | |
249 Handle<Object> LookupSingleCharacterStringFromCode(Isolate* isolate, | 255 Handle<Object> LookupSingleCharacterStringFromCode(Isolate* isolate, |
250 uint32_t index); | 256 uint32_t index); |
251 | 257 |
252 Handle<JSObject> Copy(Handle<JSObject> obj); | 258 Handle<JSObject> Copy(Handle<JSObject> obj); |
253 | 259 |
254 Handle<JSObject> DeepCopy(Handle<JSObject> obj); | 260 Handle<JSObject> DeepCopy(Handle<JSObject> obj); |
255 | 261 |
256 Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info); | 262 Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info); |
257 | 263 |
258 Handle<FixedArray> AddKeysFromJSArray(Handle<FixedArray>, | 264 Handle<FixedArray> AddKeysFromJSArray(Handle<FixedArray>, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 private: | 352 private: |
347 Isolate* isolate_; | 353 Isolate* isolate_; |
348 Object** limit_; | 354 Object** limit_; |
349 int level_; | 355 int level_; |
350 #endif | 356 #endif |
351 }; | 357 }; |
352 | 358 |
353 } } // namespace v8::internal | 359 } } // namespace v8::internal |
354 | 360 |
355 #endif // V8_HANDLES_H_ | 361 #endif // V8_HANDLES_H_ |
OLD | NEW |