v8/test/unittests/interpreter/source-position-matcher.h
jameslahm b3d004aaf9 [test] Move cctest/interpreter to unittests
... /interpreter.

This CL moves cctest/interpreter/{bytecode-expectations-printer,
test-bytecode-generator, test-interpreter-intrinsics,
interpreter-tester, test-interpreter, test-source-positions,
source-position-matcher} to unittests/interpreter/{
bytecode-expectations-printer, bytecode-generator-unittest,
interpreter-intrinsics-unittest, interpreter-tester,
interpreter-unittest, source-positions-unittest, source-position-matcher}.

Bug: v8:12781
Change-Id: I187583bd34f709dd0d7dfc0f92e18f191da0e30f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3609752
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81057}
2022-06-10 08:37:10 +00:00

51 lines
1.7 KiB
C++

// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TEST_UNITTESTS_INTERPRETER_SOURCE_POSITION_COMPARER_H_
#define TEST_UNITTESTS_INTERPRETER_SOURCE_POSITION_COMPARER_H_
#include "src/codegen/source-position-table.h"
#include "src/init/v8.h"
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/objects/objects.h"
namespace v8 {
namespace internal {
namespace interpreter {
class SourcePositionMatcher final {
public:
bool Match(Handle<BytecodeArray> original, Handle<BytecodeArray> optimized);
private:
bool HasNewExpressionPositionsInOptimized(
const std::vector<PositionTableEntry>* const original_positions,
const std::vector<PositionTableEntry>* const optimized_positions);
bool CompareExpressionPositions(
const std::vector<PositionTableEntry>* const original_positions,
const std::vector<PositionTableEntry>* const optimized_positions);
void StripUnneededExpressionPositions(
Handle<BytecodeArray> bytecode_array,
std::vector<PositionTableEntry>* positions,
int next_statement_bytecode_offset);
bool ExpressionPositionIsNeeded(Handle<BytecodeArray> bytecode_array,
int start_offset, int end_offset);
void MoveToNextStatement(
SourcePositionTableIterator* iterator,
std::vector<PositionTableEntry>* expression_positions);
void AdvanceBytecodeIterator(BytecodeArrayIterator* iterator,
int bytecode_offset);
};
} // namespace interpreter
} // namespace internal
} // namespace v8
#endif // TEST_UNITTESTS_INTERPRETER_SOURCE_POSITION_COMPARER_H_