mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
LibJS+CI: Remove bytecode optimization passes for now
These passes have not been shown to actually optimize any JS, and tests have become very flaky with optimizations enabled. Until some measurable benefit is shown, remove the optimization passes to reduce overhead of maintaining bytecode operations and to reduce CI churn. The framework for optimizations will live on in git history, and can be restored once proven useful.
This commit is contained in:
parent
164c132928
commit
77d7f715e3
17 changed files with 1 additions and 1311 deletions
|
@ -1,136 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibJS/Bytecode/BasicBlock.h>
|
||||
#include <LibJS/Bytecode/Generator.h>
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
||||
struct PassPipelineExecutable {
|
||||
Executable& executable;
|
||||
Optional<HashMap<BasicBlock const*, HashTable<BasicBlock const*>>> cfg {};
|
||||
Optional<HashMap<BasicBlock const*, HashTable<BasicBlock const*>>> inverted_cfg {};
|
||||
Optional<HashTable<BasicBlock const*>> exported_blocks {};
|
||||
};
|
||||
|
||||
class Pass {
|
||||
public:
|
||||
Pass() = default;
|
||||
virtual ~Pass() = default;
|
||||
|
||||
virtual void perform(PassPipelineExecutable&) = 0;
|
||||
void started()
|
||||
{
|
||||
m_timer.start();
|
||||
}
|
||||
void finished()
|
||||
{
|
||||
m_time_difference = m_timer.elapsed_time();
|
||||
}
|
||||
|
||||
u64 elapsed() const { return m_time_difference.to_microseconds(); }
|
||||
|
||||
protected:
|
||||
Core::ElapsedTimer m_timer;
|
||||
Duration m_time_difference {};
|
||||
};
|
||||
|
||||
class PassManager : public Pass {
|
||||
public:
|
||||
PassManager() = default;
|
||||
~PassManager() override = default;
|
||||
|
||||
void add(NonnullOwnPtr<Pass> pass) { m_passes.append(move(pass)); }
|
||||
|
||||
template<typename PassT, typename... Args>
|
||||
void add(Args&&... args) { m_passes.append(make<PassT>(forward<Args>(args)...)); }
|
||||
|
||||
void perform(Executable& executable)
|
||||
{
|
||||
PassPipelineExecutable pipeline_executable { executable };
|
||||
perform(pipeline_executable);
|
||||
}
|
||||
|
||||
virtual void perform(PassPipelineExecutable& executable) override
|
||||
{
|
||||
started();
|
||||
for (auto& pass : m_passes)
|
||||
pass->perform(executable);
|
||||
finished();
|
||||
}
|
||||
|
||||
private:
|
||||
Vector<NonnullOwnPtr<Pass>> m_passes;
|
||||
};
|
||||
|
||||
namespace Passes {
|
||||
|
||||
class GenerateCFG : public Pass {
|
||||
public:
|
||||
GenerateCFG() = default;
|
||||
~GenerateCFG() override = default;
|
||||
|
||||
private:
|
||||
virtual void perform(PassPipelineExecutable&) override;
|
||||
};
|
||||
|
||||
class MergeBlocks : public Pass {
|
||||
public:
|
||||
MergeBlocks() = default;
|
||||
~MergeBlocks() override = default;
|
||||
|
||||
private:
|
||||
virtual void perform(PassPipelineExecutable&) override;
|
||||
};
|
||||
|
||||
class PlaceBlocks : public Pass {
|
||||
public:
|
||||
PlaceBlocks() = default;
|
||||
~PlaceBlocks() override = default;
|
||||
|
||||
private:
|
||||
virtual void perform(PassPipelineExecutable&) override;
|
||||
};
|
||||
|
||||
class UnifySameBlocks : public Pass {
|
||||
public:
|
||||
UnifySameBlocks() = default;
|
||||
~UnifySameBlocks() override = default;
|
||||
|
||||
private:
|
||||
virtual void perform(PassPipelineExecutable&) override;
|
||||
};
|
||||
|
||||
class DumpCFG : public Pass {
|
||||
public:
|
||||
DumpCFG(FILE* file)
|
||||
: m_file(file)
|
||||
{
|
||||
}
|
||||
|
||||
~DumpCFG() override = default;
|
||||
|
||||
private:
|
||||
virtual void perform(PassPipelineExecutable&) override;
|
||||
|
||||
FILE* m_file { nullptr };
|
||||
};
|
||||
|
||||
class EliminateLoads : public Pass {
|
||||
public:
|
||||
EliminateLoads() = default;
|
||||
virtual ~EliminateLoads() override = default;
|
||||
|
||||
private:
|
||||
virtual void perform(PassPipelineExecutable&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue