2016-06-09 12:03:51 +00:00
|
|
|
// 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_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_
|
|
|
|
#define TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_
|
|
|
|
|
2019-05-21 09:30:15 +00:00
|
|
|
#include "src/codegen/source-position-table.h"
|
2019-05-24 13:51:59 +00:00
|
|
|
#include "src/init/v8.h"
|
2016-06-09 12:03:51 +00:00
|
|
|
#include "src/interpreter/bytecode-array-iterator.h"
|
2019-05-23 08:51:46 +00:00
|
|
|
#include "src/objects/objects.h"
|
2016-06-09 12:03:51 +00:00
|
|
|
|
|
|
|
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_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_
|