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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 int len = length(); | 882 int len = length(); |
883 Object* object; | 883 Object* object; |
884 String* result; | 884 String* result; |
885 if (IsAsciiRepresentation()) { | 885 if (IsAsciiRepresentation()) { |
886 { MaybeObject* maybe_object = heap->AllocateRawAsciiString(len, tenure); | 886 { MaybeObject* maybe_object = heap->AllocateRawAsciiString(len, tenure); |
887 if (!maybe_object->ToObject(&object)) return maybe_object; | 887 if (!maybe_object->ToObject(&object)) return maybe_object; |
888 } | 888 } |
889 result = String::cast(object); | 889 result = String::cast(object); |
890 String* first = cs->first(); | 890 String* first = cs->first(); |
891 int first_length = first->length(); | 891 int first_length = first->length(); |
892 char* dest = SeqAsciiString::cast(result)->GetChars(); | 892 char* dest = SeqOneByteString::cast(result)->GetChars(); |
893 WriteToFlat(first, dest, 0, first_length); | 893 WriteToFlat(first, dest, 0, first_length); |
894 String* second = cs->second(); | 894 String* second = cs->second(); |
895 WriteToFlat(second, | 895 WriteToFlat(second, |
896 dest + first_length, | 896 dest + first_length, |
897 0, | 897 0, |
898 len - first_length); | 898 len - first_length); |
899 } else { | 899 } else { |
900 { MaybeObject* maybe_object = | 900 { MaybeObject* maybe_object = |
901 heap->AllocateRawTwoByteString(len, tenure); | 901 heap->AllocateRawTwoByteString(len, tenure); |
902 if (!maybe_object->ToObject(&object)) return maybe_object; | 902 if (!maybe_object->ToObject(&object)) return maybe_object; |
(...skipping 5602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6505 SlicedString* slice = SlicedString::cast(string); | 6505 SlicedString* slice = SlicedString::cast(string); |
6506 offset = slice->offset(); | 6506 offset = slice->offset(); |
6507 string = slice->parent(); | 6507 string = slice->parent(); |
6508 shape = StringShape(string); | 6508 shape = StringShape(string); |
6509 ASSERT(shape.representation_tag() != kConsStringTag && | 6509 ASSERT(shape.representation_tag() != kConsStringTag && |
6510 shape.representation_tag() != kSlicedStringTag); | 6510 shape.representation_tag() != kSlicedStringTag); |
6511 } | 6511 } |
6512 if (shape.encoding_tag() == kOneByteStringTag) { | 6512 if (shape.encoding_tag() == kOneByteStringTag) { |
6513 const char* start; | 6513 const char* start; |
6514 if (shape.representation_tag() == kSeqStringTag) { | 6514 if (shape.representation_tag() == kSeqStringTag) { |
6515 start = SeqAsciiString::cast(string)->GetChars(); | 6515 start = SeqOneByteString::cast(string)->GetChars(); |
6516 } else { | 6516 } else { |
6517 start = ExternalAsciiString::cast(string)->GetChars(); | 6517 start = ExternalAsciiString::cast(string)->GetChars(); |
6518 } | 6518 } |
6519 return FlatContent(Vector<const char>(start + offset, length)); | 6519 return FlatContent(Vector<const char>(start + offset, length)); |
6520 } else { | 6520 } else { |
6521 ASSERT(shape.encoding_tag() == kTwoByteStringTag); | 6521 ASSERT(shape.encoding_tag() == kTwoByteStringTag); |
6522 const uc16* start; | 6522 const uc16* start; |
6523 if (shape.representation_tag() == kSeqStringTag) { | 6523 if (shape.representation_tag() == kSeqStringTag) { |
6524 start = SeqTwoByteString::cast(string)->GetChars(); | 6524 start = SeqTwoByteString::cast(string)->GetChars(); |
6525 } else { | 6525 } else { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6669 } | 6669 } |
6670 } | 6670 } |
6671 offset++; | 6671 offset++; |
6672 chars_read++; | 6672 chars_read++; |
6673 } | 6673 } |
6674 *offset_ptr = offset; | 6674 *offset_ptr = offset; |
6675 rbb->remaining += chars_read; | 6675 rbb->remaining += chars_read; |
6676 } | 6676 } |
6677 | 6677 |
6678 | 6678 |
6679 const unibrow::byte* SeqAsciiString::SeqAsciiStringReadBlock( | 6679 const unibrow::byte* SeqOneByteString::SeqOneByteStringReadBlock( |
6680 unsigned* remaining, | 6680 unsigned* remaining, |
6681 unsigned* offset_ptr, | 6681 unsigned* offset_ptr, |
6682 unsigned max_chars) { | 6682 unsigned max_chars) { |
6683 const unibrow::byte* b = reinterpret_cast<unibrow::byte*>(this) - | 6683 const unibrow::byte* b = reinterpret_cast<unibrow::byte*>(this) - |
6684 kHeapObjectTag + kHeaderSize + *offset_ptr * kCharSize; | 6684 kHeapObjectTag + kHeaderSize + *offset_ptr * kCharSize; |
6685 *remaining = max_chars; | 6685 *remaining = max_chars; |
6686 *offset_ptr += max_chars; | 6686 *offset_ptr += max_chars; |
6687 return b; | 6687 return b; |
6688 } | 6688 } |
6689 | 6689 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6797 break; | 6797 break; |
6798 } | 6798 } |
6799 offset++; | 6799 offset++; |
6800 chars_read++; | 6800 chars_read++; |
6801 } | 6801 } |
6802 *offset_ptr = offset; | 6802 *offset_ptr = offset; |
6803 rbb->remaining += chars_read; | 6803 rbb->remaining += chars_read; |
6804 } | 6804 } |
6805 | 6805 |
6806 | 6806 |
6807 void SeqAsciiString::SeqAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* rbb, | 6807 void SeqOneByteString::SeqOneByteStringReadBlockIntoBuffer(ReadBlockBuffer* rbb, |
6808 unsigned* offset_ptr, | 6808 unsigned* offset_ptr, |
6809 unsigned max_chars) { | 6809 unsigned max_chars) { |
6810 unsigned capacity = rbb->capacity - rbb->cursor; | 6810 unsigned capacity = rbb->capacity - rbb->cursor; |
6811 if (max_chars > capacity) max_chars = capacity; | 6811 if (max_chars > capacity) max_chars = capacity; |
6812 memcpy(rbb->util_buffer + rbb->cursor, | 6812 memcpy(rbb->util_buffer + rbb->cursor, |
6813 reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize + | 6813 reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize + |
6814 *offset_ptr * kCharSize, | 6814 *offset_ptr * kCharSize, |
6815 max_chars); | 6815 max_chars); |
6816 rbb->remaining += max_chars; | 6816 rbb->remaining += max_chars; |
6817 *offset_ptr += max_chars; | 6817 *offset_ptr += max_chars; |
(...skipping 23 matching lines...) Expand all Loading... |
6841 unsigned* offset_ptr, | 6841 unsigned* offset_ptr, |
6842 unsigned max_chars) { | 6842 unsigned max_chars) { |
6843 ASSERT(*offset_ptr <= static_cast<unsigned>(input->length())); | 6843 ASSERT(*offset_ptr <= static_cast<unsigned>(input->length())); |
6844 if (max_chars == 0) { | 6844 if (max_chars == 0) { |
6845 rbb->remaining = 0; | 6845 rbb->remaining = 0; |
6846 return NULL; | 6846 return NULL; |
6847 } | 6847 } |
6848 switch (StringShape(input).representation_tag()) { | 6848 switch (StringShape(input).representation_tag()) { |
6849 case kSeqStringTag: | 6849 case kSeqStringTag: |
6850 if (input->IsAsciiRepresentation()) { | 6850 if (input->IsAsciiRepresentation()) { |
6851 SeqAsciiString* str = SeqAsciiString::cast(input); | 6851 SeqOneByteString* str = SeqOneByteString::cast(input); |
6852 return str->SeqAsciiStringReadBlock(&rbb->remaining, | 6852 return str->SeqOneByteStringReadBlock(&rbb->remaining, |
6853 offset_ptr, | 6853 offset_ptr, |
6854 max_chars); | 6854 max_chars); |
6855 } else { | 6855 } else { |
6856 SeqTwoByteString* str = SeqTwoByteString::cast(input); | 6856 SeqTwoByteString* str = SeqTwoByteString::cast(input); |
6857 str->SeqTwoByteStringReadBlockIntoBuffer(rbb, | 6857 str->SeqTwoByteStringReadBlockIntoBuffer(rbb, |
6858 offset_ptr, | 6858 offset_ptr, |
6859 max_chars); | 6859 max_chars); |
6860 return rbb->util_buffer; | 6860 return rbb->util_buffer; |
6861 } | 6861 } |
6862 case kConsStringTag: | 6862 case kConsStringTag: |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6990 void String::ReadBlockIntoBuffer(String* input, | 6990 void String::ReadBlockIntoBuffer(String* input, |
6991 ReadBlockBuffer* rbb, | 6991 ReadBlockBuffer* rbb, |
6992 unsigned* offset_ptr, | 6992 unsigned* offset_ptr, |
6993 unsigned max_chars) { | 6993 unsigned max_chars) { |
6994 ASSERT(*offset_ptr <= (unsigned)input->length()); | 6994 ASSERT(*offset_ptr <= (unsigned)input->length()); |
6995 if (max_chars == 0) return; | 6995 if (max_chars == 0) return; |
6996 | 6996 |
6997 switch (StringShape(input).representation_tag()) { | 6997 switch (StringShape(input).representation_tag()) { |
6998 case kSeqStringTag: | 6998 case kSeqStringTag: |
6999 if (input->IsAsciiRepresentation()) { | 6999 if (input->IsAsciiRepresentation()) { |
7000 SeqAsciiString::cast(input)->SeqAsciiStringReadBlockIntoBuffer(rbb, | 7000 SeqOneByteString::cast(input)->SeqOneByteStringReadBlockIntoBuffer(rbb, |
7001 offset_ptr, | 7001 offset_ptr, |
7002 max_chars); | 7002 max_chars); |
7003 return; | 7003 return; |
7004 } else { | 7004 } else { |
7005 SeqTwoByteString::cast(input)->SeqTwoByteStringReadBlockIntoBuffer(rbb, | 7005 SeqTwoByteString::cast(input)->SeqTwoByteStringReadBlockIntoBuffer(rbb, |
7006 offset_ptr, | 7006 offset_ptr, |
7007 max_chars); | 7007 max_chars); |
7008 return; | 7008 return; |
7009 } | 7009 } |
7010 case kConsStringTag: | 7010 case kConsStringTag: |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7207 case kTwoByteStringTag | kExternalStringTag: { | 7207 case kTwoByteStringTag | kExternalStringTag: { |
7208 const uc16* data = | 7208 const uc16* data = |
7209 ExternalTwoByteString::cast(source)->GetChars(); | 7209 ExternalTwoByteString::cast(source)->GetChars(); |
7210 CopyChars(sink, | 7210 CopyChars(sink, |
7211 data + from, | 7211 data + from, |
7212 to - from); | 7212 to - from); |
7213 return; | 7213 return; |
7214 } | 7214 } |
7215 case kOneByteStringTag | kSeqStringTag: { | 7215 case kOneByteStringTag | kSeqStringTag: { |
7216 CopyChars(sink, | 7216 CopyChars(sink, |
7217 SeqAsciiString::cast(source)->GetChars() + from, | 7217 SeqOneByteString::cast(source)->GetChars() + from, |
7218 to - from); | 7218 to - from); |
7219 return; | 7219 return; |
7220 } | 7220 } |
7221 case kTwoByteStringTag | kSeqStringTag: { | 7221 case kTwoByteStringTag | kSeqStringTag: { |
7222 CopyChars(sink, | 7222 CopyChars(sink, |
7223 SeqTwoByteString::cast(source)->GetChars() + from, | 7223 SeqTwoByteString::cast(source)->GetChars() + from, |
7224 to - from); | 7224 to - from); |
7225 return; | 7225 return; |
7226 } | 7226 } |
7227 case kOneByteStringTag | kConsStringTag: | 7227 case kOneByteStringTag | kConsStringTag: |
(...skipping 14 matching lines...) Expand all Loading... |
7242 source = cons_string->second(); | 7242 source = cons_string->second(); |
7243 } else { | 7243 } else { |
7244 // Left hand side is longer. Recurse over right. | 7244 // Left hand side is longer. Recurse over right. |
7245 if (to > boundary) { | 7245 if (to > boundary) { |
7246 String* second = cons_string->second(); | 7246 String* second = cons_string->second(); |
7247 // When repeatedly appending to a string, we get a cons string that | 7247 // When repeatedly appending to a string, we get a cons string that |
7248 // is unbalanced to the left, a list, essentially. We inline the | 7248 // is unbalanced to the left, a list, essentially. We inline the |
7249 // common case of sequential ascii right child. | 7249 // common case of sequential ascii right child. |
7250 if (to - boundary == 1) { | 7250 if (to - boundary == 1) { |
7251 sink[boundary - from] = static_cast<sinkchar>(second->Get(0)); | 7251 sink[boundary - from] = static_cast<sinkchar>(second->Get(0)); |
7252 } else if (second->IsSeqAsciiString()) { | 7252 } else if (second->IsSeqOneByteString()) { |
7253 CopyChars(sink + boundary - from, | 7253 CopyChars(sink + boundary - from, |
7254 SeqAsciiString::cast(second)->GetChars(), | 7254 SeqOneByteString::cast(second)->GetChars(), |
7255 to - boundary); | 7255 to - boundary); |
7256 } else { | 7256 } else { |
7257 WriteToFlat(second, | 7257 WriteToFlat(second, |
7258 sink + boundary - from, | 7258 sink + boundary - from, |
7259 0, | 7259 0, |
7260 to - boundary); | 7260 to - boundary); |
7261 } | 7261 } |
7262 to = boundary; | 7262 to = boundary; |
7263 } | 7263 } |
7264 source = first; | 7264 source = first; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7383 | 7383 |
7384 // We know the strings are both non-empty. Compare the first chars | 7384 // We know the strings are both non-empty. Compare the first chars |
7385 // before we try to flatten the strings. | 7385 // before we try to flatten the strings. |
7386 if (this->Get(0) != other->Get(0)) return false; | 7386 if (this->Get(0) != other->Get(0)) return false; |
7387 | 7387 |
7388 String* lhs = this->TryFlattenGetString(); | 7388 String* lhs = this->TryFlattenGetString(); |
7389 String* rhs = other->TryFlattenGetString(); | 7389 String* rhs = other->TryFlattenGetString(); |
7390 | 7390 |
7391 if (StringShape(lhs).IsSequentialAscii() && | 7391 if (StringShape(lhs).IsSequentialAscii() && |
7392 StringShape(rhs).IsSequentialAscii()) { | 7392 StringShape(rhs).IsSequentialAscii()) { |
7393 const char* str1 = SeqAsciiString::cast(lhs)->GetChars(); | 7393 const char* str1 = SeqOneByteString::cast(lhs)->GetChars(); |
7394 const char* str2 = SeqAsciiString::cast(rhs)->GetChars(); | 7394 const char* str2 = SeqOneByteString::cast(rhs)->GetChars(); |
7395 return CompareRawStringContents(Vector<const char>(str1, len), | 7395 return CompareRawStringContents(Vector<const char>(str1, len), |
7396 Vector<const char>(str2, len)); | 7396 Vector<const char>(str2, len)); |
7397 } | 7397 } |
7398 | 7398 |
7399 Isolate* isolate = GetIsolate(); | 7399 Isolate* isolate = GetIsolate(); |
7400 String::FlatContent lhs_content = lhs->GetFlatContent(); | 7400 String::FlatContent lhs_content = lhs->GetFlatContent(); |
7401 String::FlatContent rhs_content = rhs->GetFlatContent(); | 7401 String::FlatContent rhs_content = rhs->GetFlatContent(); |
7402 if (lhs_content.IsFlat()) { | 7402 if (lhs_content.IsFlat()) { |
7403 if (lhs_content.IsAscii()) { | 7403 if (lhs_content.IsAscii()) { |
7404 Vector<const char> vec1 = lhs_content.ToAsciiVector(); | 7404 Vector<const char> vec1 = lhs_content.ToAsciiVector(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7512 | 7512 |
7513 uint32_t String::ComputeAndSetHash() { | 7513 uint32_t String::ComputeAndSetHash() { |
7514 // Should only be called if hash code has not yet been computed. | 7514 // Should only be called if hash code has not yet been computed. |
7515 ASSERT(!HasHashCode()); | 7515 ASSERT(!HasHashCode()); |
7516 | 7516 |
7517 const int len = length(); | 7517 const int len = length(); |
7518 | 7518 |
7519 // Compute the hash code. | 7519 // Compute the hash code. |
7520 uint32_t field = 0; | 7520 uint32_t field = 0; |
7521 if (StringShape(this).IsSequentialAscii()) { | 7521 if (StringShape(this).IsSequentialAscii()) { |
7522 field = HashSequentialString(SeqAsciiString::cast(this)->GetChars(), | 7522 field = HashSequentialString(SeqOneByteString::cast(this)->GetChars(), |
7523 len, | 7523 len, |
7524 GetHeap()->HashSeed()); | 7524 GetHeap()->HashSeed()); |
7525 } else if (StringShape(this).IsSequentialTwoByte()) { | 7525 } else if (StringShape(this).IsSequentialTwoByte()) { |
7526 field = HashSequentialString(SeqTwoByteString::cast(this)->GetChars(), | 7526 field = HashSequentialString(SeqTwoByteString::cast(this)->GetChars(), |
7527 len, | 7527 len, |
7528 GetHeap()->HashSeed()); | 7528 GetHeap()->HashSeed()); |
7529 } else { | 7529 } else { |
7530 StringInputBuffer buffer(this); | 7530 StringInputBuffer buffer(this); |
7531 field = ComputeHashField(&buffer, len, GetHeap()->HashSeed()); | 7531 field = ComputeHashField(&buffer, len, GetHeap()->HashSeed()); |
7532 } | 7532 } |
(...skipping 4115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11648 | 11648 |
11649 MaybeObject* AsObject() { | 11649 MaybeObject* AsObject() { |
11650 if (hash_field_ == 0) Hash(); | 11650 if (hash_field_ == 0) Hash(); |
11651 return HEAP->AllocateAsciiSymbol(string_, hash_field_); | 11651 return HEAP->AllocateAsciiSymbol(string_, hash_field_); |
11652 } | 11652 } |
11653 }; | 11653 }; |
11654 | 11654 |
11655 | 11655 |
11656 class SubStringAsciiSymbolKey : public HashTableKey { | 11656 class SubStringAsciiSymbolKey : public HashTableKey { |
11657 public: | 11657 public: |
11658 explicit SubStringAsciiSymbolKey(Handle<SeqAsciiString> string, | 11658 explicit SubStringAsciiSymbolKey(Handle<SeqOneByteString> string, |
11659 int from, | 11659 int from, |
11660 int length, | 11660 int length, |
11661 uint32_t seed) | 11661 uint32_t seed) |
11662 : string_(string), from_(from), length_(length), seed_(seed) { } | 11662 : string_(string), from_(from), length_(length), seed_(seed) { } |
11663 | 11663 |
11664 uint32_t Hash() { | 11664 uint32_t Hash() { |
11665 ASSERT(length_ >= 0); | 11665 ASSERT(length_ >= 0); |
11666 ASSERT(from_ + length_ <= string_->length()); | 11666 ASSERT(from_ + length_ <= string_->length()); |
11667 StringHasher hasher(length_, string_->GetHeap()->HashSeed()); | 11667 StringHasher hasher(length_, string_->GetHeap()->HashSeed()); |
11668 | 11668 |
11669 // Very long strings have a trivial hash that doesn't inspect the | 11669 // Very long strings have a trivial hash that doesn't inspect the |
11670 // string contents. | 11670 // string contents. |
11671 if (hasher.has_trivial_hash()) { | 11671 if (hasher.has_trivial_hash()) { |
11672 hash_field_ = hasher.GetHashField(); | 11672 hash_field_ = hasher.GetHashField(); |
11673 } else { | 11673 } else { |
11674 int i = 0; | 11674 int i = 0; |
11675 // Do the iterative array index computation as long as there is a | 11675 // Do the iterative array index computation as long as there is a |
11676 // chance this is an array index. | 11676 // chance this is an array index. |
11677 while (i < length_ && hasher.is_array_index()) { | 11677 while (i < length_ && hasher.is_array_index()) { |
11678 hasher.AddCharacter(static_cast<uc32>( | 11678 hasher.AddCharacter(static_cast<uc32>( |
11679 string_->SeqAsciiStringGet(i + from_))); | 11679 string_->SeqOneByteStringGet(i + from_))); |
11680 i++; | 11680 i++; |
11681 } | 11681 } |
11682 | 11682 |
11683 // Process the remaining characters without updating the array | 11683 // Process the remaining characters without updating the array |
11684 // index. | 11684 // index. |
11685 while (i < length_) { | 11685 while (i < length_) { |
11686 hasher.AddCharacterNoIndex(static_cast<uc32>( | 11686 hasher.AddCharacterNoIndex(static_cast<uc32>( |
11687 string_->SeqAsciiStringGet(i + from_))); | 11687 string_->SeqOneByteStringGet(i + from_))); |
11688 i++; | 11688 i++; |
11689 } | 11689 } |
11690 hash_field_ = hasher.GetHashField(); | 11690 hash_field_ = hasher.GetHashField(); |
11691 } | 11691 } |
11692 | 11692 |
11693 uint32_t result = hash_field_ >> String::kHashShift; | 11693 uint32_t result = hash_field_ >> String::kHashShift; |
11694 ASSERT(result != 0); // Ensure that the hash value of 0 is never computed. | 11694 ASSERT(result != 0); // Ensure that the hash value of 0 is never computed. |
11695 return result; | 11695 return result; |
11696 } | 11696 } |
11697 | 11697 |
11698 | 11698 |
11699 uint32_t HashForObject(Object* other) { | 11699 uint32_t HashForObject(Object* other) { |
11700 return String::cast(other)->Hash(); | 11700 return String::cast(other)->Hash(); |
11701 } | 11701 } |
11702 | 11702 |
11703 bool IsMatch(Object* string) { | 11703 bool IsMatch(Object* string) { |
11704 Vector<const char> chars(string_->GetChars() + from_, length_); | 11704 Vector<const char> chars(string_->GetChars() + from_, length_); |
11705 return String::cast(string)->IsAsciiEqualTo(chars); | 11705 return String::cast(string)->IsAsciiEqualTo(chars); |
11706 } | 11706 } |
11707 | 11707 |
11708 MaybeObject* AsObject() { | 11708 MaybeObject* AsObject() { |
11709 if (hash_field_ == 0) Hash(); | 11709 if (hash_field_ == 0) Hash(); |
11710 Vector<const char> chars(string_->GetChars() + from_, length_); | 11710 Vector<const char> chars(string_->GetChars() + from_, length_); |
11711 return HEAP->AllocateAsciiSymbol(chars, hash_field_); | 11711 return HEAP->AllocateAsciiSymbol(chars, hash_field_); |
11712 } | 11712 } |
11713 | 11713 |
11714 private: | 11714 private: |
11715 Handle<SeqAsciiString> string_; | 11715 Handle<SeqOneByteString> string_; |
11716 int from_; | 11716 int from_; |
11717 int length_; | 11717 int length_; |
11718 uint32_t hash_field_; | 11718 uint32_t hash_field_; |
11719 uint32_t seed_; | 11719 uint32_t seed_; |
11720 }; | 11720 }; |
11721 | 11721 |
11722 | 11722 |
11723 class TwoByteSymbolKey : public SequentialSymbolKey<uc16> { | 11723 class TwoByteSymbolKey : public SequentialSymbolKey<uc16> { |
11724 public: | 11724 public: |
11725 explicit TwoByteSymbolKey(Vector<const uc16> str, uint32_t seed) | 11725 explicit TwoByteSymbolKey(Vector<const uc16> str, uint32_t seed) |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12630 } | 12630 } |
12631 | 12631 |
12632 | 12632 |
12633 MaybeObject* SymbolTable::LookupAsciiSymbol(Vector<const char> str, | 12633 MaybeObject* SymbolTable::LookupAsciiSymbol(Vector<const char> str, |
12634 Object** s) { | 12634 Object** s) { |
12635 AsciiSymbolKey key(str, GetHeap()->HashSeed()); | 12635 AsciiSymbolKey key(str, GetHeap()->HashSeed()); |
12636 return LookupKey(&key, s); | 12636 return LookupKey(&key, s); |
12637 } | 12637 } |
12638 | 12638 |
12639 | 12639 |
12640 MaybeObject* SymbolTable::LookupSubStringAsciiSymbol(Handle<SeqAsciiString> str, | 12640 MaybeObject* SymbolTable::LookupSubStringAsciiSymbol( |
12641 int from, | 12641 Handle<SeqOneByteString> str, |
12642 int length, | 12642 int from, |
12643 Object** s) { | 12643 int length, |
| 12644 Object** s) { |
12644 SubStringAsciiSymbolKey key(str, from, length, GetHeap()->HashSeed()); | 12645 SubStringAsciiSymbolKey key(str, from, length, GetHeap()->HashSeed()); |
12645 return LookupKey(&key, s); | 12646 return LookupKey(&key, s); |
12646 } | 12647 } |
12647 | 12648 |
12648 | 12649 |
12649 MaybeObject* SymbolTable::LookupTwoByteSymbol(Vector<const uc16> str, | 12650 MaybeObject* SymbolTable::LookupTwoByteSymbol(Vector<const uc16> str, |
12650 Object** s) { | 12651 Object** s) { |
12651 TwoByteSymbolKey key(str, GetHeap()->HashSeed()); | 12652 TwoByteSymbolKey key(str, GetHeap()->HashSeed()); |
12652 return LookupKey(&key, s); | 12653 return LookupKey(&key, s); |
12653 } | 12654 } |
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13943 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13944 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13944 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13945 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13945 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13946 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13946 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13947 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13947 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13948 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13948 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13949 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13949 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13950 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13950 } | 13951 } |
13951 | 13952 |
13952 } } // namespace v8::internal | 13953 } } // namespace v8::internal |
OLD | NEW |