5#ifndef QV4BASELINEASSEMBLER_P_H
6#define QV4BASELINEASSEMBLER_P_H
19#include <private/qv4global_p.h>
20#include <private/qv4function_p.h>
30#define GENERATE_RUNTIME_CALL(function, destination)
31 callRuntime(reinterpret_cast<void *>(&Runtime::function::call),
33#define GENERATE_TAIL_CALL(function)
34 tailCallRuntime(reinterpret_cast<void *>(&function))
36class BaselineAssembler {
38 BaselineAssembler(
const Value* constantTable);
42 void generatePrologue();
43 void generateEpilogue();
44 void link(Function *function);
45 void addLabel(
int offset);
48 void loadConst(
int constIndex);
49 void copyConst(
int constIndex,
int destReg);
50 void loadReg(
int reg);
51 void moveReg(
int sourceReg,
int destReg);
52 void storeReg(
int reg);
53 void loadLocal(
int index,
int level = 0);
54 void storeLocal(
int index,
int level = 0);
55 void loadString(
int stringId);
56 void loadValue(ReturnedValue value);
57 void storeHeapObject(
int reg);
58 void loadImport(
int index);
74 void bitAndConst(
int rhs);
75 void bitOrConst(
int rhs);
76 void bitXorConst(
int rhs);
77 void ushrConst(
int rhs);
78 void shrConst(
int rhs);
79 void shlConst(
int rhs);
88 void cmpeqInt(
int lhs);
89 void cmpneInt(
int lhs);
96 void cmpStrictEqual(
int lhs);
97 void cmpStrictNotEqual(
int lhs);
100 Q_REQUIRED_RESULT
int jump(
int offset);
101 Q_REQUIRED_RESULT
int jumpTrue(
int offset);
102 Q_REQUIRED_RESULT
int jumpFalse(
int offset);
103 Q_REQUIRED_RESULT
int jumpNoException(
int offset);
104 Q_REQUIRED_RESULT
int jumpNotUndefined(
int offset);
105 Q_REQUIRED_RESULT
int jumpEqNull(
int offset);
108 void prepareCallWithArgCount(
int argc);
109 void storeInstructionPointer(
int instructionOffset);
110 void passAccumulatorAsArg(
int arg);
111 void passFunctionAsArg(
int arg);
112 void passEngineAsArg(
int arg);
113 void passJSSlotAsArg(
int reg,
int arg);
114 void passCppFrameAsArg(
int arg);
115 void passInt32AsArg(
int value,
int arg);
116 void passPointerAsArg(
void *ptr,
int arg);
117 void callRuntime(
const void *funcPtr, CallResultDestination dest);
118 void saveAccumulatorInFrame();
119 void loadAccumulatorFromFrame();
120 void jsTailCall(
int func,
int thisObject,
int argc,
int argv);
123 void checkException();
124 void gotoCatchException();
127 Q_REQUIRED_RESULT
int setUnwindHandler(
int offset);
128 void clearUnwindHandler();
129 void unwindDispatch();
130 Q_REQUIRED_RESULT
int unwindToLabel(
int level,
int offset);
131 void pushCatchContext(
int index,
int name);
133 void deadTemporalZoneCheck(
int offsetForSavedIP,
int variableName);
142 typedef unsigned(*CmpFunc)(
const Value&,
const Value&);
143 void cmp(
int cond, CmpFunc function,
int lhs);