Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: src/objects.h

Issue 8568013: Introduce read buffer for external strings when using charAt (ia32). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 V(EXTERNAL_ASCII_SYMBOL_TYPE) \ 234 V(EXTERNAL_ASCII_SYMBOL_TYPE) \
235 V(STRING_TYPE) \ 235 V(STRING_TYPE) \
236 V(ASCII_STRING_TYPE) \ 236 V(ASCII_STRING_TYPE) \
237 V(CONS_STRING_TYPE) \ 237 V(CONS_STRING_TYPE) \
238 V(CONS_ASCII_STRING_TYPE) \ 238 V(CONS_ASCII_STRING_TYPE) \
239 V(SLICED_STRING_TYPE) \ 239 V(SLICED_STRING_TYPE) \
240 V(EXTERNAL_STRING_TYPE) \ 240 V(EXTERNAL_STRING_TYPE) \
241 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ 241 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \
242 V(EXTERNAL_ASCII_STRING_TYPE) \ 242 V(EXTERNAL_ASCII_STRING_TYPE) \
243 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ 243 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \
244 \ 244 V(EXTERNAL_BUFFERED_STRING_TYPE) \
245 V(EXTERNAL_BUFFERED_STRING_WITH_ASCII_DATA_TYPE) \
246 V(EXTERNAL_BUFFERED_ASCII_STRING_TYPE) \
245 V(MAP_TYPE) \ 247 V(MAP_TYPE) \
246 V(CODE_TYPE) \ 248 V(CODE_TYPE) \
247 V(ODDBALL_TYPE) \ 249 V(ODDBALL_TYPE) \
248 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ 250 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \
249 \ 251 \
250 V(HEAP_NUMBER_TYPE) \ 252 V(HEAP_NUMBER_TYPE) \
251 V(FOREIGN_TYPE) \ 253 V(FOREIGN_TYPE) \
252 V(BYTE_ARRAY_TYPE) \ 254 V(BYTE_ARRAY_TYPE) \
253 V(FREE_SPACE_TYPE) \ 255 V(FREE_SPACE_TYPE) \
254 /* Note: the order of these external array */ \ 256 /* Note: the order of these external array */ \
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 ExternalTwoByteString::kSize, \ 370 ExternalTwoByteString::kSize, \
369 external_string, \ 371 external_string, \
370 ExternalString) \ 372 ExternalString) \
371 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ 373 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \
372 ExternalTwoByteString::kSize, \ 374 ExternalTwoByteString::kSize, \
373 external_string_with_ascii_data, \ 375 external_string_with_ascii_data, \
374 ExternalStringWithAsciiData) \ 376 ExternalStringWithAsciiData) \
375 V(EXTERNAL_ASCII_STRING_TYPE, \ 377 V(EXTERNAL_ASCII_STRING_TYPE, \
376 ExternalAsciiString::kSize, \ 378 ExternalAsciiString::kSize, \
377 external_ascii_string, \ 379 external_ascii_string, \
378 ExternalAsciiString) 380 ExternalAsciiString) \
381 V(EXTERNAL_BUFFERED_SYMBOL_TYPE, \
382 ExternalTwoByteString::kExtendedSize, \
383 external_buffered_symbol, \
384 ExternalBufferedSymbol) \
385 V(EXTERNAL_BUFFERED_SYMBOL_WITH_ASCII_DATA_TYPE, \
386 ExternalTwoByteString::kExtendedSize, \
387 external_buffered_symbol_with_ascii_data, \
388 ExternalBufferedSymbolWithAsciiData) \
389 V(EXTERNAL_BUFFERED_ASCII_SYMBOL_TYPE, \
390 ExternalAsciiString::kExtendedSize, \
391 external_buffered_ascii_symbol, \
392 ExternalBufferedAsciiSymbol) \
393 V(EXTERNAL_BUFFERED_STRING_TYPE, \
394 ExternalTwoByteString::kExtendedSize, \
395 external_buffered_string, \
396 ExternalBufferedString) \
397 V(EXTERNAL_BUFFERED_STRING_WITH_ASCII_DATA_TYPE, \
398 ExternalTwoByteString::kExtendedSize, \
399 external_buffered_string_with_ascii_data, \
400 ExternalBufferedStringWithAsciiData) \
401 V(EXTERNAL_BUFFERED_ASCII_STRING_TYPE, \
402 ExternalAsciiString::kExtendedSize, \
403 external_buffered_ascii_string, \
404 ExternalBufferedAsciiString)
379 405
380 // A struct is a simple object a set of object-valued fields. Including an 406 // A struct is a simple object a set of object-valued fields. Including an
381 // object type in this causes the compiler to generate most of the boilerplate 407 // object type in this causes the compiler to generate most of the boilerplate
382 // code for the class including allocation and garbage collection routines, 408 // code for the class including allocation and garbage collection routines,
383 // casts and predicates. All you need to define is the class, methods and 409 // casts and predicates. All you need to define is the class, methods and
384 // object verification routines. Easy, no? 410 // object verification routines. Easy, no?
385 // 411 //
386 // Note that for subtle reasons related to the ordering or numerical values of 412 // Note that for subtle reasons related to the ordering or numerical values of
387 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST 413 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST
388 // manually. 414 // manually.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // Use this mask to distinguish between cons and slice only after making 478 // Use this mask to distinguish between cons and slice only after making
453 // sure that the string is one of the two (an indirect string). 479 // sure that the string is one of the two (an indirect string).
454 const uint32_t kSlicedNotConsMask = kSlicedStringTag & ~kConsStringTag; 480 const uint32_t kSlicedNotConsMask = kSlicedStringTag & ~kConsStringTag;
455 STATIC_ASSERT(IS_POWER_OF_TWO(kSlicedNotConsMask) && kSlicedNotConsMask != 0); 481 STATIC_ASSERT(IS_POWER_OF_TWO(kSlicedNotConsMask) && kSlicedNotConsMask != 0);
456 482
457 // If bit 7 is clear, then bit 3 indicates whether this two-byte 483 // If bit 7 is clear, then bit 3 indicates whether this two-byte
458 // string actually contains ascii data. 484 // string actually contains ascii data.
459 const uint32_t kAsciiDataHintMask = 0x08; 485 const uint32_t kAsciiDataHintMask = 0x08;
460 const uint32_t kAsciiDataHintTag = 0x08; 486 const uint32_t kAsciiDataHintTag = 0x08;
461 487
488 // In the case of external string, bit 4 indicates whether it has a buffer.
489 const uint32_t kBufferedStringMask = 0x10;
490 const uint32_t kBufferedStringTag = 0x10;
462 491
463 // A ConsString with an empty string as the right side is a candidate 492 // A ConsString with an empty string as the right side is a candidate
464 // for being shortcut by the garbage collector unless it is a 493 // for being shortcut by the garbage collector unless it is a
465 // symbol. It's not common to have non-flat symbols, so we do not 494 // symbol. It's not common to have non-flat symbols, so we do not
466 // shortcut them thereby avoiding turning symbols into strings. See 495 // shortcut them thereby avoiding turning symbols into strings. See
467 // heap.cc and mark-compact.cc. 496 // heap.cc and mark-compact.cc.
468 const uint32_t kShortcutTypeMask = 497 const uint32_t kShortcutTypeMask =
469 kIsNotStringMask | 498 kIsNotStringMask |
470 kIsSymbolMask | 499 kIsSymbolMask |
471 kStringRepresentationMask; 500 kStringRepresentationMask;
(...skipping 13 matching lines...) Expand all
485 kAsciiStringTag | kSymbolTag | kExternalStringTag, 514 kAsciiStringTag | kSymbolTag | kExternalStringTag,
486 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, 515 STRING_TYPE = kTwoByteStringTag | kSeqStringTag,
487 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag, 516 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag,
488 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, 517 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag,
489 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag, 518 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag,
490 SLICED_STRING_TYPE = kTwoByteStringTag | kSlicedStringTag, 519 SLICED_STRING_TYPE = kTwoByteStringTag | kSlicedStringTag,
491 SLICED_ASCII_STRING_TYPE = kAsciiStringTag | kSlicedStringTag, 520 SLICED_ASCII_STRING_TYPE = kAsciiStringTag | kSlicedStringTag,
492 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, 521 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag,
493 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = 522 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE =
494 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, 523 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag,
495 // LAST_STRING_TYPE
496 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag, 524 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag,
497 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, 525 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE,
526 EXTERNAL_BUFFERED_SYMBOL_TYPE =
527 kTwoByteStringTag | kExternalStringTag |
528 kBufferedStringTag | kSymbolTag,
529 EXTERNAL_BUFFERED_SYMBOL_WITH_ASCII_DATA_TYPE =
530 kTwoByteStringTag | kExternalStringTag |
531 kAsciiDataHintTag | kBufferedStringTag | kSymbolTag,
532 // LAST_STRING_TYPE
533 EXTERNAL_BUFFERED_ASCII_SYMBOL_TYPE =
534 kAsciiStringTag | kExternalStringTag |
535 kBufferedStringTag | kSymbolTag,
536 EXTERNAL_BUFFERED_STRING_TYPE =
537 kTwoByteStringTag | kExternalStringTag | kBufferedStringTag,
538 EXTERNAL_BUFFERED_STRING_WITH_ASCII_DATA_TYPE =
539 kTwoByteStringTag | kExternalStringTag |
540 kAsciiDataHintTag | kBufferedStringTag,
541 // LAST_STRING_TYPE
542 EXTERNAL_BUFFERED_ASCII_STRING_TYPE =
543 kAsciiStringTag | kExternalStringTag | kBufferedStringTag,
544
498 545
499 // Objects allocated in their own spaces (never in new space). 546 // Objects allocated in their own spaces (never in new space).
500 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE 547 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE
501 CODE_TYPE, 548 CODE_TYPE,
502 ODDBALL_TYPE, 549 ODDBALL_TYPE,
503 JS_GLOBAL_PROPERTY_CELL_TYPE, 550 JS_GLOBAL_PROPERTY_CELL_TYPE,
504 551
505 // "Data", objects that cannot contain non-map-word pointers to heap 552 // "Data", objects that cannot contain non-map-word pointers to heap
506 // objects. 553 // objects.
507 HEAP_NUMBER_TYPE, 554 HEAP_NUMBER_TYPE,
(...skipping 5700 matching lines...) Expand 10 before | Expand all | Expand 10 after
6208 // Cons and slices have an encoding flag that may not represent the actual 6255 // Cons and slices have an encoding flag that may not represent the actual
6209 // encoding of the underlying string. This is taken into account here. 6256 // encoding of the underlying string. This is taken into account here.
6210 // Requires: this->IsFlat() 6257 // Requires: this->IsFlat()
6211 inline bool IsAsciiRepresentationUnderneath(); 6258 inline bool IsAsciiRepresentationUnderneath();
6212 inline bool IsTwoByteRepresentationUnderneath(); 6259 inline bool IsTwoByteRepresentationUnderneath();
6213 6260
6214 // NOTE: this should be considered only a hint. False negatives are 6261 // NOTE: this should be considered only a hint. False negatives are
6215 // possible. 6262 // possible.
6216 inline bool HasOnlyAsciiChars(); 6263 inline bool HasOnlyAsciiChars();
6217 6264
6265 enum ExternalStringBufferFlag {
6266 IGNORE_EXTERNAL_STRING_BUFFER,
6267 UPDATE_EXTERNAL_STRING_BUFFER
6268 };
6269
6218 // Get and set individual two byte chars in the string. 6270 // Get and set individual two byte chars in the string.
6219 inline void Set(int index, uint16_t value); 6271 inline void Set(int index, uint16_t value);
6220 // Get individual two byte char in the string. Repeated calls 6272 // Get individual two byte char in the string. Repeated calls
6221 // to this method are not efficient unless the string is flat. 6273 // to this method are not efficient unless the string is flat.
6222 inline uint16_t Get(int index); 6274 inline uint16_t Get(
6275 int index, ExternalStringBufferFlag flag = IGNORE_EXTERNAL_STRING_BUFFER);
6223 6276
6224 // Try to flatten the string. Checks first inline to see if it is 6277 // Try to flatten the string. Checks first inline to see if it is
6225 // necessary. Does nothing if the string is not a cons string. 6278 // necessary. Does nothing if the string is not a cons string.
6226 // Flattening allocates a sequential string with the same data as 6279 // Flattening allocates a sequential string with the same data as
6227 // the given string and mutates the cons string to a degenerate 6280 // the given string and mutates the cons string to a degenerate
6228 // form, where the first component is the new sequential string and 6281 // form, where the first component is the new sequential string and
6229 // the second component is the empty string. If allocation fails, 6282 // the second component is the empty string. If allocation fails,
6230 // this function returns a failure. If flattening succeeds, this 6283 // this function returns a failure. If flattening succeeds, this
6231 // function returns the sequential string that is now the first 6284 // function returns the sequential string that is now the first
6232 // component of the cons string. 6285 // component of the cons string.
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
6647 6700
6648 // Second string of the cons cell. 6701 // Second string of the cons cell.
6649 inline String* second(); 6702 inline String* second();
6650 // Doesn't check that the result is a string, even in debug mode. This is 6703 // Doesn't check that the result is a string, even in debug mode. This is
6651 // useful during GC where the mark bits confuse the checks. 6704 // useful during GC where the mark bits confuse the checks.
6652 inline Object* unchecked_second(); 6705 inline Object* unchecked_second();
6653 inline void set_second(String* second, 6706 inline void set_second(String* second,
6654 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 6707 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
6655 6708
6656 // Dispatched behavior. 6709 // Dispatched behavior.
6657 uint16_t ConsStringGet(int index); 6710 uint16_t ConsStringGet(
6711 int index, ExternalStringBufferFlag flag = IGNORE_EXTERNAL_STRING_BUFFER);
6658 6712
6659 // Casting. 6713 // Casting.
6660 static inline ConsString* cast(Object* obj); 6714 static inline ConsString* cast(Object* obj);
6661 6715
6662 // Layout description. 6716 // Layout description.
6663 static const int kFirstOffset = POINTER_SIZE_ALIGN(String::kSize); 6717 static const int kFirstOffset = POINTER_SIZE_ALIGN(String::kSize);
6664 static const int kSecondOffset = kFirstOffset + kPointerSize; 6718 static const int kSecondOffset = kFirstOffset + kPointerSize;
6665 static const int kSize = kSecondOffset + kPointerSize; 6719 static const int kSize = kSecondOffset + kPointerSize;
6666 6720
6667 // Support for StringInputBuffer. 6721 // Support for StringInputBuffer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
6700 // - external strings as parent 6754 // - external strings as parent
6701 // - truncating sliced string to enable otherwise unneeded parent to be GC'ed. 6755 // - truncating sliced string to enable otherwise unneeded parent to be GC'ed.
6702 class SlicedString: public String { 6756 class SlicedString: public String {
6703 public: 6757 public:
6704 inline String* parent(); 6758 inline String* parent();
6705 inline void set_parent(String* parent); 6759 inline void set_parent(String* parent);
6706 inline int offset(); 6760 inline int offset();
6707 inline void set_offset(int offset); 6761 inline void set_offset(int offset);
6708 6762
6709 // Dispatched behavior. 6763 // Dispatched behavior.
6710 uint16_t SlicedStringGet(int index); 6764 uint16_t SlicedStringGet(
6765 int index, ExternalStringBufferFlag flag = IGNORE_EXTERNAL_STRING_BUFFER);
6711 6766
6712 // Casting. 6767 // Casting.
6713 static inline SlicedString* cast(Object* obj); 6768 static inline SlicedString* cast(Object* obj);
6714 6769
6715 // Layout description. 6770 // Layout description.
6716 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize); 6771 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize);
6717 static const int kOffsetOffset = kParentOffset + kPointerSize; 6772 static const int kOffsetOffset = kParentOffset + kPointerSize;
6718 static const int kSize = kOffsetOffset + kPointerSize; 6773 static const int kSize = kOffsetOffset + kPointerSize;
6719 6774
6720 // Support for StringInputBuffer 6775 // Support for StringInputBuffer
(...skipping 26 matching lines...) Expand all
6747 // resource is not deallocated while the ExternalString is live in the 6802 // resource is not deallocated while the ExternalString is live in the
6748 // V8 heap. 6803 // V8 heap.
6749 // 6804 //
6750 // The API expects that all ExternalStrings are created through the 6805 // The API expects that all ExternalStrings are created through the
6751 // API. Therefore, ExternalStrings should not be used internally. 6806 // API. Therefore, ExternalStrings should not be used internally.
6752 class ExternalString: public String { 6807 class ExternalString: public String {
6753 public: 6808 public:
6754 // Casting 6809 // Casting
6755 static inline ExternalString* cast(Object* obj); 6810 static inline ExternalString* cast(Object* obj);
6756 6811
6812 // Read-ahead buffer.
6813 inline Address buffer();
6814 inline int buffer_index();
6815 inline void set_buffer_index(int index);
6816 inline bool IsBuffered();
6817
6757 // Layout description. 6818 // Layout description.
6758 static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize); 6819 static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize);
6759 static const int kSize = kResourceOffset + kPointerSize; 6820 static const int kSize = kResourceOffset + kPointerSize;
6760 6821
6822 // Long external strings have a read-ahead buffer attached.
6823 static const int kBufferIndexOffset = kSize;
6824 static const int kBufferContentOffset = kBufferIndexOffset + kPointerSize;
6825
6826 static const int kBufferSize = 11 * kPointerSize;
6827 static const int kExtendedSize = kBufferContentOffset + kBufferSize;
6828 static const int kMinBufferedStringLength = 256;
6829 static const int kInvalidBufferIndex = String::kMaxLength;
6830
6761 STATIC_CHECK(kResourceOffset == Internals::kStringResourceOffset); 6831 STATIC_CHECK(kResourceOffset == Internals::kStringResourceOffset);
6762 6832
6833 #ifdef DEBUG
6834 void ExternalStringVerify();
6835 #endif
6836
6763 private: 6837 private:
6764 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); 6838 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString);
6765 }; 6839 };
6766 6840
6767 6841
6768 // The ExternalAsciiString class is an external string backed by an 6842 // The ExternalAsciiString class is an external string backed by an
6769 // ASCII string. 6843 // ASCII string.
6770 class ExternalAsciiString: public ExternalString { 6844 class ExternalAsciiString: public ExternalString {
6771 public: 6845 public:
6772 static const bool kHasAsciiEncoding = true; 6846 static const bool kHasAsciiEncoding = true;
6773 6847
6848 static const int kBufferedChars = kBufferSize / kASCIISize;
6849 static const int kBackwardBufferedChars = kBufferedChars >> 2;
6850 static const int kForwardBufferedChars =
6851 kBufferedChars - kBackwardBufferedChars;
6852
6774 typedef v8::String::ExternalAsciiStringResource Resource; 6853 typedef v8::String::ExternalAsciiStringResource Resource;
6775 6854
6776 // The underlying resource. 6855 // The underlying resource.
6777 inline const Resource* resource(); 6856 inline const Resource* resource();
6778 inline void set_resource(const Resource* buffer); 6857 inline void set_resource(const Resource* buffer);
6779 6858
6780 // Dispatched behavior. 6859 // Dispatched behavior.
6781 uint16_t ExternalAsciiStringGet(int index); 6860 uint16_t ExternalAsciiStringGet(
6861 int index, ExternalStringBufferFlag flag = IGNORE_EXTERNAL_STRING_BUFFER);
6782 6862
6783 // Casting. 6863 // Casting.
6784 static inline ExternalAsciiString* cast(Object* obj); 6864 static inline ExternalAsciiString* cast(Object* obj);
6785 6865
6786 // Garbage collection support. 6866 // Garbage collection support.
6787 inline void ExternalAsciiStringIterateBody(ObjectVisitor* v); 6867 inline void ExternalAsciiStringIterateBody(ObjectVisitor* v);
6788 6868
6789 template<typename StaticVisitor> 6869 template<typename StaticVisitor>
6790 inline void ExternalAsciiStringIterateBody(); 6870 inline void ExternalAsciiStringIterateBody();
6791 6871
6792 // Support for StringInputBuffer. 6872 // Support for StringInputBuffer.
6793 const unibrow::byte* ExternalAsciiStringReadBlock(unsigned* remaining, 6873 const unibrow::byte* ExternalAsciiStringReadBlock(unsigned* remaining,
6794 unsigned* offset, 6874 unsigned* offset,
6795 unsigned chars); 6875 unsigned chars);
6796 inline void ExternalAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, 6876 inline void ExternalAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer,
6797 unsigned* offset, 6877 unsigned* offset,
6798 unsigned chars); 6878 unsigned chars);
6799 6879
6800 private: 6880 private:
6801 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); 6881 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString);
6802 }; 6882 };
6803 6883
6804 6884
6805 // The ExternalTwoByteString class is an external string backed by a UTF-16 6885 // The ExternalTwoByteString class is an external string backed by a UTF-16
6806 // encoded string. 6886 // encoded string.
6807 class ExternalTwoByteString: public ExternalString { 6887 class ExternalTwoByteString: public ExternalString {
6808 public: 6888 public:
6809 static const bool kHasAsciiEncoding = false; 6889 static const bool kHasAsciiEncoding = false;
6810 6890
6891 static const int kBufferedChars = kBufferSize / kUC16Size;
6892 static const int kBackwardBufferedChars = kBufferedChars >> 2;
6893 static const int kForwardBufferedChars =
6894 kBufferedChars - kBackwardBufferedChars;
6895
6811 typedef v8::String::ExternalStringResource Resource; 6896 typedef v8::String::ExternalStringResource Resource;
6812 6897
6813 // The underlying string resource. 6898 // The underlying string resource.
6814 inline const Resource* resource(); 6899 inline const Resource* resource();
6815 inline void set_resource(const Resource* buffer); 6900 inline void set_resource(const Resource* buffer);
6816 6901
6817 // Dispatched behavior. 6902 // Dispatched behavior.
6818 uint16_t ExternalTwoByteStringGet(int index); 6903 uint16_t ExternalTwoByteStringGet(
6904 int index, ExternalStringBufferFlag flag = IGNORE_EXTERNAL_STRING_BUFFER);
6819 6905
6820 // For regexp code. 6906 // For regexp code.
6821 const uint16_t* ExternalTwoByteStringGetData(unsigned start); 6907 const uint16_t* ExternalTwoByteStringGetData(unsigned start);
6822 6908
6823 // Casting. 6909 // Casting.
6824 static inline ExternalTwoByteString* cast(Object* obj); 6910 static inline ExternalTwoByteString* cast(Object* obj);
6825 6911
6826 // Garbage collection support. 6912 // Garbage collection support.
6827 inline void ExternalTwoByteStringIterateBody(ObjectVisitor* v); 6913 inline void ExternalTwoByteStringIterateBody(ObjectVisitor* v);
6828 6914
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
7876 } else { 7962 } else {
7877 value &= ~(1 << bit_position); 7963 value &= ~(1 << bit_position);
7878 } 7964 }
7879 return value; 7965 return value;
7880 } 7966 }
7881 }; 7967 };
7882 7968
7883 } } // namespace v8::internal 7969 } } // namespace v8::internal
7884 7970
7885 #endif // V8_OBJECTS_H_ 7971 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698