|
Lines 31-36
Source/JavaScriptCore/ftl/FTLOutput.h_sec1
|
| 31 |
#if ENABLE(FTL_JIT) |
31 |
#if ENABLE(FTL_JIT) |
| 32 |
|
32 |
|
| 33 |
#include "FTLAbbreviations.h" |
33 |
#include "FTLAbbreviations.h" |
|
|
34 |
#include "FTLAbstractHeapRepository.h" |
| 34 |
|
35 |
|
| 35 |
namespace JSC { namespace FTL { |
36 |
namespace JSC { namespace FTL { |
| 36 |
|
37 |
|
|
Lines 44-49
namespace JSC { namespace FTL {
Source/JavaScriptCore/ftl/FTLOutput.h_sec2
|
| 44 |
// |
45 |
// |
| 45 |
// We say that a "pointer" is what LLVM considers to be a pointer-width integer. |
46 |
// We say that a "pointer" is what LLVM considers to be a pointer-width integer. |
| 46 |
// |
47 |
// |
|
|
48 |
// We say that a "typed pointer" is a pointer plus TBAA meta-data (i.e. an AbstractHeap). |
| 49 |
// |
| 47 |
// We say that "get" and "set" are what LLVM considers to be "load" and "store". Get |
50 |
// We say that "get" and "set" are what LLVM considers to be "load" and "store". Get |
| 48 |
// and set take references. |
51 |
// and set take references. |
| 49 |
// |
52 |
// |
|
Lines 67-73
public:
Source/JavaScriptCore/ftl/FTLOutput.h_sec3
|
| 67 |
, int32Zero(constInt(int32, 0, SignExtend)) |
70 |
, int32Zero(constInt(int32, 0, SignExtend)) |
| 68 |
, int64Zero(constInt(int64, 0, SignExtend)) |
71 |
, int64Zero(constInt(int64, 0, SignExtend)) |
| 69 |
, intPtrZero(constInt(intPtr, 0, SignExtend)) |
72 |
, intPtrZero(constInt(intPtr, 0, SignExtend)) |
|
|
73 |
, m_module(0) |
| 70 |
, m_function(0) |
74 |
, m_function(0) |
|
|
75 |
, m_heaps(0) |
| 71 |
, m_builder(LLVMCreateBuilder()) |
76 |
, m_builder(LLVMCreateBuilder()) |
| 72 |
, m_block(0) |
77 |
, m_block(0) |
| 73 |
, m_nextBlock(0) |
78 |
, m_nextBlock(0) |
|
Lines 81-90
public:
Source/JavaScriptCore/ftl/FTLOutput.h_sec4
|
| 81 |
LLVMDisposeBuilder(m_builder); |
86 |
LLVMDisposeBuilder(m_builder); |
| 82 |
} |
87 |
} |
| 83 |
|
88 |
|
| 84 |
void initialize(LModule module, LValue function) |
89 |
void initialize(LModule module, LValue function, AbstractHeapRepository& heaps) |
| 85 |
{ |
90 |
{ |
| 86 |
m_module = module; |
91 |
m_module = module; |
| 87 |
m_function = function; |
92 |
m_function = function; |
|
|
93 |
m_heaps = &heaps; |
| 88 |
} |
94 |
} |
| 89 |
|
95 |
|
| 90 |
LBasicBlock appendTo(LBasicBlock block, LBasicBlock nextBlock) |
96 |
LBasicBlock appendTo(LBasicBlock block, LBasicBlock nextBlock) |
|
Lines 139-158
public:
Source/JavaScriptCore/ftl/FTLOutput.h_sec5
|
| 139 |
LValue get(LValue reference) { return buildLoad(m_builder, reference); } |
145 |
LValue get(LValue reference) { return buildLoad(m_builder, reference); } |
| 140 |
void set(LValue value, LValue reference) { buildStore(m_builder, value, reference); } |
146 |
void set(LValue value, LValue reference) { buildStore(m_builder, value, reference); } |
| 141 |
|
147 |
|
| 142 |
LValue load(LValue pointer, ptrdiff_t offset, LType refType) |
148 |
LValue load(TypedPointer pointer, ptrdiff_t offset, LType refType) |
| 143 |
{ |
149 |
{ |
| 144 |
return get(buildIntToPtr(m_builder, offset ? add(pointer, constIntPtr(offset)) : pointer, refType)); |
150 |
LValue result = get(buildIntToPtr( |
| 145 |
} |
151 |
m_builder, |
| 146 |
void store(LValue value, LValue pointer, ptrdiff_t offset, LType refType) |
152 |
offset ? add(pointer.value(), constIntPtr(offset)) : vpointer.value(), |
|
|
153 |
refType)); |
| 154 |
pointer.heap().decorateInstruction(result, *m_heaps); |
| 155 |
return result; |
| 156 |
} |
| 157 |
void store(LValue value, TypedPointer pointer, ptrdiff_t offset, LType refType) |
| 158 |
{ |
| 159 |
LValue result = set(buildIntToPtr( |
| 160 |
m_builder, |
| 161 |
offset ? add(pointer.value(), constIntPtr(offset)) : vpointer.value(), |
| 162 |
refType)); |
| 163 |
pointer.heap().decorateInstruction(result, *m_heaps); |
| 164 |
return result; |
| 165 |
} |
| 166 |
|
| 167 |
LValue load32(TypedPointer pointer, ptrdiff_t offset = 0) { return load(pointer, offset, ref32); } |
| 168 |
LValue load64(TypedPointer pointer, ptrdiff_t offset = 0) { return load(pointer, offset, ref64); } |
| 169 |
LValue loadPtr(TypedPointer pointer, ptrdiff_t offset = 0) { return load(pointer, offset, refPtr); } |
| 170 |
void store32(LValue value, TypedPointer pointer, ptrdiff_t offset = 0) { store(value, pointer, offset, ref32); } |
| 171 |
void store64(LValue value, TypedPointer pointer, ptrdiff_t offset = 0) { store(value, pointer, offset, ref64); } |
| 172 |
void storePtr(LValue value, TypedPointer pointer, ptrdiff_t offset = 0) { store(value, pointer, offset, refPtr); } |
| 173 |
|
| 174 |
LValue load32(LValue base, const AbstractField& field, ptrdiff_t offset = 0) { return load32(TypedPointer(field, base), field.offset() + offset); } |
| 175 |
LValue load64(LValue base, const AbstractField& field, ptrdiff_t offset = 0) { return load64(TypedPointer(field, base), field.offset() + offset); } |
| 176 |
LValue loadPtr(LValue base, const AbstractField& field, ptrdiff_t offset = 0) { return loadPtr(TypedPointer(field, base), field.offset() + offset); } |
| 177 |
void store32(LValue value, LValue base, const AbstractField& field, ptrdiff_t offset = 0) { store32(value, TypedPointer(field, base), field.offset() + offset); } |
| 178 |
void store64(LValue value, LValue base, const AbstractField& field, ptrdiff_t offset = 0) { store64(value, TypedPointer(field, base), field.offset() + offset); } |
| 179 |
void storePtr(LValue value, LValue base, const AbstractField& field, ptrdiff_t offset = 0) { storePtr(value, TypedPointer(field, base), field.offset() + offset); } |
| 180 |
|
| 181 |
TypedPointer address(LValue base, const AbsractField& field, ptrdiff_t offset = 0) |
| 147 |
{ |
182 |
{ |
| 148 |
set(value, buildIntToPtr(m_builder, offset ? add(pointer, constIntPtr(offset)) : pointer, refType)); |
183 |
offset += field.offset(); |
|
|
184 |
return TypedPointer(field, offset ? m_out.add(base, constIntPtr(offset)) : base); |
| 149 |
} |
185 |
} |
| 150 |
LValue load32(LValue pointer, ptrdiff_t offset = 0) { return load(pointer, offset, ref32); } |
|
|
| 151 |
LValue load64(LValue pointer, ptrdiff_t offset = 0) { return load(pointer, offset, ref64); } |
| 152 |
LValue loadPtr(LValue pointer, ptrdiff_t offset = 0) { return load(pointer, offset, refPtr); } |
| 153 |
void store32(LValue value, LValue pointer, ptrdiff_t offset = 0) { store(value, pointer, offset, ref32); } |
| 154 |
void store64(LValue value, LValue pointer, ptrdiff_t offset = 0) { store(value, pointer, offset, ref64); } |
| 155 |
void storePtr(LValue value, LValue pointer, ptrdiff_t offset = 0) { store(value, pointer, offset, refPtr); } |
| 156 |
|
186 |
|
| 157 |
LValue equal(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntEQ, left, right); } |
187 |
LValue equal(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntEQ, left, right); } |
| 158 |
LValue notEqual(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntNE, left, right); } |
188 |
LValue notEqual(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntNE, left, right); } |
|
Lines 221-226
public:
Source/JavaScriptCore/ftl/FTLOutput.h_sec6
|
| 221 |
|
251 |
|
| 222 |
LModule m_module; |
252 |
LModule m_module; |
| 223 |
LValue m_function; |
253 |
LValue m_function; |
|
|
254 |
AbstractHeapRepository* m_heaps; |
| 224 |
LBuilder m_builder; |
255 |
LBuilder m_builder; |
| 225 |
LBasicBlock m_block; |
256 |
LBasicBlock m_block; |
| 226 |
LBasicBlock m_nextBlock; |
257 |
LBasicBlock m_nextBlock; |