| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index e4763247f587b78f3c40d41ea56547ea4244aeb2..654bd14f51435d184de24609597720d3dacdec62 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -14006,19 +14006,63 @@ MaybeObject* OneByteStringKey::AsObject(Heap* heap) {
|
| }
|
|
|
|
|
| -MaybeObject* SubStringOneByteStringKey::AsObject(Heap* heap) {
|
| +MaybeObject* TwoByteStringKey::AsObject(Heap* heap) {
|
| + if (hash_field_ == 0) Hash();
|
| + return heap->AllocateTwoByteInternalizedString(string_, hash_field_);
|
| +}
|
| +
|
| +
|
| +template<>
|
| +const uint8_t* SubStringKey<uint8_t>::GetChars() {
|
| + return string_->IsSeqOneByteString()
|
| + ? SeqOneByteString::cast(*string_)->GetChars()
|
| + : ExternalAsciiString::cast(*string_)->GetChars();
|
| +}
|
| +
|
| +
|
| +template<>
|
| +const uint16_t* SubStringKey<uint16_t>::GetChars() {
|
| + return string_->IsSeqTwoByteString()
|
| + ? SeqTwoByteString::cast(*string_)->GetChars()
|
| + : ExternalTwoByteString::cast(*string_)->GetChars();
|
| +}
|
| +
|
| +
|
| +template<>
|
| +MaybeObject* SubStringKey<uint8_t>::AsObject(Heap* heap) {
|
| if (hash_field_ == 0) Hash();
|
| - Vector<const uint8_t> chars(string_->GetChars() + from_, length_);
|
| + Vector<const uint8_t> chars(GetChars() + from_, length_);
|
| return heap->AllocateOneByteInternalizedString(chars, hash_field_);
|
| }
|
|
|
|
|
| -MaybeObject* TwoByteStringKey::AsObject(Heap* heap) {
|
| +template<>
|
| +MaybeObject* SubStringKey<uint16_t>::AsObject(
|
| + Heap* heap) {
|
| if (hash_field_ == 0) Hash();
|
| - return heap->AllocateTwoByteInternalizedString(string_, hash_field_);
|
| + Vector<const uint16_t> chars(GetChars() + from_, length_);
|
| + return heap->AllocateTwoByteInternalizedString(chars, hash_field_);
|
| +}
|
| +
|
| +
|
| +template<>
|
| +bool SubStringKey<uint8_t>::IsMatch(Object* string) {
|
| + Vector<const uint8_t> chars(GetChars() + from_, length_);
|
| + return String::cast(string)->IsOneByteEqualTo(chars);
|
| }
|
|
|
|
|
| +template<>
|
| +bool SubStringKey<uint16_t>::IsMatch(Object* string) {
|
| + Vector<const uint16_t> chars(GetChars() + from_, length_);
|
| + return String::cast(string)->IsTwoByteEqualTo(chars);
|
| +}
|
| +
|
| +
|
| +template class SubStringKey<uint8_t>;
|
| +template class SubStringKey<uint16_t>;
|
| +
|
| +
|
| // InternalizedStringKey carries a string/internalized-string object as key.
|
| class InternalizedStringKey : public HashTableKey {
|
| public:
|
|
|