| Index: src/factory.cc
|
| diff --git a/src/factory.cc b/src/factory.cc
|
| index e2637ece1e32fd57faf99913c0ca4c5f54746aa1..0d22a3e229098a0aa75befda347bb011df158b3f 100644
|
| --- a/src/factory.cc
|
| +++ b/src/factory.cc
|
| @@ -271,9 +271,27 @@ Handle<String> Factory::InternalizeUtf8String(Vector<const char> string) {
|
| return InternalizeStringWithKey(&key);
|
| }
|
|
|
| +namespace {
|
| +
|
| +class OneByteStringKeyExpectingSequential final : public OneByteStringKey {
|
| + using OneByteStringKey::OneByteStringKey;
|
| +
|
| + bool IsMatch(Object* string) final {
|
| + if (V8_LIKELY(StringShape(String::cast(string)).IsSequentialOneByte())) {
|
| + SeqOneByteString* seq_one_byte = SeqOneByteString::cast(string);
|
| + return seq_one_byte->length() == string_.length() &&
|
| + memcmp(seq_one_byte->GetChars(), string_.start(),
|
| + string_.length()) == 0;
|
| + }
|
| + return OneByteStringKey::IsMatch(string);
|
| + }
|
| +};
|
| +
|
| +} // namespace
|
|
|
| Handle<String> Factory::InternalizeOneByteString(Vector<const uint8_t> string) {
|
| - OneByteStringKey key(string, isolate()->heap()->HashSeed());
|
| + OneByteStringKeyExpectingSequential key(string,
|
| + isolate()->heap()->HashSeed());
|
| return InternalizeStringWithKey(&key);
|
| }
|
|
|
|
|