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 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 ascii_symbol, \ | 363 ascii_symbol, \ |
| 362 AsciiSymbol) \ | 364 AsciiSymbol) \ |
| 363 V(CONS_SYMBOL_TYPE, \ | 365 V(CONS_SYMBOL_TYPE, \ |
| 364 ConsString::kSize, \ | 366 ConsString::kSize, \ |
| 365 cons_symbol, \ | 367 cons_symbol, \ |
| 366 ConsSymbol) \ | 368 ConsSymbol) \ |
| 367 V(CONS_ASCII_SYMBOL_TYPE, \ | 369 V(CONS_ASCII_SYMBOL_TYPE, \ |
| 368 ConsString::kSize, \ | 370 ConsString::kSize, \ |
| 369 cons_ascii_symbol, \ | 371 cons_ascii_symbol, \ |
| 370 ConsAsciiSymbol) \ | 372 ConsAsciiSymbol) \ |
| 373 V(SLICED_SYMBOL_TYPE, \ | |
| 374 SlicedString::kSize, \ | |
| 375 sliced_symbol, \ | |
| 376 SlicedSymbol) \ | |
| 377 V(SLICED_ASCII_SYMBOL_TYPE, \ | |
| 378 SlicedString::kSize, \ | |
| 379 sliced_ascii_symbol, \ | |
| 380 SlicedAsciiSymbol) \ | |
| 371 V(EXTERNAL_SYMBOL_TYPE, \ | 381 V(EXTERNAL_SYMBOL_TYPE, \ |
| 372 ExternalTwoByteString::kSize, \ | 382 ExternalTwoByteString::kSize, \ |
| 373 external_symbol, \ | 383 external_symbol, \ |
| 374 ExternalSymbol) \ | 384 ExternalSymbol) \ |
| 375 V(EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE, \ | 385 V(EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE, \ |
| 376 ExternalTwoByteString::kSize, \ | 386 ExternalTwoByteString::kSize, \ |
| 377 external_symbol_with_ascii_data, \ | 387 external_symbol_with_ascii_data, \ |
| 378 ExternalSymbolWithAsciiData) \ | 388 ExternalSymbolWithAsciiData) \ |
| 379 V(EXTERNAL_ASCII_SYMBOL_TYPE, \ | 389 V(EXTERNAL_ASCII_SYMBOL_TYPE, \ |
| 380 ExternalAsciiString::kSize, \ | 390 ExternalAsciiString::kSize, \ |
| 381 external_ascii_symbol, \ | 391 external_ascii_symbol, \ |
| 382 ExternalAsciiSymbol) \ | 392 ExternalAsciiSymbol) \ |
| 383 V(STRING_TYPE, \ | 393 V(STRING_TYPE, \ |
| 384 kVariableSizeSentinel, \ | 394 kVariableSizeSentinel, \ |
| 385 string, \ | 395 string, \ |
| 386 String) \ | 396 String) \ |
| 387 V(ASCII_STRING_TYPE, \ | 397 V(ASCII_STRING_TYPE, \ |
| 388 kVariableSizeSentinel, \ | 398 kVariableSizeSentinel, \ |
| 389 ascii_string, \ | 399 ascii_string, \ |
| 390 AsciiString) \ | 400 AsciiString) \ |
| 391 V(CONS_STRING_TYPE, \ | 401 V(CONS_STRING_TYPE, \ |
| 392 ConsString::kSize, \ | 402 ConsString::kSize, \ |
| 393 cons_string, \ | 403 cons_string, \ |
| 394 ConsString) \ | 404 ConsString) \ |
| 395 V(CONS_ASCII_STRING_TYPE, \ | 405 V(CONS_ASCII_STRING_TYPE, \ |
| 396 ConsString::kSize, \ | 406 ConsString::kSize, \ |
| 397 cons_ascii_string, \ | 407 cons_ascii_string, \ |
| 398 ConsAsciiString) \ | 408 ConsAsciiString) \ |
| 409 V(SLICED_STRING_TYPE, \ | |
| 410 SlicedString::kSize, \ | |
| 411 sliced_string, \ | |
| 412 SlicedString) \ | |
| 413 V(SLICED_ASCII_STRING_TYPE, \ | |
| 414 SlicedString::kSize, \ | |
| 415 sliced_ascii_string, \ | |
| 416 SlicedAsciiString) \ | |
| 399 V(EXTERNAL_STRING_TYPE, \ | 417 V(EXTERNAL_STRING_TYPE, \ |
| 400 ExternalTwoByteString::kSize, \ | 418 ExternalTwoByteString::kSize, \ |
| 401 external_string, \ | 419 external_string, \ |
| 402 ExternalString) \ | 420 ExternalString) \ |
| 403 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ | 421 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ |
| 404 ExternalTwoByteString::kSize, \ | 422 ExternalTwoByteString::kSize, \ |
| 405 external_string_with_ascii_data, \ | 423 external_string_with_ascii_data, \ |
| 406 ExternalStringWithAsciiData) \ | 424 ExternalStringWithAsciiData) \ |
| 407 V(EXTERNAL_ASCII_STRING_TYPE, \ | 425 V(EXTERNAL_ASCII_STRING_TYPE, \ |
| 408 ExternalAsciiString::kSize, \ | 426 ExternalAsciiString::kSize, \ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 const uint32_t kStringEncodingMask = 0x4; | 480 const uint32_t kStringEncodingMask = 0x4; |
| 463 const uint32_t kTwoByteStringTag = 0x0; | 481 const uint32_t kTwoByteStringTag = 0x0; |
| 464 const uint32_t kAsciiStringTag = 0x4; | 482 const uint32_t kAsciiStringTag = 0x4; |
| 465 | 483 |
| 466 // If bit 7 is clear, the low-order 2 bits indicate the representation | 484 // If bit 7 is clear, the low-order 2 bits indicate the representation |
| 467 // of the string. | 485 // of the string. |
| 468 const uint32_t kStringRepresentationMask = 0x03; | 486 const uint32_t kStringRepresentationMask = 0x03; |
| 469 enum StringRepresentationTag { | 487 enum StringRepresentationTag { |
| 470 kSeqStringTag = 0x0, | 488 kSeqStringTag = 0x0, |
| 471 kConsStringTag = 0x1, | 489 kConsStringTag = 0x1, |
| 472 kExternalStringTag = 0x2 | 490 kExternalStringTag = 0x2, |
| 491 kSlicedStringTag = 0x3 | |
| 473 }; | 492 }; |
| 474 const uint32_t kIsConsStringMask = 0x1; | 493 const uint32_t kIsIndirectStringMask = 0x1; |
| 494 const uint32_t kIsIndirectStringTag = 0x1; | |
| 495 STATIC_ASSERT( | |
| 496 (kConsStringTag & kIsIndirectStringMask) == kIsIndirectStringTag); | |
| 497 STATIC_ASSERT( | |
| 498 (kSlicedStringTag & kIsIndirectStringMask) == kIsIndirectStringTag); | |
|
antonm
2011/07/27 14:04:49
sorry, up to you, but I would code it like:
bool
Yang
2011/07/28 15:43:06
There is only one place where this tag is actually
| |
| 475 | 499 |
| 476 // If bit 7 is clear, then bit 3 indicates whether this two-byte | 500 // If bit 7 is clear, then bit 3 indicates whether this two-byte |
| 477 // string actually contains ascii data. | 501 // string actually contains ascii data. |
| 478 const uint32_t kAsciiDataHintMask = 0x08; | 502 const uint32_t kAsciiDataHintMask = 0x08; |
| 479 const uint32_t kAsciiDataHintTag = 0x08; | 503 const uint32_t kAsciiDataHintTag = 0x08; |
| 480 | 504 |
| 481 | 505 |
| 482 // A ConsString with an empty string as the right side is a candidate | 506 // 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 | 507 // 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 | 508 // symbol. It's not common to have non-flat symbols, so we do not |
| 485 // shortcut them thereby avoiding turning symbols into strings. See | 509 // shortcut them thereby avoiding turning symbols into strings. See |
| 486 // heap.cc and mark-compact.cc. | 510 // heap.cc and mark-compact.cc. |
| 487 const uint32_t kShortcutTypeMask = | 511 const uint32_t kShortcutTypeMask = |
| 488 kIsNotStringMask | | 512 kIsNotStringMask | |
| 489 kIsSymbolMask | | 513 kIsSymbolMask | |
| 490 kStringRepresentationMask; | 514 kStringRepresentationMask; |
| 491 const uint32_t kShortcutTypeTag = kConsStringTag; | 515 const uint32_t kShortcutTypeTag = kConsStringTag; |
| 492 | 516 |
| 493 | 517 |
| 494 enum InstanceType { | 518 enum InstanceType { |
| 495 // String types. | 519 // String types. |
| 496 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag, | 520 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag, |
| 497 ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag, | 521 ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag, |
| 498 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag, | 522 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag, |
| 499 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, | 523 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, |
| 524 SLICED_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSlicedStringTag, | |
|
antonm
2011/07/27 14:04:49
Do we want sliced symbols?
Rico
2011/07/28 06:49:50
I am a little concerned about this as well, this c
| |
| 525 SLICED_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSlicedStringTag, | |
| 500 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, | 526 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, |
| 501 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = | 527 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = |
| 502 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, | 528 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, |
| 503 EXTERNAL_ASCII_SYMBOL_TYPE = | 529 EXTERNAL_ASCII_SYMBOL_TYPE = |
| 504 kAsciiStringTag | kSymbolTag | kExternalStringTag, | 530 kAsciiStringTag | kSymbolTag | kExternalStringTag, |
| 505 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, | 531 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, |
| 506 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag, | 532 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag, |
| 507 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, | 533 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, |
| 508 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag, | 534 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag, |
| 535 SLICED_STRING_TYPE = kTwoByteStringTag | kSlicedStringTag, | |
| 536 SLICED_ASCII_STRING_TYPE = kAsciiStringTag | kSlicedStringTag, | |
| 509 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, | 537 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, |
| 510 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = | 538 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = |
| 511 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, | 539 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, |
| 512 // LAST_STRING_TYPE | 540 // LAST_STRING_TYPE |
| 513 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag, | 541 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag, |
| 514 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, | 542 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, |
| 515 | 543 |
| 516 // Objects allocated in their own spaces (never in new space). | 544 // Objects allocated in their own spaces (never in new space). |
| 517 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE | 545 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE |
| 518 CODE_TYPE, | 546 CODE_TYPE, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 702 V(HeapObject) \ | 730 V(HeapObject) \ |
| 703 V(Number) \ | 731 V(Number) \ |
| 704 | 732 |
| 705 #define HEAP_OBJECT_TYPE_LIST(V) \ | 733 #define HEAP_OBJECT_TYPE_LIST(V) \ |
| 706 V(HeapNumber) \ | 734 V(HeapNumber) \ |
| 707 V(String) \ | 735 V(String) \ |
| 708 V(Symbol) \ | 736 V(Symbol) \ |
| 709 V(SeqString) \ | 737 V(SeqString) \ |
| 710 V(ExternalString) \ | 738 V(ExternalString) \ |
| 711 V(ConsString) \ | 739 V(ConsString) \ |
| 740 V(SlicedString) \ | |
| 712 V(ExternalTwoByteString) \ | 741 V(ExternalTwoByteString) \ |
| 713 V(ExternalAsciiString) \ | 742 V(ExternalAsciiString) \ |
| 714 V(SeqTwoByteString) \ | 743 V(SeqTwoByteString) \ |
| 715 V(SeqAsciiString) \ | 744 V(SeqAsciiString) \ |
| 716 \ | 745 \ |
| 717 V(ExternalArray) \ | 746 V(ExternalArray) \ |
| 718 V(ExternalByteArray) \ | 747 V(ExternalByteArray) \ |
| 719 V(ExternalUnsignedByteArray) \ | 748 V(ExternalUnsignedByteArray) \ |
| 720 V(ExternalShortArray) \ | 749 V(ExternalShortArray) \ |
| 721 V(ExternalUnsignedShortArray) \ | 750 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 | 5731 // 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. | 5732 // concrete performance benefit at that particular point in the code. |
| 5704 class StringShape BASE_EMBEDDED { | 5733 class StringShape BASE_EMBEDDED { |
| 5705 public: | 5734 public: |
| 5706 inline explicit StringShape(String* s); | 5735 inline explicit StringShape(String* s); |
| 5707 inline explicit StringShape(Map* s); | 5736 inline explicit StringShape(Map* s); |
| 5708 inline explicit StringShape(InstanceType t); | 5737 inline explicit StringShape(InstanceType t); |
| 5709 inline bool IsSequential(); | 5738 inline bool IsSequential(); |
| 5710 inline bool IsExternal(); | 5739 inline bool IsExternal(); |
| 5711 inline bool IsCons(); | 5740 inline bool IsCons(); |
| 5741 inline bool IsSliced(); | |
| 5712 inline bool IsExternalAscii(); | 5742 inline bool IsExternalAscii(); |
| 5713 inline bool IsExternalTwoByte(); | 5743 inline bool IsExternalTwoByte(); |
| 5714 inline bool IsSequentialAscii(); | 5744 inline bool IsSequentialAscii(); |
| 5715 inline bool IsSequentialTwoByte(); | 5745 inline bool IsSequentialTwoByte(); |
| 5716 inline bool IsSymbol(); | 5746 inline bool IsSymbol(); |
| 5717 inline StringRepresentationTag representation_tag(); | 5747 inline StringRepresentationTag representation_tag(); |
| 5718 inline uint32_t full_representation_tag(); | 5748 inline uint32_t full_representation_tag(); |
| 5719 inline uint32_t size_tag(); | 5749 inline uint32_t size_tag(); |
| 5720 #ifdef DEBUG | 5750 #ifdef DEBUG |
| 5721 inline uint32_t type() { return type_; } | 5751 inline uint32_t type() { return type_; } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5874 #ifdef OBJECT_PRINT | 5904 #ifdef OBJECT_PRINT |
| 5875 inline void StringPrint() { | 5905 inline void StringPrint() { |
| 5876 StringPrint(stdout); | 5906 StringPrint(stdout); |
| 5877 } | 5907 } |
| 5878 void StringPrint(FILE* out); | 5908 void StringPrint(FILE* out); |
| 5879 #endif | 5909 #endif |
| 5880 #ifdef DEBUG | 5910 #ifdef DEBUG |
| 5881 void StringVerify(); | 5911 void StringVerify(); |
| 5882 #endif | 5912 #endif |
| 5883 inline bool IsFlat(); | 5913 inline bool IsFlat(); |
| 5914 inline bool IsIndirect(); | |
| 5884 | 5915 |
| 5885 // Layout description. | 5916 // Layout description. |
| 5886 static const int kLengthOffset = HeapObject::kHeaderSize; | 5917 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 5887 static const int kHashFieldOffset = kLengthOffset + kPointerSize; | 5918 static const int kHashFieldOffset = kLengthOffset + kPointerSize; |
| 5888 static const int kSize = kHashFieldOffset + kPointerSize; | 5919 static const int kSize = kHashFieldOffset + kPointerSize; |
| 5889 | 5920 |
| 5890 // Maximum number of characters to consider when trying to convert a string | 5921 // Maximum number of characters to consider when trying to convert a string |
| 5891 // value into an array index. | 5922 // value into an array index. |
| 5892 static const int kMaxArrayIndexSize = 10; | 5923 static const int kMaxArrayIndexSize = 10; |
| 5893 | 5924 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6221 static const int kMinLength = 13; | 6252 static const int kMinLength = 13; |
| 6222 | 6253 |
| 6223 typedef FixedBodyDescriptor<kFirstOffset, kSecondOffset + kPointerSize, kSize> | 6254 typedef FixedBodyDescriptor<kFirstOffset, kSecondOffset + kPointerSize, kSize> |
| 6224 BodyDescriptor; | 6255 BodyDescriptor; |
| 6225 | 6256 |
| 6226 private: | 6257 private: |
| 6227 DISALLOW_IMPLICIT_CONSTRUCTORS(ConsString); | 6258 DISALLOW_IMPLICIT_CONSTRUCTORS(ConsString); |
| 6228 }; | 6259 }; |
| 6229 | 6260 |
| 6230 | 6261 |
| 6262 class SlicedString: public String { | |
| 6263 public: | |
| 6264 | |
| 6265 inline String* parent(); | |
| 6266 inline void set_parent(String* parent); | |
| 6267 inline int offset(); | |
| 6268 inline void set_offset(int offset); | |
| 6269 | |
| 6270 // Dispatched behavior. | |
| 6271 uint16_t SlicedStringGet(int index); | |
| 6272 | |
| 6273 // Casting. | |
| 6274 static inline SlicedString* cast(Object* obj); | |
| 6275 | |
| 6276 // Layout description. | |
| 6277 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize); | |
| 6278 static const int kOffsetOffset = kParentOffset + kPointerSize; | |
| 6279 static const int kSize = kOffsetOffset + kPointerSize; | |
| 6280 | |
| 6281 // Support for StringInputBuffer | |
| 6282 inline const unibrow::byte* SlicedStringReadBlock(ReadBlockBuffer* buffer, | |
| 6283 unsigned* offset_ptr, | |
| 6284 unsigned chars); | |
| 6285 inline void SlicedStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | |
| 6286 unsigned* offset_ptr, | |
| 6287 unsigned chars); | |
| 6288 // Minimum length for a sliced string. | |
| 6289 static const int kMinLength = 13; | |
| 6290 | |
| 6291 typedef FixedBodyDescriptor<kParentOffset, | |
| 6292 kOffsetOffset + kPointerSize, kSize> | |
| 6293 BodyDescriptor; | |
| 6294 | |
| 6295 private: | |
| 6296 DISALLOW_IMPLICIT_CONSTRUCTORS(SlicedString); | |
| 6297 }; | |
| 6298 | |
| 6299 | |
| 6231 // The ExternalString class describes string values that are backed by | 6300 // The ExternalString class describes string values that are backed by |
| 6232 // a string resource that lies outside the V8 heap. ExternalStrings | 6301 // a string resource that lies outside the V8 heap. ExternalStrings |
| 6233 // consist of the length field common to all strings, a pointer to the | 6302 // consist of the length field common to all strings, a pointer to the |
| 6234 // external resource. It is important to ensure (externally) that the | 6303 // external resource. It is important to ensure (externally) that the |
| 6235 // resource is not deallocated while the ExternalString is live in the | 6304 // resource is not deallocated while the ExternalString is live in the |
| 6236 // V8 heap. | 6305 // V8 heap. |
| 6237 // | 6306 // |
| 6238 // The API expects that all ExternalStrings are created through the | 6307 // The API expects that all ExternalStrings are created through the |
| 6239 // API. Therefore, ExternalStrings should not be used internally. | 6308 // API. Therefore, ExternalStrings should not be used internally. |
| 6240 class ExternalString: public String { | 6309 class ExternalString: public String { |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7203 } else { | 7272 } else { |
| 7204 value &= ~(1 << bit_position); | 7273 value &= ~(1 << bit_position); |
| 7205 } | 7274 } |
| 7206 return value; | 7275 return value; |
| 7207 } | 7276 } |
| 7208 }; | 7277 }; |
| 7209 | 7278 |
| 7210 } } // namespace v8::internal | 7279 } } // namespace v8::internal |
| 7211 | 7280 |
| 7212 #endif // V8_OBJECTS_H_ | 7281 #endif // V8_OBJECTS_H_ |
| OLD | NEW |