B3InsertionSet.cpp [plain text]
#include "config.h"
#include "B3InsertionSet.h"
#if ENABLE(B3_JIT)
#include "B3BasicBlock.h"
#include "B3ProcedureInlines.h"
#include "B3ValueInlines.h"
#include <wtf/BubbleSort.h>
namespace JSC { namespace B3 {
Value* InsertionSet::insertIntConstant(size_t index, Origin origin, Type type, int64_t value)
{
return insertValue(index, m_procedure.addIntConstant(origin, type, value));
}
Value* InsertionSet::insertIntConstant(size_t index, Value* likeValue, int64_t value)
{
return insertIntConstant(index, likeValue->origin(), likeValue->type(), value);
}
Value* InsertionSet::insertBottom(size_t index, Origin origin, Type type)
{
Value*& bottom = m_bottomForType[type];
if (!bottom)
bottom = insertValue(index, m_procedure.addBottom(origin, type));
return bottom;
}
Value* InsertionSet::insertBottom(size_t index, Value* likeValue)
{
return insertBottom(index, likeValue->origin(), likeValue->type());
}
Value* InsertionSet::insertClone(size_t index, Value* value)
{
return insertValue(index, m_procedure.clone(value));
}
void InsertionSet::execute(BasicBlock* block)
{
for (Insertion& insertion : m_insertions)
insertion.element()->owner = block;
bubbleSort(m_insertions.begin(), m_insertions.end());
executeInsertions(block->m_values, m_insertions);
m_bottomForType = TypeMap<Value*>();
}
} }
#endif // ENABLE(B3_JIT)