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 | 166 // They might invoke garbage collection. The result is an handle to an |
167 // an object of expected type, or the handle is an error if running out | 167 // object of expected type, or the handle is a null handle if encountering |
168 // of space or encountering an internal error. | 168 // an internal error. Will not return a null handle due to out-of-memory |
| 169 // unless otherwise stated, but will instead try to do GC and die fatally |
| 170 // if that doesn't help. |
169 | 171 |
170 void NormalizeProperties(Handle<JSObject> object, | 172 void NormalizeProperties(Handle<JSObject> object, |
171 PropertyNormalizationMode mode, | 173 PropertyNormalizationMode mode, |
172 int expected_additional_properties); | 174 int expected_additional_properties); |
173 Handle<NumberDictionary> NormalizeElements(Handle<JSObject> object); | 175 Handle<NumberDictionary> NormalizeElements(Handle<JSObject> object); |
174 void TransformToFastProperties(Handle<JSObject> object, | 176 void TransformToFastProperties(Handle<JSObject> object, |
175 int unused_property_fields); | 177 int unused_property_fields); |
176 MUST_USE_RESULT Handle<NumberDictionary> NumberDictionarySet( | 178 MUST_USE_RESULT Handle<NumberDictionary> NumberDictionarySet( |
177 Handle<NumberDictionary> dictionary, | 179 Handle<NumberDictionary> dictionary, |
178 uint32_t index, | 180 uint32_t index, |
179 Handle<Object> value, | 181 Handle<Object> value, |
180 PropertyDetails details); | 182 PropertyDetails details); |
181 | 183 |
182 // Flattens a string. | 184 // Flattens a string. |
183 void FlattenString(Handle<String> str); | 185 void FlattenString(Handle<String> str); |
184 | 186 |
185 // Flattens a string and returns the underlying external or sequential | 187 // Flattens a string and returns the underlying external or sequential |
186 // string. | 188 // string. Never returns a null handle. |
187 Handle<String> FlattenGetString(Handle<String> str); | 189 Handle<String> FlattenGetString(Handle<String> str); |
188 | 190 |
189 Handle<Object> SetProperty(Handle<JSReceiver> object, | 191 Handle<Object> SetProperty(Handle<JSReceiver> object, |
190 Handle<String> key, | 192 Handle<String> key, |
191 Handle<Object> value, | 193 Handle<Object> value, |
192 PropertyAttributes attributes, | 194 PropertyAttributes attributes, |
193 StrictModeFlag strict_mode); | 195 StrictModeFlag strict_mode); |
194 | 196 |
195 Handle<Object> SetProperty(Handle<Object> object, | 197 Handle<Object> SetProperty(Handle<Object> object, |
196 Handle<Object> key, | 198 Handle<Object> key, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 NoHandleAllocation() {} | 374 NoHandleAllocation() {} |
373 ~NoHandleAllocation() {} | 375 ~NoHandleAllocation() {} |
374 #else | 376 #else |
375 inline NoHandleAllocation(); | 377 inline NoHandleAllocation(); |
376 inline ~NoHandleAllocation(); | 378 inline ~NoHandleAllocation(); |
377 private: | 379 private: |
378 int level_; | 380 int level_; |
379 #endif | 381 #endif |
380 }; | 382 }; |
381 | 383 |
| 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 |
382 } } // namespace v8::internal | 400 } } // namespace v8::internal |
383 | 401 |
384 #endif // V8_HANDLES_H_ | 402 #endif // V8_HANDLES_H_ |
OLD | NEW |