| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // Zaps the handles in the half-open interval [start, end). | 156 // Zaps the handles in the half-open interval [start, end). |
| 157 static void ZapRange(internal::Object** start, internal::Object** end); | 157 static void ZapRange(internal::Object** start, internal::Object** end); |
| 158 | 158 |
| 159 friend class v8::HandleScope; | 159 friend class v8::HandleScope; |
| 160 friend class v8::ImplementationUtilities; | 160 friend class v8::ImplementationUtilities; |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 | 163 |
| 164 // ---------------------------------------------------------------------------- | 164 // ---------------------------------------------------------------------------- |
| 165 // Handle operations. | 165 // Handle operations. |
| 166 // They might invoke garbage collection. The result is an handle to an | 166 // They might invoke garbage collection. The result is an handle to |
| 167 // object of expected type, or the handle is a null handle if encountering | 167 // an object of expected type, or the handle is an error if running out |
| 168 // an internal error. Will not return a null handle due to out-of-memory | 168 // of space or encountering an internal error. |
| 169 // unless otherwise stated, but will instead try to do GC and die fatally | |
| 170 // if that doesn't help. | |
| 171 | 169 |
| 172 void NormalizeProperties(Handle<JSObject> object, | 170 void NormalizeProperties(Handle<JSObject> object, |
| 173 PropertyNormalizationMode mode, | 171 PropertyNormalizationMode mode, |
| 174 int expected_additional_properties); | 172 int expected_additional_properties); |
| 175 Handle<NumberDictionary> NormalizeElements(Handle<JSObject> object); | 173 Handle<NumberDictionary> NormalizeElements(Handle<JSObject> object); |
| 176 void TransformToFastProperties(Handle<JSObject> object, | 174 void TransformToFastProperties(Handle<JSObject> object, |
| 177 int unused_property_fields); | 175 int unused_property_fields); |
| 178 MUST_USE_RESULT Handle<NumberDictionary> NumberDictionarySet( | 176 MUST_USE_RESULT Handle<NumberDictionary> NumberDictionarySet( |
| 179 Handle<NumberDictionary> dictionary, | 177 Handle<NumberDictionary> dictionary, |
| 180 uint32_t index, | 178 uint32_t index, |
| 181 Handle<Object> value, | 179 Handle<Object> value, |
| 182 PropertyDetails details); | 180 PropertyDetails details); |
| 183 | 181 |
| 184 // Flattens a string. | 182 // Flattens a string. |
| 185 void FlattenString(Handle<String> str); | 183 void FlattenString(Handle<String> str); |
| 186 | 184 |
| 187 // Flattens a string and returns the underlying external or sequential | 185 // Flattens a string and returns the underlying external or sequential |
| 188 // string. Never returns a null handle. | 186 // string. |
| 189 Handle<String> FlattenGetString(Handle<String> str); | 187 Handle<String> FlattenGetString(Handle<String> str); |
| 190 | 188 |
| 191 Handle<Object> SetProperty(Handle<JSReceiver> object, | 189 Handle<Object> SetProperty(Handle<JSReceiver> object, |
| 192 Handle<String> key, | 190 Handle<String> key, |
| 193 Handle<Object> value, | 191 Handle<Object> value, |
| 194 PropertyAttributes attributes, | 192 PropertyAttributes attributes, |
| 195 StrictModeFlag strict_mode); | 193 StrictModeFlag strict_mode); |
| 196 | 194 |
| 197 Handle<Object> SetProperty(Handle<Object> object, | 195 Handle<Object> SetProperty(Handle<Object> object, |
| 198 Handle<Object> key, | 196 Handle<Object> key, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 NoHandleAllocation() {} | 372 NoHandleAllocation() {} |
| 375 ~NoHandleAllocation() {} | 373 ~NoHandleAllocation() {} |
| 376 #else | 374 #else |
| 377 inline NoHandleAllocation(); | 375 inline NoHandleAllocation(); |
| 378 inline ~NoHandleAllocation(); | 376 inline ~NoHandleAllocation(); |
| 379 private: | 377 private: |
| 380 int level_; | 378 int level_; |
| 381 #endif | 379 #endif |
| 382 }; | 380 }; |
| 383 | 381 |
| 384 | |
| 385 // Prevents a (non-cons, non-slice) string from having its representation | |
| 386 // changed. This is just a Handle based wrapper around Heap::LockString. | |
| 387 // Use Heap::UnlockString to unlock (that one can't cause allocation, so | |
| 388 // it doesn't need a Handle wrapper). | |
| 389 void LockString(Handle<String> string); | |
| 390 | |
| 391 // Scoped lock on a string. | |
| 392 class StringLock { | |
| 393 public: | |
| 394 explicit StringLock(Handle<String> string); | |
| 395 ~StringLock(); | |
| 396 private: | |
| 397 Handle<String> string_; | |
| 398 }; | |
| 399 | |
| 400 } } // namespace v8::internal | 382 } } // namespace v8::internal |
| 401 | 383 |
| 402 #endif // V8_HANDLES_H_ | 384 #endif // V8_HANDLES_H_ |
| OLD | NEW |