Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 5be492966dbd4a0f18d40981f54e92a15c536c0b..e22eaa11dfba600e60dbc638e7fe3b646464ed71 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -4219,25 +4219,44 @@ class ExternalTwoByteString: public ExternalString { |
}; |
+// Utility superclass for stack-allocated objects that must be updated |
+// on gc. It provides two ways for the gc to update instances, either |
iposva
2009/09/30 22:19:05
gc -> GC
|
+// iterating or updating after gc. |
+class Relocatable BASE_EMBEDDED { |
+public: |
iposva
2009/09/30 22:19:05
Presubmit Check: Fail
|
+ inline Relocatable() : prev_(top_) { top_ = this; } |
+ virtual ~Relocatable() { ASSERT_EQ(top_, this); top_ = prev_; } |
iposva
2009/09/30 22:19:05
Presubmit Check: Fail
|
+ virtual void IterateInstance(ObjectVisitor* v) { } |
+ virtual void PostGarbageCollection() { } |
+ |
+ static void PostGarbageCollectionProcessing(); |
+ static int ArchiveSpacePerThread(); |
+ static char* ArchiveState(char* to); |
+ static char* RestoreState(char* from); |
+ static void Iterate(ObjectVisitor* v); |
+ static void Iterate(ObjectVisitor* v, Relocatable* top); |
+ static char* Iterate(ObjectVisitor* v, char* t); |
+private: |
iposva
2009/09/30 22:19:05
Presubmit Check: Fail
|
+ static Relocatable* top_; |
+ Relocatable* prev_; |
+}; |
+ |
+ |
// A flat string reader provides random access to the contents of a |
// string independent of the character width of the string. The handle |
// must be valid as long as the reader is being used. |
-class FlatStringReader BASE_EMBEDDED { |
+class FlatStringReader : public Relocatable { |
public: |
explicit FlatStringReader(Handle<String> str); |
explicit FlatStringReader(Vector<const char> input); |
- ~FlatStringReader(); |
- void RefreshState(); |
+ void PostGarbageCollection(); |
inline uc32 Get(int index); |
int length() { return length_; } |
- static void PostGarbageCollectionProcessing(); |
private: |
String** str_; |
bool is_ascii_; |
int length_; |
const void* start_; |
- FlatStringReader* prev_; |
- static FlatStringReader* top_; |
}; |