OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 8884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8895 | 8895 |
8896 // Max char codes. | 8896 // Max char codes. |
8897 static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar; | 8897 static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar; |
8898 static const uint32_t kMaxOneByteCharCodeU = unibrow::Latin1::kMaxChar; | 8898 static const uint32_t kMaxOneByteCharCodeU = unibrow::Latin1::kMaxChar; |
8899 static const int kMaxUtf16CodeUnit = 0xffff; | 8899 static const int kMaxUtf16CodeUnit = 0xffff; |
8900 | 8900 |
8901 // Value of hash field containing computed hash equal to zero. | 8901 // Value of hash field containing computed hash equal to zero. |
8902 static const int kEmptyStringHash = kIsNotArrayIndexMask; | 8902 static const int kEmptyStringHash = kIsNotArrayIndexMask; |
8903 | 8903 |
8904 // Maximal string length. | 8904 // Maximal string length. |
8905 static const int kMaxLength = (1 << (32 - 2)) - 1; | 8905 static const int kMaxLength = (1 << 28) - 16; |
8906 | 8906 |
8907 // Max length for computing hash. For strings longer than this limit the | 8907 // Max length for computing hash. For strings longer than this limit the |
8908 // string length is used as the hash value. | 8908 // string length is used as the hash value. |
8909 static const int kMaxHashCalcLength = 16383; | 8909 static const int kMaxHashCalcLength = 16383; |
8910 | 8910 |
8911 // Limit for truncation in short printing. | 8911 // Limit for truncation in short printing. |
8912 static const int kMaxShortPrintLength = 1024; | 8912 static const int kMaxShortPrintLength = 1024; |
8913 | 8913 |
8914 // Support for regular expressions. | 8914 // Support for regular expressions. |
8915 const uc16* GetTwoByteData(unsigned start); | 8915 const uc16* GetTwoByteData(unsigned start); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9057 // instance. | 9057 // instance. |
9058 inline int SeqOneByteStringSize(InstanceType instance_type); | 9058 inline int SeqOneByteStringSize(InstanceType instance_type); |
9059 | 9059 |
9060 // Computes the size for an AsciiString instance of a given length. | 9060 // Computes the size for an AsciiString instance of a given length. |
9061 static int SizeFor(int length) { | 9061 static int SizeFor(int length) { |
9062 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); | 9062 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); |
9063 } | 9063 } |
9064 | 9064 |
9065 // Maximal memory usage for a single sequential ASCII string. | 9065 // Maximal memory usage for a single sequential ASCII string. |
9066 static const int kMaxSize = 512 * MB - 1; | 9066 static const int kMaxSize = 512 * MB - 1; |
9067 // Maximal length of a single sequential ASCII string. | 9067 STATIC_CHECK((kMaxSize - kHeaderSize) >= String::kMaxLength); |
9068 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. | |
9069 static const int kMaxLength = (kMaxSize - kHeaderSize); | |
9070 | 9068 |
9071 private: | 9069 private: |
9072 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); | 9070 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); |
9073 }; | 9071 }; |
9074 | 9072 |
9075 | 9073 |
9076 // The TwoByteString class captures sequential unicode string objects. | 9074 // The TwoByteString class captures sequential unicode string objects. |
9077 // Each character in the TwoByteString is a two-byte uint16_t. | 9075 // Each character in the TwoByteString is a two-byte uint16_t. |
9078 class SeqTwoByteString: public SeqString { | 9076 class SeqTwoByteString: public SeqString { |
9079 public: | 9077 public: |
(...skipping 19 matching lines...) Expand all Loading... |
9099 // instance. | 9097 // instance. |
9100 inline int SeqTwoByteStringSize(InstanceType instance_type); | 9098 inline int SeqTwoByteStringSize(InstanceType instance_type); |
9101 | 9099 |
9102 // Computes the size for a TwoByteString instance of a given length. | 9100 // Computes the size for a TwoByteString instance of a given length. |
9103 static int SizeFor(int length) { | 9101 static int SizeFor(int length) { |
9104 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); | 9102 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kShortSize); |
9105 } | 9103 } |
9106 | 9104 |
9107 // Maximal memory usage for a single sequential two-byte string. | 9105 // Maximal memory usage for a single sequential two-byte string. |
9108 static const int kMaxSize = 512 * MB - 1; | 9106 static const int kMaxSize = 512 * MB - 1; |
9109 // Maximal length of a single sequential two-byte string. | 9107 STATIC_CHECK(static_cast<int>((kMaxSize - kHeaderSize)/sizeof(uint16_t)) >= |
9110 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. | 9108 String::kMaxLength); |
9111 static const int kMaxLength = (kMaxSize - kHeaderSize) / sizeof(uint16_t); | |
9112 | 9109 |
9113 private: | 9110 private: |
9114 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqTwoByteString); | 9111 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqTwoByteString); |
9115 }; | 9112 }; |
9116 | 9113 |
9117 | 9114 |
9118 // The ConsString class describes string values built by using the | 9115 // The ConsString class describes string values built by using the |
9119 // addition operator on strings. A ConsString is a pair where the | 9116 // addition operator on strings. A ConsString is a pair where the |
9120 // first and second components are pointers to other string values. | 9117 // first and second components are pointers to other string values. |
9121 // One or both components of a ConsString can be pointers to other | 9118 // One or both components of a ConsString can be pointers to other |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10794 } else { | 10791 } else { |
10795 value &= ~(1 << bit_position); | 10792 value &= ~(1 << bit_position); |
10796 } | 10793 } |
10797 return value; | 10794 return value; |
10798 } | 10795 } |
10799 }; | 10796 }; |
10800 | 10797 |
10801 } } // namespace v8::internal | 10798 } } // namespace v8::internal |
10802 | 10799 |
10803 #endif // V8_OBJECTS_H_ | 10800 #endif // V8_OBJECTS_H_ |
OLD | NEW |