diff --git a/src/api.cc b/src/api.cc index 2b24ab07f6..9ee23698cf 100644 --- a/src/api.cc +++ b/src/api.cc @@ -4061,7 +4061,7 @@ bool String::IsOneByte() const { if (IsDeadCheck(str->GetIsolate(), "v8::String::IsOneByte()")) { return false; } - return str->IsOneByteConvertible(); + return str->HasOnlyOneByteChars(); } diff --git a/src/objects-inl.h b/src/objects-inl.h index 08378f1955..804cd26dab 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -357,12 +357,8 @@ bool String::IsTwoByteRepresentationUnderneath() { bool String::HasOnlyOneByteChars() { uint32_t type = map()->instance_type(); - return (type & kOneByteDataHintMask) == kOneByteDataHintTag; -} - - -bool String::IsOneByteConvertible() { - return HasOnlyOneByteChars() || IsOneByteRepresentation(); + return (type & kOneByteDataHintMask) == kOneByteDataHintTag || + IsOneByteRepresentation(); } diff --git a/src/objects.h b/src/objects.h index e32c41bb13..941ee26c4b 100644 --- a/src/objects.h +++ b/src/objects.h @@ -7638,8 +7638,6 @@ class String: public Name { // possible. inline bool HasOnlyOneByteChars(); - inline bool IsOneByteConvertible(); - // Get and set individual two byte chars in the string. inline void Set(int index, uint16_t value); // Get individual two byte char in the string. Repeated calls diff --git a/src/runtime.cc b/src/runtime.cc index 333d22a344..5c1cde2bf5 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -3347,8 +3347,8 @@ MUST_USE_RESULT static MaybeObject* StringReplaceGlobalRegExpWithString( // Shortcut for simple non-regexp global replacements if (regexp->TypeTag() == JSRegExp::ATOM && simple_replace) { - if (subject->IsOneByteConvertible() && - replacement->IsOneByteConvertible()) { + if (subject->HasOnlyOneByteChars() && + replacement->HasOnlyOneByteChars()) { return StringReplaceGlobalAtomRegExpWithString( isolate, subject, regexp, replacement, last_match_info); } else { @@ -3530,7 +3530,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringReplaceGlobalRegExpWithString) { if (!subject->IsFlat()) subject = FlattenGetString(subject); if (replacement->length() == 0) { - if (subject->IsOneByteConvertible()) { + if (subject->HasOnlyOneByteChars()) { return StringReplaceGlobalRegExpWithEmptyString( isolate, subject, regexp, last_match_info); } else { @@ -6389,7 +6389,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) { if (first->IsString()) return first; } - bool one_byte = special->IsOneByteConvertible(); + bool one_byte = special->HasOnlyOneByteChars(); int position = 0; for (int i = 0; i < array_length; i++) { int increment = 0; @@ -6430,7 +6430,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringBuilderConcat) { String* element = String::cast(elt); int element_length = element->length(); increment = element_length; - if (one_byte && !element->IsOneByteConvertible()) { + if (one_byte && !element->HasOnlyOneByteChars()) { one_byte = false; } } else {