[liveedit] Enable Myers algorithm

This CL enables Myers algorithm introduced with
https://crrev.com/c/3804860.

Note that Myers finds slightly different diffs in some cases compared
to the current approach so this CL has to rebaseline one test.

R=kimanh@chromium.org

Bug: chromium:1205288
Change-Id: Ife4708a9edf543db938024a5e14c34a589d6a22a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3810244
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82247}
This commit is contained in:
Simon Zünd 2022-08-08 09:28:19 +02:00 committed by V8 LUCI CQ
parent 0e60e79da7
commit 5db345eacf
2 changed files with 7 additions and 8 deletions

View File

@ -40,9 +40,8 @@ class Comparator {
};
// Finds the difference between 2 arrays of elements.
static void CalculateDifference(
Input* input, Output* result_writer,
CompareMethod = CompareMethod::kDynamicProgramming);
static void CalculateDifference(Input* input, Output* result_writer,
CompareMethod = CompareMethod::kMyers);
};
} // namespace internal

View File

@ -188,11 +188,11 @@ TEST(LiveEditTranslatePosition) {
CompareStringsOneWay("aabbaaaa", "aaaabbaa", &changes);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 0), 0);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 1), 1);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 2), 4);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 3), 5);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 4), 6);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 5), 7);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 6), 8);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 2), 2);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 3), 3);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 4), 2);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 5), 3);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 6), 6);
CHECK_EQ(LiveEdit::TranslatePosition(changes, 8), 8);
}