Commit 4765addf authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

Revert "[ast] Add a Flatten method for AstConsString"

This reverts commit 7a0ae73b.

Reason for revert: Not useful after all, no tests, we can reland if we
do end up needing it.

Original change's description:
> [ast] Add a Flatten method for AstConsString
> 
> This allows off-thread flattening.
> 
> Bug: chromium:1011762
> Change-Id: If83f7bbcbf74165987a4c157184f5b92dc554971
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1924437
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Auto-Submit: Leszek Swirski <leszeks@chromium.org>
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#65075}

TBR=leszeks@chromium.org,verwaest@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:1011762
Change-Id: Ia72e5abdc9b6149a337565576806427dcd1d11c2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1991484Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65638}
parent f4ac9f6b
...@@ -250,50 +250,6 @@ AstConsString* AstValueFactory::NewConsString(const AstRawString* str1, ...@@ -250,50 +250,6 @@ AstConsString* AstValueFactory::NewConsString(const AstRawString* str1,
return NewConsString()->AddString(zone_, str1)->AddString(zone_, str2); return NewConsString()->AddString(zone_, str1)->AddString(zone_, str2);
} }
const AstRawString* AstValueFactory::Flatten(const AstConsString* str) {
if (str->IsEmpty()) return empty_string();
AstConsString::Segment segment = str->segment_;
if (!segment.next) return segment.string;
int length = segment.string->length();
bool is_one_byte = segment.string->is_one_byte();
while (segment.next) {
segment = *segment.next;
length += segment.string->length();
is_one_byte &= segment.string->is_one_byte();
}
if (is_one_byte) {
Vector<byte> data(zone()->NewArray<byte>(length), length);
segment = str->segment_;
byte* p = data.begin();
while (true) {
CopyChars(p, segment.string->raw_data(), segment.string->length());
p += segment.string->length();
if (!segment.next) break;
segment = *segment.next;
}
return GetOneByteString(data);
}
Vector<uint16_t> data(zone()->NewArray<uint16_t>(length), length);
segment = str->segment_;
uint16_t* p = data.begin();
while (true) {
if (segment.string->is_one_byte()) {
CopyChars(p, segment.string->raw_data(), segment.string->length());
} else {
CopyChars(p,
reinterpret_cast<const uint16_t*>(segment.string->raw_data()),
segment.string->length());
}
p += segment.string->length();
if (!segment.next) break;
segment = *segment.next;
}
return GetTwoByteString(data);
}
void AstValueFactory::Internalize(Isolate* isolate) { void AstValueFactory::Internalize(Isolate* isolate) {
// Strings need to be internalized before values, because values refer to // Strings need to be internalized before values, because values refer to
// strings. // strings.
......
...@@ -312,7 +312,6 @@ class AstValueFactory { ...@@ -312,7 +312,6 @@ class AstValueFactory {
V8_EXPORT_PRIVATE AstConsString* NewConsString(const AstRawString* str); V8_EXPORT_PRIVATE AstConsString* NewConsString(const AstRawString* str);
V8_EXPORT_PRIVATE AstConsString* NewConsString(const AstRawString* str1, V8_EXPORT_PRIVATE AstConsString* NewConsString(const AstRawString* str1,
const AstRawString* str2); const AstRawString* str2);
V8_EXPORT_PRIVATE const AstRawString* Flatten(const AstConsString* str);
V8_EXPORT_PRIVATE void Internalize(Isolate* isolate); V8_EXPORT_PRIVATE void Internalize(Isolate* isolate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment