v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
liveedit-diff.h
Go to the documentation of this file.
1// Copyright 2022 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_DEBUG_LIVEEDIT_DIFF_H_
6#define V8_DEBUG_LIVEEDIT_DIFF_H_
7
8namespace v8 {
9namespace internal {
10
11// A general-purpose comparator between 2 arrays.
13 public:
14 // Holds 2 arrays of some elements allowing to compare any pair of
15 // element from the first array and element from the second array.
16 class Input {
17 public:
18 virtual int GetLength1() = 0;
19 virtual int GetLength2() = 0;
20 virtual bool Equals(int index1, int index2) = 0;
21
22 protected:
23 virtual ~Input() = default;
24 };
25
26 // Receives compare result as a series of chunks.
27 class Output {
28 public:
29 // Puts another chunk in result list. Note that technically speaking
30 // only 3 arguments actually needed with 4th being derivable.
31 virtual void AddChunk(int pos1, int pos2, int len1, int len2) = 0;
32
33 protected:
34 virtual ~Output() = default;
35 };
36
37 // Finds the difference between 2 arrays of elements.
38 static void CalculateDifference(Input* input, Output* result_writer);
39};
40
41} // namespace internal
42} // namespace v8
43
44#endif // V8_DEBUG_LIVEEDIT_DIFF_H_
virtual bool Equals(int index1, int index2)=0
virtual void AddChunk(int pos1, int pos2, int len1, int len2)=0
static void CalculateDifference(Input *input, Output *result_writer)