Chromium Code Reviews| 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 6109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6120 DISALLOW_IMPLICIT_CONSTRUCTORS(String); | 6120 DISALLOW_IMPLICIT_CONSTRUCTORS(String); |
| 6121 }; | 6121 }; |
| 6122 | 6122 |
| 6123 | 6123 |
| 6124 // The SeqString abstract class captures sequential string values. | 6124 // The SeqString abstract class captures sequential string values. |
| 6125 class SeqString: public String { | 6125 class SeqString: public String { |
| 6126 public: | 6126 public: |
| 6127 // Casting. | 6127 // Casting. |
| 6128 static inline SeqString* cast(Object* obj); | 6128 static inline SeqString* cast(Object* obj); |
| 6129 | 6129 |
| 6130 // Layout description. | |
| 6131 static const int kHeaderSize = String::kSize; | |
| 6132 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); | |
|
Lasse Reichstein
2011/09/20 08:42:01
Do we ever use kAlignedSize any more?
Since we mad
Michael Starzinger
2011/09/20 16:07:39
Done.
| |
| 6133 | |
| 6130 private: | 6134 private: |
| 6131 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); | 6135 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); |
| 6132 }; | 6136 }; |
| 6133 | 6137 |
| 6134 | 6138 |
| 6135 // The AsciiString class captures sequential ascii string objects. | 6139 // The AsciiString class captures sequential ascii string objects. |
| 6136 // Each character in the AsciiString is an ascii character. | 6140 // Each character in the AsciiString is an ascii character. |
| 6137 class SeqAsciiString: public SeqString { | 6141 class SeqAsciiString: public SeqString { |
| 6138 public: | 6142 public: |
| 6139 static const bool kHasAsciiEncoding = true; | 6143 static const bool kHasAsciiEncoding = true; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 6153 // Garbage collection support. This method is called by the | 6157 // Garbage collection support. This method is called by the |
| 6154 // garbage collector to compute the actual size of an AsciiString | 6158 // garbage collector to compute the actual size of an AsciiString |
| 6155 // instance. | 6159 // instance. |
| 6156 inline int SeqAsciiStringSize(InstanceType instance_type); | 6160 inline int SeqAsciiStringSize(InstanceType instance_type); |
| 6157 | 6161 |
| 6158 // Computes the size for an AsciiString instance of a given length. | 6162 // Computes the size for an AsciiString instance of a given length. |
| 6159 static int SizeFor(int length) { | 6163 static int SizeFor(int length) { |
| 6160 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); | 6164 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); |
| 6161 } | 6165 } |
| 6162 | 6166 |
| 6163 // Layout description. | |
| 6164 static const int kHeaderSize = String::kSize; | |
| 6165 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); | |
| 6166 | |
| 6167 // Maximal memory usage for a single sequential ASCII string. | 6167 // Maximal memory usage for a single sequential ASCII string. |
| 6168 static const int kMaxSize = 512 * MB - 1; | 6168 static const int kMaxSize = 512 * MB - 1; |
| 6169 // Maximal length of a single sequential ASCII string. | 6169 // Maximal length of a single sequential ASCII string. |
| 6170 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. | 6170 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. |
| 6171 static const int kMaxLength = (kMaxSize - kHeaderSize); | 6171 static const int kMaxLength = (kMaxSize - kHeaderSize); |
| 6172 | 6172 |
| 6173 // Support for StringInputBuffer. | 6173 // Support for StringInputBuffer. |
| 6174 inline void SeqAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 6174 inline void SeqAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, |
| 6175 unsigned* offset, | 6175 unsigned* offset, |
| 6176 unsigned chars); | 6176 unsigned chars); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 6207 // Garbage collection support. This method is called by the | 6207 // Garbage collection support. This method is called by the |
| 6208 // garbage collector to compute the actual size of a TwoByteString | 6208 // garbage collector to compute the actual size of a TwoByteString |
| 6209 // instance. | 6209 // instance. |
| 6210 inline int SeqTwoByteStringSize(InstanceType instance_type); | 6210 inline int SeqTwoByteStringSize(InstanceType instance_type); |
| 6211 | 6211 |
| 6212 // Computes the size for a TwoByteString instance of a given length. | 6212 // Computes the size for a TwoByteString instance of a given length. |
| 6213 static int SizeFor(int length) { | 6213 static int SizeFor(int length) { |
| 6214 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); | 6214 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); |
| 6215 } | 6215 } |
| 6216 | 6216 |
| 6217 // Layout description. | |
| 6218 static const int kHeaderSize = String::kSize; | |
| 6219 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); | |
| 6220 | |
| 6221 // Maximal memory usage for a single sequential two-byte string. | 6217 // Maximal memory usage for a single sequential two-byte string. |
| 6222 static const int kMaxSize = 512 * MB - 1; | 6218 static const int kMaxSize = 512 * MB - 1; |
| 6223 // Maximal length of a single sequential two-byte string. | 6219 // Maximal length of a single sequential two-byte string. |
| 6224 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. | 6220 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. |
| 6225 static const int kMaxLength = (kMaxSize - kHeaderSize) / sizeof(uint16_t); | 6221 static const int kMaxLength = (kMaxSize - kHeaderSize) / sizeof(uint16_t); |
| 6226 | 6222 |
| 6227 // Support for StringInputBuffer. | 6223 // Support for StringInputBuffer. |
| 6228 inline void SeqTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 6224 inline void SeqTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, |
| 6229 unsigned* offset_ptr, | 6225 unsigned* offset_ptr, |
| 6230 unsigned chars); | 6226 unsigned chars); |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7393 } else { | 7389 } else { |
| 7394 value &= ~(1 << bit_position); | 7390 value &= ~(1 << bit_position); |
| 7395 } | 7391 } |
| 7396 return value; | 7392 return value; |
| 7397 } | 7393 } |
| 7398 }; | 7394 }; |
| 7399 | 7395 |
| 7400 } } // namespace v8::internal | 7396 } } // namespace v8::internal |
| 7401 | 7397 |
| 7402 #endif // V8_OBJECTS_H_ | 7398 #endif // V8_OBJECTS_H_ |
| OLD | NEW |