| 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 16 matching lines...) Expand all Loading... |
| 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 | 33 |
| 34 namespace v8 { | 34 namespace v8 { |
| 35 namespace internal { | 35 namespace internal { |
| 36 | 36 |
| 37 // Forward declaration |
| 38 class LookupCache; |
| 39 |
| 37 // ---------------------------------------------------------------------------- | 40 // ---------------------------------------------------------------------------- |
| 38 // A Handle provides a reference to an object that survives relocation by | 41 // A Handle provides a reference to an object that survives relocation by |
| 39 // the garbage collector. | 42 // the garbage collector. |
| 40 // Handles are only valid within a HandleScope. | 43 // Handles are only valid within a HandleScope. |
| 41 // When a handle is created for an object a cell is allocated in the heap. | 44 // When a handle is created for an object a cell is allocated in the heap. |
| 42 | 45 |
| 43 template<typename T> | 46 template<typename T> |
| 44 class Handle { | 47 class Handle { |
| 45 public: | 48 public: |
| 46 INLINE(explicit Handle(T** location)) { location_ = location; } | 49 INLINE(explicit Handle(T** location)) { location_ = location; } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 216 |
| 214 // Flattens a string and returns the underlying external or sequential | 217 // Flattens a string and returns the underlying external or sequential |
| 215 // string. | 218 // string. |
| 216 Handle<String> FlattenGetString(Handle<String> str); | 219 Handle<String> FlattenGetString(Handle<String> str); |
| 217 | 220 |
| 218 Handle<Object> SetProperty(Isolate* isolate, | 221 Handle<Object> SetProperty(Isolate* isolate, |
| 219 Handle<Object> object, | 222 Handle<Object> object, |
| 220 Handle<Object> key, | 223 Handle<Object> key, |
| 221 Handle<Object> value, | 224 Handle<Object> value, |
| 222 PropertyAttributes attributes, | 225 PropertyAttributes attributes, |
| 223 StrictModeFlag strict_mode); | 226 StrictModeFlag strict_mode, |
| 227 LookupCache* cache = NULL); |
| 224 | 228 |
| 225 Handle<Object> ForceSetProperty(Handle<JSObject> object, | 229 Handle<Object> ForceSetProperty(Handle<JSObject> object, |
| 226 Handle<Object> key, | 230 Handle<Object> key, |
| 227 Handle<Object> value, | 231 Handle<Object> value, |
| 228 PropertyAttributes attributes); | 232 PropertyAttributes attributes); |
| 229 | 233 |
| 230 Handle<Object> DeleteProperty(Handle<JSObject> object, Handle<Object> key); | 234 Handle<Object> DeleteProperty(Handle<JSObject> object, Handle<Object> key); |
| 231 | 235 |
| 232 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, Handle<Object> key); | 236 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, Handle<Object> key); |
| 233 | 237 |
| 234 Handle<Object> HasProperty(Handle<JSReceiver> obj, Handle<Object> key); | 238 Handle<Object> HasProperty(Handle<JSReceiver> obj, Handle<Object> key); |
| 235 | 239 |
| 236 Handle<Object> GetProperty(Handle<JSReceiver> obj, const char* name); | 240 Handle<Object> GetProperty(Handle<JSReceiver> obj, const char* name); |
| 237 | 241 |
| 238 Handle<Object> GetProperty(Isolate* isolate, | 242 Handle<Object> GetProperty(Isolate* isolate, |
| 239 Handle<Object> obj, | 243 Handle<Object> obj, |
| 240 Handle<Object> key); | 244 Handle<Object> key, |
| 245 LookupCache* cache = NULL); |
| 241 | 246 |
| 242 Handle<Object> SetPrototype(Handle<JSObject> obj, Handle<Object> value); | 247 Handle<Object> SetPrototype(Handle<JSObject> obj, Handle<Object> value); |
| 243 | 248 |
| 244 Handle<Object> LookupSingleCharacterStringFromCode(Isolate* isolate, | 249 Handle<Object> LookupSingleCharacterStringFromCode(Isolate* isolate, |
| 245 uint32_t index); | 250 uint32_t index); |
| 246 | 251 |
| 247 Handle<JSObject> Copy(Handle<JSObject> obj); | 252 Handle<JSObject> Copy(Handle<JSObject> obj); |
| 248 | 253 |
| 249 Handle<JSObject> DeepCopy(Handle<JSObject> obj); | 254 Handle<JSObject> DeepCopy(Handle<JSObject> obj); |
| 250 | 255 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 #define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) \ | 367 #define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) \ |
| 363 HandleDereferenceGuard allow_deref(isolate, \ | 368 HandleDereferenceGuard allow_deref(isolate, \ |
| 364 HandleDereferenceGuard::ALLOW); | 369 HandleDereferenceGuard::ALLOW); |
| 365 #else | 370 #else |
| 366 #define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) | 371 #define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) |
| 367 #endif // DEBUG | 372 #endif // DEBUG |
| 368 | 373 |
| 369 } } // namespace v8::internal | 374 } } // namespace v8::internal |
| 370 | 375 |
| 371 #endif // V8_HANDLES_H_ | 376 #endif // V8_HANDLES_H_ |
| OLD | NEW |