| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index decaf392f6d999002e9d9db5eaaf22f587e100de..a612ba984cc86e534669b9513cb7f87478179c56 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -1321,17 +1321,17 @@ StringRepresentationTag String::map_representation_tag(Map* map) {
|
|
|
|
|
| bool String::IsFlat() {
|
| - String* current = this;
|
| - while (true) {
|
| - switch (current->representation_tag()) {
|
| - case kConsStringTag:
|
| - return String::cast(ConsString::cast(current)->second())->length() == 0;
|
| - case kSlicedStringTag:
|
| - current = String::cast(SlicedString::cast(this)->buffer());
|
| - break;
|
| - default:
|
| - return true;
|
| + switch (this->representation_tag()) {
|
| + case kConsStringTag:
|
| + // Only flattened strings have second part empty.
|
| + return String::cast(ConsString::cast(this)->second())->length() == 0;
|
| + case kSlicedStringTag: {
|
| + String* slice = String::cast(SlicedString::cast(this)->buffer());
|
| + StringRepresentationTag tag = slice->representation_tag();
|
| + return tag == kSeqStringTag || tag == kExternalStringTag;
|
| }
|
| + default:
|
| + return true;
|
| }
|
| }
|
|
|
|
|