| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4184 | 4184 |
| 4185 // Support for StringInputBuffer. | 4185 // Support for StringInputBuffer. |
| 4186 void ExternalTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 4186 void ExternalTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, |
| 4187 unsigned* offset_ptr, | 4187 unsigned* offset_ptr, |
| 4188 unsigned chars); | 4188 unsigned chars); |
| 4189 | 4189 |
| 4190 private: | 4190 private: |
| 4191 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); | 4191 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); |
| 4192 }; | 4192 }; |
| 4193 | 4193 |
| 4194 class Relocatable; |
| 4195 class RelocatableData { |
| 4196 public: |
| 4197 inline void save(Relocatable* new_top, Relocatable*& saved_old_top) { |
| 4198 saved_old_top = top_; |
| 4199 top_ = new_top; |
| 4200 } |
| 4201 inline void restore(Relocatable* top, Relocatable* saved_old_top) { |
| 4202 ASSERT_EQ(top_, top); |
| 4203 top_ = saved_old_top; |
| 4204 } |
| 4205 private: |
| 4206 friend class V8Context; |
| 4207 friend class Relocatable; |
| 4208 Relocatable * top_; |
| 4209 RelocatableData(); |
| 4210 DISALLOW_COPY_AND_ASSIGN(RelocatableData); |
| 4211 }; |
| 4194 | 4212 |
| 4195 // Utility superclass for stack-allocated objects that must be updated | 4213 // Utility superclass for stack-allocated objects that must be updated |
| 4196 // on gc. It provides two ways for the gc to update instances, either | 4214 // on gc. It provides two ways for the gc to update instances, either |
| 4197 // iterating or updating after gc. | 4215 // iterating or updating after gc. |
| 4198 class Relocatable BASE_EMBEDDED { | 4216 class Relocatable BASE_EMBEDDED { |
| 4199 public: | 4217 public: |
| 4200 inline Relocatable() : prev_(top_) { top_ = this; } | 4218 inline Relocatable() { v8_context()->relocatable_data_.save(this, prev_); } |
| 4201 virtual ~Relocatable() { | 4219 virtual ~Relocatable() { |
| 4202 ASSERT_EQ(top_, this); | 4220 v8_context()->relocatable_data_.restore(this, prev_); |
| 4203 top_ = prev_; | |
| 4204 } | 4221 } |
| 4205 virtual void IterateInstance(ObjectVisitor* v) { } | 4222 virtual void IterateInstance(ObjectVisitor* v) { } |
| 4206 virtual void PostGarbageCollection() { } | 4223 virtual void PostGarbageCollection() { } |
| 4207 | 4224 |
| 4208 static void PostGarbageCollectionProcessing(); | 4225 static void PostGarbageCollectionProcessing(); |
| 4209 static int ArchiveSpacePerThread(); | 4226 static int ArchiveSpacePerThread(); |
| 4210 static char* ArchiveState(char* to); | 4227 static char* ArchiveState(char* to); |
| 4211 static char* RestoreState(char* from); | 4228 static char* RestoreState(char* from); |
| 4212 static void Iterate(ObjectVisitor* v); | 4229 static void Iterate(ObjectVisitor* v); |
| 4213 static void Iterate(ObjectVisitor* v, Relocatable* top); | 4230 static void Iterate(ObjectVisitor* v, Relocatable* top); |
| 4214 static char* Iterate(ObjectVisitor* v, char* t); | 4231 static char* Iterate(ObjectVisitor* v, char* t); |
| 4215 private: | 4232 private: |
| 4216 static Relocatable* top_; | |
| 4217 Relocatable* prev_; | 4233 Relocatable* prev_; |
| 4218 }; | 4234 }; |
| 4219 | 4235 |
| 4220 | 4236 |
| 4221 // A flat string reader provides random access to the contents of a | 4237 // A flat string reader provides random access to the contents of a |
| 4222 // string independent of the character width of the string. The handle | 4238 // string independent of the character width of the string. The handle |
| 4223 // must be valid as long as the reader is being used. | 4239 // must be valid as long as the reader is being used. |
| 4224 class FlatStringReader : public Relocatable { | 4240 class FlatStringReader : public Relocatable { |
| 4225 public: | 4241 public: |
| 4226 explicit FlatStringReader(Handle<String> str); | 4242 explicit FlatStringReader(Handle<String> str); |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4860 static inline int set(int value, int bit_position, bool v) { | 4876 static inline int set(int value, int bit_position, bool v) { |
| 4861 if (v) { | 4877 if (v) { |
| 4862 value |= (1 << bit_position); | 4878 value |= (1 << bit_position); |
| 4863 } else { | 4879 } else { |
| 4864 value &= ~(1 << bit_position); | 4880 value &= ~(1 << bit_position); |
| 4865 } | 4881 } |
| 4866 return value; | 4882 return value; |
| 4867 } | 4883 } |
| 4868 }; | 4884 }; |
| 4869 | 4885 |
| 4886 class ObjectsData { |
| 4887 public: |
| 4888 StringInputBuffer string_compare_buffer_a_; |
| 4889 StringInputBuffer string_compare_buffer_b_; |
| 4890 StaticResource<StringInputBuffer> string_input_buffer_; |
| 4891 |
| 4892 private: |
| 4893 friend class V8Context; |
| 4894 ObjectsData() {} |
| 4895 DISALLOW_COPY_AND_ASSIGN(ObjectsData); |
| 4896 }; |
| 4897 |
| 4870 } } // namespace v8::internal | 4898 } } // namespace v8::internal |
| 4871 | 4899 |
| 4872 #endif // V8_OBJECTS_H_ | 4900 #endif // V8_OBJECTS_H_ |
| OLD | NEW |