Index: src/handles.h |
diff --git a/src/handles.h b/src/handles.h |
index 3f4e2293a4e167b3667202caedc81a0f3222316d..8dcca3eab8ab0523901d2614bd4ec208f84abe9a 100644 |
--- a/src/handles.h |
+++ b/src/handles.h |
@@ -163,9 +163,11 @@ class HandleScope { |
// ---------------------------------------------------------------------------- |
// Handle operations. |
-// They might invoke garbage collection. The result is an handle to |
-// an object of expected type, or the handle is an error if running out |
-// of space or encountering an internal error. |
+// They might invoke garbage collection. The result is an handle to an |
+// object of expected type, or the handle is a null handle if encountering |
+// an internal error. Will not return a null handle due to out-of-memory |
+// unless otherwise stated, but will instead try to do GC and die fatally |
+// if that doesn't help. |
void NormalizeProperties(Handle<JSObject> object, |
PropertyNormalizationMode mode, |
@@ -183,7 +185,7 @@ MUST_USE_RESULT Handle<NumberDictionary> NumberDictionarySet( |
void FlattenString(Handle<String> str); |
// Flattens a string and returns the underlying external or sequential |
-// string. |
+// string. Never returns a null handle. |
Handle<String> FlattenGetString(Handle<String> str); |
Handle<Object> SetProperty(Handle<JSReceiver> object, |
@@ -379,6 +381,22 @@ class NoHandleAllocation BASE_EMBEDDED { |
#endif |
}; |
+ |
+// Prevents a (non-cons, non-slice) string from having its representation |
+// changed. This is just a Handle based wrapper around Heap::LockString. |
+// Use Heap::UnlockString to unlock (that one can't cause allocation, so |
+// it doesn't need a Handle wrapper). |
+void LockString(Handle<String> string); |
+ |
+// Scoped lock on a string. |
+class StringLock { |
+ public: |
+ explicit StringLock(Handle<String> string); |
+ ~StringLock(); |
+ private: |
+ Handle<String> string_; |
+}; |
+ |
} } // namespace v8::internal |
#endif // V8_HANDLES_H_ |