chromium/v8/src/regexp/regexp-bytecode-peephole.cc

// Copyright 2019 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.

#include "src/regexp/regexp-bytecode-peephole.h"

#include "src/flags/flags.h"
#include "src/objects/fixed-array-inl.h"
#include "src/regexp/regexp-bytecodes.h"
#include "src/utils/memcopy.h"
#include "src/utils/utils.h"
#include "src/zone/zone-containers.h"
#include "src/zone/zone.h"

namespace v8 {
namespace internal {

namespace {

struct BytecodeArgument {};

struct BytecodeArgumentMapping : BytecodeArgument {};

struct BytecodeArgumentCheck : BytecodeArgument {};

// Trie-Node for storing bytecode sequences we want to optimize.
class BytecodeSequenceNode {};

// These definitions are here in order to please the linker, which in debug mode
// sometimes requires static constants to be defined in .cc files.
constexpr int BytecodeSequenceNode::kDummyBytecode;

class RegExpBytecodePeephole {};

template <typename T>
T GetValue(const uint8_t* buffer, int pos) {}

int32_t GetArgumentValue(const uint8_t* bytecode, int offset, int length) {}

BytecodeSequenceNode::BytecodeSequenceNode(int bytecode, Zone* zone)
    :{}

BytecodeSequenceNode& BytecodeSequenceNode::FollowedBy(int bytecode) {}

BytecodeSequenceNode& BytecodeSequenceNode::ReplaceWith(int bytecode) {}

BytecodeSequenceNode& BytecodeSequenceNode::MapArgument(
    int bytecode_index_in_sequence, int argument_offset,
    int argument_byte_length, int new_argument_byte_length) {}

BytecodeSequenceNode& BytecodeSequenceNode::IfArgumentEqualsOffset(
    int argument_offset, int argument_byte_length, int check_byte_offset) {}

BytecodeSequenceNode& BytecodeSequenceNode::IfArgumentEqualsValueAtOffset(
    int argument_offset, int argument_byte_length,
    int other_bytecode_index_in_sequence, int other_argument_offset,
    int other_argument_byte_length) {}

BytecodeSequenceNode& BytecodeSequenceNode::IgnoreArgument(
    int bytecode_index_in_sequence, int argument_offset,
    int argument_byte_length) {}

bool BytecodeSequenceNode::CheckArguments(const uint8_t* bytecode, int pc) {}

bool BytecodeSequenceNode::IsSequence() const {}

int BytecodeSequenceNode::SequenceLength() const {}

int BytecodeSequenceNode::OptimizedBytecode() const {}

BytecodeSequenceNode* BytecodeSequenceNode::Find(int bytecode) const {}

size_t BytecodeSequenceNode::ArgumentSize() const {}

BytecodeArgumentMapping BytecodeSequenceNode::ArgumentMapping(
    size_t index) const {}

ZoneLinkedList<BytecodeArgument>::iterator
BytecodeSequenceNode::ArgumentIgnoredBegin() const {}

ZoneLinkedList<BytecodeArgument>::iterator
BytecodeSequenceNode::ArgumentIgnoredEnd() const {}

bool BytecodeSequenceNode::HasIgnoredArguments() const {}

BytecodeSequenceNode& BytecodeSequenceNode::GetNodeByIndexInSequence(
    int index_in_sequence) {}

Zone* BytecodeSequenceNode::zone() const {}

RegExpBytecodePeephole::RegExpBytecodePeephole(
    Zone* zone, size_t buffer_size,
    const ZoneUnorderedMap<int, int>& jump_edges)
    :{}

void RegExpBytecodePeephole::DefineStandardSequences() {}

bool RegExpBytecodePeephole::OptimizeBytecode(const uint8_t* bytecode,
                                              int length) {}

void RegExpBytecodePeephole::CopyOptimizedBytecode(uint8_t* to_address) const {}

int RegExpBytecodePeephole::Length() const {}

BytecodeSequenceNode& RegExpBytecodePeephole::CreateSequence(int bytecode) {}

int RegExpBytecodePeephole::TryOptimizeSequence(const uint8_t* bytecode,
                                                int bytecode_length,
                                                int start_pc) {}

void RegExpBytecodePeephole::EmitOptimization(
    int start_pc, const uint8_t* bytecode,
    const BytecodeSequenceNode& last_node) {}

void RegExpBytecodePeephole::AddJumpSourceFixup(int fixup, int pos) {}

void RegExpBytecodePeephole::AddJumpDestinationFixup(int fixup, int pos) {}

void RegExpBytecodePeephole::SetJumpDestinationFixup(int fixup, int pos) {}

void RegExpBytecodePeephole::PrepareJumpStructures(
    const ZoneUnorderedMap<int, int>& jump_edges) {}

void RegExpBytecodePeephole::FixJumps() {}

void RegExpBytecodePeephole::FixJump(int jump_source, int jump_destination) {}

void RegExpBytecodePeephole::AddSentinelFixups(int pos) {}

template <typename T>
void RegExpBytecodePeephole::EmitValue(T value) {}

template <typename T>
void RegExpBytecodePeephole::OverwriteValue(int offset, T value) {}

void RegExpBytecodePeephole::CopyRangeToOutput(const uint8_t* orig_bytecode,
                                               int start, int length) {}

void RegExpBytecodePeephole::SetRange(uint8_t value, int count) {}

void RegExpBytecodePeephole::EmitArgument(int start_pc, const uint8_t* bytecode,
                                          BytecodeArgumentMapping arg) {}

int RegExpBytecodePeephole::pc() const {}

Zone* RegExpBytecodePeephole::zone() const {}

}  // namespace

// static
Handle<TrustedByteArray> RegExpBytecodePeepholeOptimization::OptimizeBytecode(
    Isolate* isolate, Zone* zone, DirectHandle<String> source,
    const uint8_t* bytecode, int length,
    const ZoneUnorderedMap<int, int>& jump_edges) {}

}  // namespace internal
}  // namespace v8