| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // - CompilationCacheTable | 79 // - CompilationCacheTable |
| 80 // - CodeCacheHashTable | 80 // - CodeCacheHashTable |
| 81 // - MapCache | 81 // - MapCache |
| 82 // - Context | 82 // - Context |
| 83 // - JSFunctionResultCache | 83 // - JSFunctionResultCache |
| 84 // - SerializedScopeInfo | 84 // - SerializedScopeInfo |
| 85 // - String | 85 // - String |
| 86 // - SeqString | 86 // - SeqString |
| 87 // - SeqAsciiString | 87 // - SeqAsciiString |
| 88 // - SeqTwoByteString | 88 // - SeqTwoByteString |
| 89 // - SlicedString |
| 89 // - ConsString | 90 // - ConsString |
| 90 // - ExternalString | 91 // - ExternalString |
| 91 // - ExternalAsciiString | 92 // - ExternalAsciiString |
| 92 // - ExternalTwoByteString | 93 // - ExternalTwoByteString |
| 93 // - HeapNumber | 94 // - HeapNumber |
| 94 // - Code | 95 // - Code |
| 95 // - Map | 96 // - Map |
| 96 // - Oddball | 97 // - Oddball |
| 97 // - Foreign | 98 // - Foreign |
| 98 // - SharedFunctionInfo | 99 // - SharedFunctionInfo |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 V(ASCII_SYMBOL_TYPE) \ | 274 V(ASCII_SYMBOL_TYPE) \ |
| 274 V(CONS_SYMBOL_TYPE) \ | 275 V(CONS_SYMBOL_TYPE) \ |
| 275 V(CONS_ASCII_SYMBOL_TYPE) \ | 276 V(CONS_ASCII_SYMBOL_TYPE) \ |
| 276 V(EXTERNAL_SYMBOL_TYPE) \ | 277 V(EXTERNAL_SYMBOL_TYPE) \ |
| 277 V(EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE) \ | 278 V(EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE) \ |
| 278 V(EXTERNAL_ASCII_SYMBOL_TYPE) \ | 279 V(EXTERNAL_ASCII_SYMBOL_TYPE) \ |
| 279 V(STRING_TYPE) \ | 280 V(STRING_TYPE) \ |
| 280 V(ASCII_STRING_TYPE) \ | 281 V(ASCII_STRING_TYPE) \ |
| 281 V(CONS_STRING_TYPE) \ | 282 V(CONS_STRING_TYPE) \ |
| 282 V(CONS_ASCII_STRING_TYPE) \ | 283 V(CONS_ASCII_STRING_TYPE) \ |
| 284 V(SLICED_STRING_TYPE) \ |
| 283 V(EXTERNAL_STRING_TYPE) \ | 285 V(EXTERNAL_STRING_TYPE) \ |
| 284 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ | 286 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ |
| 285 V(EXTERNAL_ASCII_STRING_TYPE) \ | 287 V(EXTERNAL_ASCII_STRING_TYPE) \ |
| 286 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ | 288 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ |
| 287 \ | 289 \ |
| 288 V(MAP_TYPE) \ | 290 V(MAP_TYPE) \ |
| 289 V(CODE_TYPE) \ | 291 V(CODE_TYPE) \ |
| 290 V(ODDBALL_TYPE) \ | 292 V(ODDBALL_TYPE) \ |
| 291 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ | 293 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ |
| 292 \ | 294 \ |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 ascii_string, \ | 391 ascii_string, \ |
| 390 AsciiString) \ | 392 AsciiString) \ |
| 391 V(CONS_STRING_TYPE, \ | 393 V(CONS_STRING_TYPE, \ |
| 392 ConsString::kSize, \ | 394 ConsString::kSize, \ |
| 393 cons_string, \ | 395 cons_string, \ |
| 394 ConsString) \ | 396 ConsString) \ |
| 395 V(CONS_ASCII_STRING_TYPE, \ | 397 V(CONS_ASCII_STRING_TYPE, \ |
| 396 ConsString::kSize, \ | 398 ConsString::kSize, \ |
| 397 cons_ascii_string, \ | 399 cons_ascii_string, \ |
| 398 ConsAsciiString) \ | 400 ConsAsciiString) \ |
| 401 V(SLICED_STRING_TYPE, \ |
| 402 SlicedString::kSize, \ |
| 403 sliced_string, \ |
| 404 SlicedString) \ |
| 405 V(SLICED_ASCII_STRING_TYPE, \ |
| 406 SlicedString::kSize, \ |
| 407 sliced_ascii_string, \ |
| 408 SlicedAsciiString) \ |
| 399 V(EXTERNAL_STRING_TYPE, \ | 409 V(EXTERNAL_STRING_TYPE, \ |
| 400 ExternalTwoByteString::kSize, \ | 410 ExternalTwoByteString::kSize, \ |
| 401 external_string, \ | 411 external_string, \ |
| 402 ExternalString) \ | 412 ExternalString) \ |
| 403 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ | 413 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ |
| 404 ExternalTwoByteString::kSize, \ | 414 ExternalTwoByteString::kSize, \ |
| 405 external_string_with_ascii_data, \ | 415 external_string_with_ascii_data, \ |
| 406 ExternalStringWithAsciiData) \ | 416 ExternalStringWithAsciiData) \ |
| 407 V(EXTERNAL_ASCII_STRING_TYPE, \ | 417 V(EXTERNAL_ASCII_STRING_TYPE, \ |
| 408 ExternalAsciiString::kSize, \ | 418 ExternalAsciiString::kSize, \ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 const uint32_t kStringEncodingMask = 0x4; | 472 const uint32_t kStringEncodingMask = 0x4; |
| 463 const uint32_t kTwoByteStringTag = 0x0; | 473 const uint32_t kTwoByteStringTag = 0x0; |
| 464 const uint32_t kAsciiStringTag = 0x4; | 474 const uint32_t kAsciiStringTag = 0x4; |
| 465 | 475 |
| 466 // If bit 7 is clear, the low-order 2 bits indicate the representation | 476 // If bit 7 is clear, the low-order 2 bits indicate the representation |
| 467 // of the string. | 477 // of the string. |
| 468 const uint32_t kStringRepresentationMask = 0x03; | 478 const uint32_t kStringRepresentationMask = 0x03; |
| 469 enum StringRepresentationTag { | 479 enum StringRepresentationTag { |
| 470 kSeqStringTag = 0x0, | 480 kSeqStringTag = 0x0, |
| 471 kConsStringTag = 0x1, | 481 kConsStringTag = 0x1, |
| 472 kExternalStringTag = 0x2 | 482 kExternalStringTag = 0x2, |
| 483 kSlicedStringTag = 0x3 |
| 473 }; | 484 }; |
| 474 const uint32_t kIsConsStringMask = 0x1; | 485 const uint32_t kIsIndirectStringMask = 0x1; |
| 486 const uint32_t kIsIndirectStringTag = 0x1; |
| 487 STATIC_ASSERT( |
| 488 (kConsStringTag & kIsIndirectStringMask) == kIsIndirectStringTag); |
| 489 STATIC_ASSERT( |
| 490 (kSlicedStringTag & kIsIndirectStringMask) == kIsIndirectStringTag); |
| 475 | 491 |
| 476 // If bit 7 is clear, then bit 3 indicates whether this two-byte | 492 // If bit 7 is clear, then bit 3 indicates whether this two-byte |
| 477 // string actually contains ascii data. | 493 // string actually contains ascii data. |
| 478 const uint32_t kAsciiDataHintMask = 0x08; | 494 const uint32_t kAsciiDataHintMask = 0x08; |
| 479 const uint32_t kAsciiDataHintTag = 0x08; | 495 const uint32_t kAsciiDataHintTag = 0x08; |
| 480 | 496 |
| 481 | 497 |
| 482 // A ConsString with an empty string as the right side is a candidate | 498 // A ConsString with an empty string as the right side is a candidate |
| 483 // for being shortcut by the garbage collector unless it is a | 499 // for being shortcut by the garbage collector unless it is a |
| 484 // symbol. It's not common to have non-flat symbols, so we do not | 500 // symbol. It's not common to have non-flat symbols, so we do not |
| (...skipping 14 matching lines...) Expand all Loading... |
| 499 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, | 515 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, |
| 500 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, | 516 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, |
| 501 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = | 517 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = |
| 502 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, | 518 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, |
| 503 EXTERNAL_ASCII_SYMBOL_TYPE = | 519 EXTERNAL_ASCII_SYMBOL_TYPE = |
| 504 kAsciiStringTag | kSymbolTag | kExternalStringTag, | 520 kAsciiStringTag | kSymbolTag | kExternalStringTag, |
| 505 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, | 521 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, |
| 506 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag, | 522 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag, |
| 507 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, | 523 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, |
| 508 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag, | 524 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag, |
| 525 SLICED_STRING_TYPE = kTwoByteStringTag | kSlicedStringTag, |
| 526 SLICED_ASCII_STRING_TYPE = kAsciiStringTag | kSlicedStringTag, |
| 509 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, | 527 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, |
| 510 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = | 528 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = |
| 511 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, | 529 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, |
| 512 // LAST_STRING_TYPE | 530 // LAST_STRING_TYPE |
| 513 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag, | 531 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag, |
| 514 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, | 532 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, |
| 515 | 533 |
| 516 // Objects allocated in their own spaces (never in new space). | 534 // Objects allocated in their own spaces (never in new space). |
| 517 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE | 535 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE |
| 518 CODE_TYPE, | 536 CODE_TYPE, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 V(HeapObject) \ | 720 V(HeapObject) \ |
| 703 V(Number) \ | 721 V(Number) \ |
| 704 | 722 |
| 705 #define HEAP_OBJECT_TYPE_LIST(V) \ | 723 #define HEAP_OBJECT_TYPE_LIST(V) \ |
| 706 V(HeapNumber) \ | 724 V(HeapNumber) \ |
| 707 V(String) \ | 725 V(String) \ |
| 708 V(Symbol) \ | 726 V(Symbol) \ |
| 709 V(SeqString) \ | 727 V(SeqString) \ |
| 710 V(ExternalString) \ | 728 V(ExternalString) \ |
| 711 V(ConsString) \ | 729 V(ConsString) \ |
| 730 V(SlicedString) \ |
| 712 V(ExternalTwoByteString) \ | 731 V(ExternalTwoByteString) \ |
| 713 V(ExternalAsciiString) \ | 732 V(ExternalAsciiString) \ |
| 714 V(SeqTwoByteString) \ | 733 V(SeqTwoByteString) \ |
| 715 V(SeqAsciiString) \ | 734 V(SeqAsciiString) \ |
| 716 \ | 735 \ |
| 717 V(ExternalArray) \ | 736 V(ExternalArray) \ |
| 718 V(ExternalByteArray) \ | 737 V(ExternalByteArray) \ |
| 719 V(ExternalUnsignedByteArray) \ | 738 V(ExternalUnsignedByteArray) \ |
| 720 V(ExternalShortArray) \ | 739 V(ExternalShortArray) \ |
| 721 V(ExternalUnsignedShortArray) \ | 740 V(ExternalUnsignedShortArray) \ |
| (...skipping 4980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5702 // prone and so we no longer put StringShapes in variables unless there is a | 5721 // prone and so we no longer put StringShapes in variables unless there is a |
| 5703 // concrete performance benefit at that particular point in the code. | 5722 // concrete performance benefit at that particular point in the code. |
| 5704 class StringShape BASE_EMBEDDED { | 5723 class StringShape BASE_EMBEDDED { |
| 5705 public: | 5724 public: |
| 5706 inline explicit StringShape(String* s); | 5725 inline explicit StringShape(String* s); |
| 5707 inline explicit StringShape(Map* s); | 5726 inline explicit StringShape(Map* s); |
| 5708 inline explicit StringShape(InstanceType t); | 5727 inline explicit StringShape(InstanceType t); |
| 5709 inline bool IsSequential(); | 5728 inline bool IsSequential(); |
| 5710 inline bool IsExternal(); | 5729 inline bool IsExternal(); |
| 5711 inline bool IsCons(); | 5730 inline bool IsCons(); |
| 5731 inline bool IsSliced(); |
| 5732 inline bool IsIndirect(); |
| 5712 inline bool IsExternalAscii(); | 5733 inline bool IsExternalAscii(); |
| 5713 inline bool IsExternalTwoByte(); | 5734 inline bool IsExternalTwoByte(); |
| 5714 inline bool IsSequentialAscii(); | 5735 inline bool IsSequentialAscii(); |
| 5715 inline bool IsSequentialTwoByte(); | 5736 inline bool IsSequentialTwoByte(); |
| 5716 inline bool IsSymbol(); | 5737 inline bool IsSymbol(); |
| 5717 inline StringRepresentationTag representation_tag(); | 5738 inline StringRepresentationTag representation_tag(); |
| 5718 inline uint32_t full_representation_tag(); | 5739 inline uint32_t full_representation_tag(); |
| 5719 inline uint32_t size_tag(); | 5740 inline uint32_t size_tag(); |
| 5720 #ifdef DEBUG | 5741 #ifdef DEBUG |
| 5721 inline uint32_t type() { return type_; } | 5742 inline uint32_t type() { return type_; } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5787 // | 5808 // |
| 5788 // Use FlattenString from Handles.cc to flatten even in case an | 5809 // Use FlattenString from Handles.cc to flatten even in case an |
| 5789 // allocation failure happens. | 5810 // allocation failure happens. |
| 5790 inline MaybeObject* TryFlatten(PretenureFlag pretenure = NOT_TENURED); | 5811 inline MaybeObject* TryFlatten(PretenureFlag pretenure = NOT_TENURED); |
| 5791 | 5812 |
| 5792 // Convenience function. Has exactly the same behavior as | 5813 // Convenience function. Has exactly the same behavior as |
| 5793 // TryFlatten(), except in the case of failure returns the original | 5814 // TryFlatten(), except in the case of failure returns the original |
| 5794 // string. | 5815 // string. |
| 5795 inline String* TryFlattenGetString(PretenureFlag pretenure = NOT_TENURED); | 5816 inline String* TryFlattenGetString(PretenureFlag pretenure = NOT_TENURED); |
| 5796 | 5817 |
| 5818 // Equivalent to Flatten for string slices. A new parent string is created |
| 5819 // with exactly the required characters. Offset is set to 0. |
| 5820 inline MaybeObject* TryTruncate(PretenureFlag pretenure = NOT_TENURED); |
| 5821 inline String* TryTruncateGetString(PretenureFlag pretenure = NOT_TENURED); |
| 5822 |
| 5823 // Combines flatten and truncate. |
| 5824 inline MaybeObject* TryFlattenOrTruncate(PretenureFlag pretenure |
| 5825 = NOT_TENURED); |
| 5826 |
| 5827 // Returns the parent of a sliced string or first part of a cons string. |
| 5828 inline String* GetIndirect(); |
| 5829 |
| 5797 Vector<const char> ToAsciiVector(); | 5830 Vector<const char> ToAsciiVector(); |
| 5798 Vector<const uc16> ToUC16Vector(); | 5831 Vector<const uc16> ToUC16Vector(); |
| 5799 | 5832 |
| 5800 // Mark the string as an undetectable object. It only applies to | 5833 // Mark the string as an undetectable object. It only applies to |
| 5801 // ascii and two byte string types. | 5834 // ascii and two byte string types. |
| 5802 bool MarkAsUndetectable(); | 5835 bool MarkAsUndetectable(); |
| 5803 | 5836 |
| 5804 // Return a substring. | 5837 // Return a substring. |
| 5805 MUST_USE_RESULT MaybeObject* SubString(int from, | 5838 MUST_USE_RESULT MaybeObject* SubString(int from, |
| 5806 int to, | 5839 int to, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5874 #ifdef OBJECT_PRINT | 5907 #ifdef OBJECT_PRINT |
| 5875 inline void StringPrint() { | 5908 inline void StringPrint() { |
| 5876 StringPrint(stdout); | 5909 StringPrint(stdout); |
| 5877 } | 5910 } |
| 5878 void StringPrint(FILE* out); | 5911 void StringPrint(FILE* out); |
| 5879 #endif | 5912 #endif |
| 5880 #ifdef DEBUG | 5913 #ifdef DEBUG |
| 5881 void StringVerify(); | 5914 void StringVerify(); |
| 5882 #endif | 5915 #endif |
| 5883 inline bool IsFlat(); | 5916 inline bool IsFlat(); |
| 5917 inline bool IsTruncated(); |
| 5918 inline bool IsFlatAndTruncated(); |
| 5884 | 5919 |
| 5885 // Layout description. | 5920 // Layout description. |
| 5886 static const int kLengthOffset = HeapObject::kHeaderSize; | 5921 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 5887 static const int kHashFieldOffset = kLengthOffset + kPointerSize; | 5922 static const int kHashFieldOffset = kLengthOffset + kPointerSize; |
| 5888 static const int kSize = kHashFieldOffset + kPointerSize; | 5923 static const int kSize = kHashFieldOffset + kPointerSize; |
| 5889 | 5924 |
| 5890 // Maximum number of characters to consider when trying to convert a string | 5925 // Maximum number of characters to consider when trying to convert a string |
| 5891 // value into an array index. | 5926 // value into an array index. |
| 5892 static const int kMaxArrayIndexSize = 10; | 5927 static const int kMaxArrayIndexSize = 10; |
| 5893 | 5928 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6036 ReadBlockBuffer* buffer, | 6071 ReadBlockBuffer* buffer, |
| 6037 unsigned* offset_ptr, | 6072 unsigned* offset_ptr, |
| 6038 unsigned max_chars); | 6073 unsigned max_chars); |
| 6039 | 6074 |
| 6040 private: | 6075 private: |
| 6041 // Try to flatten the top level ConsString that is hiding behind this | 6076 // Try to flatten the top level ConsString that is hiding behind this |
| 6042 // string. This is a no-op unless the string is a ConsString. Flatten | 6077 // string. This is a no-op unless the string is a ConsString. Flatten |
| 6043 // mutates the ConsString and might return a failure. | 6078 // mutates the ConsString and might return a failure. |
| 6044 MUST_USE_RESULT MaybeObject* SlowTryFlatten(PretenureFlag pretenure); | 6079 MUST_USE_RESULT MaybeObject* SlowTryFlatten(PretenureFlag pretenure); |
| 6045 | 6080 |
| 6081 // Try to create a new sequential string as parent for the slice that is |
| 6082 // as short as possible. This is a no-op unless the string is a SlicedString. |
| 6083 // Truncating mutates the SlicedString and might return a failure. |
| 6084 MUST_USE_RESULT MaybeObject* SlowTryTruncate(PretenureFlag pretenure); |
| 6085 |
| 6046 static inline bool IsHashFieldComputed(uint32_t field); | 6086 static inline bool IsHashFieldComputed(uint32_t field); |
| 6047 | 6087 |
| 6048 // Slow case of String::Equals. This implementation works on any strings | 6088 // Slow case of String::Equals. This implementation works on any strings |
| 6049 // but it is most efficient on strings that are almost flat. | 6089 // but it is most efficient on strings that are almost flat. |
| 6050 bool SlowEquals(String* other); | 6090 bool SlowEquals(String* other); |
| 6051 | 6091 |
| 6052 // Slow case of AsArrayIndex. | 6092 // Slow case of AsArrayIndex. |
| 6053 bool SlowAsArrayIndex(uint32_t* index); | 6093 bool SlowAsArrayIndex(uint32_t* index); |
| 6054 | 6094 |
| 6055 // Compute and set the hash code. | 6095 // Compute and set the hash code. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6221 static const int kMinLength = 13; | 6261 static const int kMinLength = 13; |
| 6222 | 6262 |
| 6223 typedef FixedBodyDescriptor<kFirstOffset, kSecondOffset + kPointerSize, kSize> | 6263 typedef FixedBodyDescriptor<kFirstOffset, kSecondOffset + kPointerSize, kSize> |
| 6224 BodyDescriptor; | 6264 BodyDescriptor; |
| 6225 | 6265 |
| 6226 private: | 6266 private: |
| 6227 DISALLOW_IMPLICIT_CONSTRUCTORS(ConsString); | 6267 DISALLOW_IMPLICIT_CONSTRUCTORS(ConsString); |
| 6228 }; | 6268 }; |
| 6229 | 6269 |
| 6230 | 6270 |
| 6271 class SlicedString: public String { |
| 6272 public: |
| 6273 |
| 6274 inline String* parent(); |
| 6275 inline void set_parent(String* parent); |
| 6276 inline int offset(); |
| 6277 inline void set_offset(int offset); |
| 6278 |
| 6279 // Dispatched behavior. |
| 6280 uint16_t SlicedStringGet(int index); |
| 6281 |
| 6282 // Casting. |
| 6283 static inline SlicedString* cast(Object* obj); |
| 6284 |
| 6285 // Layout description. |
| 6286 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize); |
| 6287 static const int kOffsetOffset = kParentOffset + kPointerSize; |
| 6288 static const int kSize = kOffsetOffset + kPointerSize; |
| 6289 |
| 6290 // Support for StringInputBuffer |
| 6291 inline const unibrow::byte* SlicedStringReadBlock(ReadBlockBuffer* buffer, |
| 6292 unsigned* offset_ptr, |
| 6293 unsigned chars); |
| 6294 inline void SlicedStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, |
| 6295 unsigned* offset_ptr, |
| 6296 unsigned chars); |
| 6297 // Minimum length for a sliced string. |
| 6298 static const int kMinLength = 13; |
| 6299 |
| 6300 typedef FixedBodyDescriptor<kParentOffset, |
| 6301 kOffsetOffset + kPointerSize, kSize> |
| 6302 BodyDescriptor; |
| 6303 |
| 6304 private: |
| 6305 DISALLOW_IMPLICIT_CONSTRUCTORS(SlicedString); |
| 6306 }; |
| 6307 |
| 6308 |
| 6231 // The ExternalString class describes string values that are backed by | 6309 // The ExternalString class describes string values that are backed by |
| 6232 // a string resource that lies outside the V8 heap. ExternalStrings | 6310 // a string resource that lies outside the V8 heap. ExternalStrings |
| 6233 // consist of the length field common to all strings, a pointer to the | 6311 // consist of the length field common to all strings, a pointer to the |
| 6234 // external resource. It is important to ensure (externally) that the | 6312 // external resource. It is important to ensure (externally) that the |
| 6235 // resource is not deallocated while the ExternalString is live in the | 6313 // resource is not deallocated while the ExternalString is live in the |
| 6236 // V8 heap. | 6314 // V8 heap. |
| 6237 // | 6315 // |
| 6238 // The API expects that all ExternalStrings are created through the | 6316 // The API expects that all ExternalStrings are created through the |
| 6239 // API. Therefore, ExternalStrings should not be used internally. | 6317 // API. Therefore, ExternalStrings should not be used internally. |
| 6240 class ExternalString: public String { | 6318 class ExternalString: public String { |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7203 } else { | 7281 } else { |
| 7204 value &= ~(1 << bit_position); | 7282 value &= ~(1 << bit_position); |
| 7205 } | 7283 } |
| 7206 return value; | 7284 return value; |
| 7207 } | 7285 } |
| 7208 }; | 7286 }; |
| 7209 | 7287 |
| 7210 } } // namespace v8::internal | 7288 } } // namespace v8::internal |
| 7211 | 7289 |
| 7212 #endif // V8_OBJECTS_H_ | 7290 #endif // V8_OBJECTS_H_ |
| OLD | NEW |