aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-03-21 14:14:42 +0100
committerLars Knoll <lars.knoll@digia.com>2013-03-21 16:10:58 +0100
commit4ac046078a588650a77926980cda21a54102905f (patch)
tree5da5d057b1122f409268b04dd5fe5a6f4320ee70 /src
parent9a3b477856ebaeebdaed7e9747634a17cff43601 (diff)
Move V4 IR into its own V4IR namespace to avoid clash with QtDeclarative
Change-Id: Iddaedeb72b41cab35c3cd51fc07440dffcea81c2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/v4/debugging.cpp8
-rw-r--r--src/v4/debugging.h16
-rw-r--r--src/v4/moth/qv4isel_moth.cpp266
-rw-r--r--src/v4/moth/qv4isel_moth_p.h132
-rw-r--r--src/v4/qv4codegen.cpp776
-rw-r--r--src/v4/qv4codegen_p.h70
-rw-r--r--src/v4/qv4engine.cpp6
-rw-r--r--src/v4/qv4functionobject.cpp4
-rw-r--r--src/v4/qv4globalobject.cpp4
-rw-r--r--src/v4/qv4isel_masm.cpp266
-rw-r--r--src/v4/qv4isel_masm_p.h188
-rw-r--r--src/v4/qv4isel_p.cpp166
-rw-r--r--src/v4/qv4isel_p.h120
-rw-r--r--src/v4/qv4isel_util_p.h12
-rw-r--r--src/v4/qv4jsir.cpp40
-rw-r--r--src/v4/qv4jsir_p.h18
-rw-r--r--src/v4/qv4v8.cpp6
17 files changed, 1049 insertions, 1049 deletions
diff --git a/src/v4/debugging.cpp b/src/v4/debugging.cpp
index 82cdd1b348..a9bedbce6c 100644
--- a/src/v4/debugging.cpp
+++ b/src/v4/debugging.cpp
@@ -94,17 +94,17 @@ Debugger::~Debugger()
qDeleteAll(_functionInfo.values());
}
-void Debugger::addFunction(IR::Function *function)
+void Debugger::addFunction(V4IR::Function *function)
{
_functionInfo.insert(function, new FunctionDebugInfo(function));
}
-void Debugger::setSourceLocation(IR::Function *function, unsigned line, unsigned column)
+void Debugger::setSourceLocation(V4IR::Function *function, unsigned line, unsigned column)
{
_functionInfo[function]->setSourceLocation(line, column);
}
-void Debugger::mapFunction(VM::Function *vmf, IR::Function *irf)
+void Debugger::mapFunction(VM::Function *vmf, V4IR::Function *irf)
{
_vmToIr.insert(vmf, irf);
}
@@ -208,7 +208,7 @@ int Debugger::callIndex(VM::ExecutionContext *context)
return -1;
}
-IR::Function *Debugger::irFunction(VM::Function *vmf) const
+V4IR::Function *Debugger::irFunction(VM::Function *vmf) const
{
return _vmToIr[vmf];
}
diff --git a/src/v4/debugging.h b/src/v4/debugging.h
index feb54991b6..a252936055 100644
--- a/src/v4/debugging.h
+++ b/src/v4/debugging.h
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
namespace QQmlJS {
-namespace IR {
+namespace V4IR {
struct BasicBlock;
struct Function;
} // namespace IR
@@ -53,7 +53,7 @@ struct FunctionDebugInfo { // TODO: use opaque d-pointers here
QString name;
unsigned startLine, startColumn;
- FunctionDebugInfo(IR::Function *function):
+ FunctionDebugInfo(V4IR::Function *function):
startLine(0), startColumn(0)
{
if (function->name)
@@ -104,9 +104,9 @@ public:
~Debugger();
public: // compile-time interface
- void addFunction(IR::Function *function);
- void setSourceLocation(IR::Function *function, unsigned line, unsigned column);
- void mapFunction(VM::Function *vmf, IR::Function *irf);
+ void addFunction(V4IR::Function *function);
+ void setSourceLocation(V4IR::Function *function, unsigned line, unsigned column);
+ void mapFunction(VM::Function *vmf, V4IR::Function *irf);
public: // run-time querying interface
FunctionDebugInfo *debugInfo(VM::FunctionObject *function) const;
@@ -128,12 +128,12 @@ public: // debugging hooks
private:
int callIndex(VM::ExecutionContext *context);
- IR::Function *irFunction(VM::Function *vmf) const;
+ V4IR::Function *irFunction(VM::Function *vmf) const;
private: // TODO: use opaque d-pointers here
VM::ExecutionEngine *_engine;
- QHash<IR::Function *, FunctionDebugInfo *> _functionInfo;
- QHash<VM::Function *, IR::Function *> _vmToIr;
+ QHash<V4IR::Function *, FunctionDebugInfo *> _functionInfo;
+ QHash<VM::Function *, V4IR::Function *> _vmToIr;
QVector<CallInfo> _callStack;
};
diff --git a/src/v4/moth/qv4isel_moth.cpp b/src/v4/moth/qv4isel_moth.cpp
index 7684a1b288..31bf1fb36d 100644
--- a/src/v4/moth/qv4isel_moth.cpp
+++ b/src/v4/moth/qv4isel_moth.cpp
@@ -10,66 +10,66 @@ using namespace QQmlJS::Moth;
namespace {
-inline VM::BinOp aluOpFunction(IR::AluOp op)
+inline VM::BinOp aluOpFunction(V4IR::AluOp op)
{
switch (op) {
- case IR::OpInvalid:
+ case V4IR::OpInvalid:
return 0;
- case IR::OpIfTrue:
+ case V4IR::OpIfTrue:
return 0;
- case IR::OpNot:
+ case V4IR::OpNot:
return 0;
- case IR::OpUMinus:
+ case V4IR::OpUMinus:
return 0;
- case IR::OpUPlus:
+ case V4IR::OpUPlus:
return 0;
- case IR::OpCompl:
+ case V4IR::OpCompl:
return 0;
- case IR::OpBitAnd:
+ case V4IR::OpBitAnd:
return VM::__qmljs_bit_and;
- case IR::OpBitOr:
+ case V4IR::OpBitOr:
return VM::__qmljs_bit_or;
- case IR::OpBitXor:
+ case V4IR::OpBitXor:
return VM::__qmljs_bit_xor;
- case IR::OpAdd:
+ case V4IR::OpAdd:
return VM::__qmljs_add;
- case IR::OpSub:
+ case V4IR::OpSub:
return VM::__qmljs_sub;
- case IR::OpMul:
+ case V4IR::OpMul:
return VM::__qmljs_mul;
- case IR::OpDiv:
+ case V4IR::OpDiv:
return VM::__qmljs_div;
- case IR::OpMod:
+ case V4IR::OpMod:
return VM::__qmljs_mod;
- case IR::OpLShift:
+ case V4IR::OpLShift:
return VM::__qmljs_shl;
- case IR::OpRShift:
+ case V4IR::OpRShift:
return VM::__qmljs_shr;
- case IR::OpURShift:
+ case V4IR::OpURShift:
return VM::__qmljs_ushr;
- case IR::OpGt:
+ case V4IR::OpGt:
return VM::__qmljs_gt;
- case IR::OpLt:
+ case V4IR::OpLt:
return VM::__qmljs_lt;
- case IR::OpGe:
+ case V4IR::OpGe:
return VM::__qmljs_ge;
- case IR::OpLe:
+ case V4IR::OpLe:
return VM::__qmljs_le;
- case IR::OpEqual:
+ case V4IR::OpEqual:
return VM::__qmljs_eq;
- case IR::OpNotEqual:
+ case V4IR::OpNotEqual:
return VM::__qmljs_ne;
- case IR::OpStrictEqual:
+ case V4IR::OpStrictEqual:
return VM::__qmljs_se;
- case IR::OpStrictNotEqual:
+ case V4IR::OpStrictNotEqual:
return VM::__qmljs_sne;
- case IR::OpInstanceof:
+ case V4IR::OpInstanceof:
return VM::__qmljs_instanceof;
- case IR::OpIn:
+ case V4IR::OpIn:
return VM::__qmljs_in;
- case IR::OpAnd:
+ case V4IR::OpAnd:
return 0;
- case IR::OpOr:
+ case V4IR::OpOr:
return 0;
default:
assert(!"Unknown AluOp");
@@ -79,7 +79,7 @@ inline VM::BinOp aluOpFunction(IR::AluOp op)
} // anonymous namespace
-InstructionSelection::InstructionSelection(VM::ExecutionEngine *engine, IR::Module *module)
+InstructionSelection::InstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module)
: EvalInstructionSelection(engine, module)
, _function(0)
, _vmFunction(0)
@@ -94,12 +94,12 @@ InstructionSelection::~InstructionSelection()
{
}
-void InstructionSelection::run(VM::Function *vmFunction, IR::Function *function)
+void InstructionSelection::run(VM::Function *vmFunction, V4IR::Function *function)
{
- IR::BasicBlock *block;
+ V4IR::BasicBlock *block;
- QHash<IR::BasicBlock *, QVector<ptrdiff_t> > patches;
- QHash<IR::BasicBlock *, ptrdiff_t> addrs;
+ QHash<V4IR::BasicBlock *, QVector<ptrdiff_t> > patches;
+ QHash<V4IR::BasicBlock *, ptrdiff_t> addrs;
int codeSize = 4096;
uchar *codeStart = new uchar[codeSize];
@@ -125,7 +125,7 @@ void InstructionSelection::run(VM::Function *vmFunction, IR::Function *function)
foreach (_block, _function->basicBlocks) {
_addrs.insert(_block, _codeNext - _codeStart);
- foreach (IR::Stmt *s, _block->statements)
+ foreach (V4IR::Stmt *s, _block->statements)
s->accept(this);
}
@@ -146,7 +146,7 @@ void InstructionSelection::run(VM::Function *vmFunction, IR::Function *function)
delete[] codeStart;
}
-void InstructionSelection::callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result)
{
Instruction::CallValue call;
prepareCallArgs(args, call.argc, call.args);
@@ -155,7 +155,7 @@ void InstructionSelection::callValue(IR::Temp *value, IR::ExprList *args, IR::Te
addInstruction(call);
}
-void InstructionSelection::callProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::callProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result)
{
// call the property on the loaded base
Instruction::CallProperty call;
@@ -166,7 +166,7 @@ void InstructionSelection::callProperty(IR::Temp *base, const QString &name, IR:
addInstruction(call);
}
-void InstructionSelection::callSubscript(IR::Temp *base, IR::Temp *index, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::callSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::ExprList *args, V4IR::Temp *result)
{
// call the property on the loaded base
Instruction::CallElement call;
@@ -177,9 +177,9 @@ void InstructionSelection::callSubscript(IR::Temp *base, IR::Temp *index, IR::Ex
addInstruction(call);
}
-void InstructionSelection::constructActivationProperty(IR::Name *func,
- IR::ExprList *args,
- IR::Temp *result)
+void InstructionSelection::constructActivationProperty(V4IR::Name *func,
+ V4IR::ExprList *args,
+ V4IR::Temp *result)
{
Instruction::CreateActivationProperty create;
create.name = identifier(*func->id);
@@ -188,7 +188,7 @@ void InstructionSelection::constructActivationProperty(IR::Name *func,
addInstruction(create);
}
-void InstructionSelection::constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result)
{
Instruction::CreateProperty create;
create.base = getParam(base);
@@ -198,7 +198,7 @@ void InstructionSelection::constructProperty(IR::Temp *base, const QString &name
addInstruction(create);
}
-void InstructionSelection::constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result)
{
Instruction::CreateValue create;
create.func = getParam(value);
@@ -207,14 +207,14 @@ void InstructionSelection::constructValue(IR::Temp *value, IR::ExprList *args, I
addInstruction(create);
}
-void InstructionSelection::loadThisObject(IR::Temp *temp)
+void InstructionSelection::loadThisObject(V4IR::Temp *temp)
{
Instruction::LoadThis load;
load.result = getResultParam(temp);
addInstruction(load);
}
-void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Temp *targetTemp)
+void InstructionSelection::loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp)
{
assert(sourceConst);
@@ -224,7 +224,7 @@ void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Temp *targetTem
addInstruction(load);
}
-void InstructionSelection::loadString(const QString &str, IR::Temp *targetTemp)
+void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp)
{
Instruction::LoadValue load;
load.value = Instr::Param::createValue(VM::Value::fromString(identifier(str)));
@@ -232,7 +232,7 @@ void InstructionSelection::loadString(const QString &str, IR::Temp *targetTemp)
addInstruction(load);
}
-void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp)
+void InstructionSelection::loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp)
{
VM::Value v = VM::Value::fromObject(engine()->newRegExpObject(
*sourceRegexp->value,
@@ -245,7 +245,7 @@ void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *target
addInstruction(load);
}
-void InstructionSelection::getActivationProperty(const QString &name, IR::Temp *temp)
+void InstructionSelection::getActivationProperty(const QString &name, V4IR::Temp *temp)
{
Instruction::LoadName load;
load.name = identifier(name);
@@ -253,7 +253,7 @@ void InstructionSelection::getActivationProperty(const QString &name, IR::Temp *
addInstruction(load);
}
-void InstructionSelection::setActivationProperty(IR::Temp *source, const QString &targetName)
+void InstructionSelection::setActivationProperty(V4IR::Temp *source, const QString &targetName)
{
Instruction::StoreName store;
store.source = getParam(source);
@@ -261,7 +261,7 @@ void InstructionSelection::setActivationProperty(IR::Temp *source, const QString
addInstruction(store);
}
-void InstructionSelection::initClosure(IR::Closure *closure, IR::Temp *target)
+void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *target)
{
VM::Function *vmFunc = vmFunction(closure->value);
assert(vmFunc);
@@ -271,7 +271,7 @@ void InstructionSelection::initClosure(IR::Closure *closure, IR::Temp *target)
addInstruction(load);
}
-void InstructionSelection::getProperty(IR::Temp *base, const QString &name, IR::Temp *target)
+void InstructionSelection::getProperty(V4IR::Temp *base, const QString &name, V4IR::Temp *target)
{
Instruction::LoadProperty load;
load.base = getParam(base);
@@ -280,7 +280,7 @@ void InstructionSelection::getProperty(IR::Temp *base, const QString &name, IR::
addInstruction(load);
}
-void InstructionSelection::setProperty(IR::Temp *source, IR::Temp *targetBase, const QString &targetName)
+void InstructionSelection::setProperty(V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName)
{
Instruction::StoreProperty store;
store.base = getParam(targetBase);
@@ -289,7 +289,7 @@ void InstructionSelection::setProperty(IR::Temp *source, IR::Temp *targetBase, c
addInstruction(store);
}
-void InstructionSelection::getElement(IR::Temp *base, IR::Temp *index, IR::Temp *target)
+void InstructionSelection::getElement(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *target)
{
Instruction::LoadElement load;
load.base = getParam(base);
@@ -298,7 +298,7 @@ void InstructionSelection::getElement(IR::Temp *base, IR::Temp *index, IR::Temp
addInstruction(load);
}
-void InstructionSelection::setElement(IR::Temp *source, IR::Temp *targetBase, IR::Temp *targetIndex)
+void InstructionSelection::setElement(V4IR::Temp *source, V4IR::Temp *targetBase, V4IR::Temp *targetIndex)
{
Instruction::StoreElement store;
store.base = getParam(targetBase);
@@ -307,7 +307,7 @@ void InstructionSelection::setElement(IR::Temp *source, IR::Temp *targetBase, IR
addInstruction(store);
}
-void InstructionSelection::copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp)
+void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
{
Instruction::MoveTemp move;
move.source = getParam(sourceTemp);
@@ -315,17 +315,17 @@ void InstructionSelection::copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp)
addInstruction(move);
}
-void InstructionSelection::unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp)
+void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
{
VM::UnaryOpName op = 0;
switch (oper) {
- case IR::OpIfTrue: assert(!"unreachable"); break;
- case IR::OpNot: op = VM::__qmljs_not; break;
- case IR::OpUMinus: op = VM::__qmljs_uminus; break;
- case IR::OpUPlus: op = VM::__qmljs_uplus; break;
- case IR::OpCompl: op = VM::__qmljs_compl; break;
- case IR::OpIncrement: op = VM::__qmljs_increment; break;
- case IR::OpDecrement: op = VM::__qmljs_decrement; break;
+ case V4IR::OpIfTrue: assert(!"unreachable"); break;
+ case V4IR::OpNot: op = VM::__qmljs_not; break;
+ case V4IR::OpUMinus: op = VM::__qmljs_uminus; break;
+ case V4IR::OpUPlus: op = VM::__qmljs_uplus; break;
+ case V4IR::OpCompl: op = VM::__qmljs_compl; break;
+ case V4IR::OpIncrement: op = VM::__qmljs_increment; break;
+ case V4IR::OpDecrement: op = VM::__qmljs_decrement; break;
default: assert(!"unreachable"); break;
} // switch
@@ -340,7 +340,7 @@ void InstructionSelection::unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *
}
}
-void InstructionSelection::binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target)
+void InstructionSelection::binop(V4IR::AluOp oper, V4IR::Temp *leftSource, V4IR::Temp *rightSource, V4IR::Temp *target)
{
Instruction::Binop binop;
binop.alu = aluOpFunction(oper);
@@ -350,21 +350,21 @@ void InstructionSelection::binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp
addInstruction(binop);
}
-void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName)
+void InstructionSelection::inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSource, const QString &targetName)
{
VM::InplaceBinOpName op = 0;
switch (oper) {
- case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_name; break;
- case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_name; break;
- case IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_name; break;
- case IR::OpAdd: op = VM::__qmljs_inplace_add_name; break;
- case IR::OpSub: op = VM::__qmljs_inplace_sub_name; break;
- case IR::OpMul: op = VM::__qmljs_inplace_mul_name; break;
- case IR::OpDiv: op = VM::__qmljs_inplace_div_name; break;
- case IR::OpMod: op = VM::__qmljs_inplace_mod_name; break;
- case IR::OpLShift: op = VM::__qmljs_inplace_shl_name; break;
- case IR::OpRShift: op = VM::__qmljs_inplace_shr_name; break;
- case IR::OpURShift: op = VM::__qmljs_inplace_ushr_name; break;
+ case V4IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_name; break;
+ case V4IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_name; break;
+ case V4IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_name; break;
+ case V4IR::OpAdd: op = VM::__qmljs_inplace_add_name; break;
+ case V4IR::OpSub: op = VM::__qmljs_inplace_sub_name; break;
+ case V4IR::OpMul: op = VM::__qmljs_inplace_mul_name; break;
+ case V4IR::OpDiv: op = VM::__qmljs_inplace_div_name; break;
+ case V4IR::OpMod: op = VM::__qmljs_inplace_mod_name; break;
+ case V4IR::OpLShift: op = VM::__qmljs_inplace_shl_name; break;
+ case V4IR::OpRShift: op = VM::__qmljs_inplace_shr_name; break;
+ case V4IR::OpURShift: op = VM::__qmljs_inplace_ushr_name; break;
default: break;
}
@@ -377,21 +377,21 @@ void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource,
}
}
-void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp)
+void InstructionSelection::inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBaseTemp, V4IR::Temp *targetIndexTemp)
{
VM::InplaceBinOpElement op = 0;
switch (oper) {
- case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_element; break;
- case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_element; break;
- case IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_element; break;
- case IR::OpAdd: op = VM::__qmljs_inplace_add_element; break;
- case IR::OpSub: op = VM::__qmljs_inplace_sub_element; break;
- case IR::OpMul: op = VM::__qmljs_inplace_mul_element; break;
- case IR::OpDiv: op = VM::__qmljs_inplace_div_element; break;
- case IR::OpMod: op = VM::__qmljs_inplace_mod_element; break;
- case IR::OpLShift: op = VM::__qmljs_inplace_shl_element; break;
- case IR::OpRShift: op = VM::__qmljs_inplace_shr_element; break;
- case IR::OpURShift: op = VM::__qmljs_inplace_ushr_element; break;
+ case V4IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_element; break;
+ case V4IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_element; break;
+ case V4IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_element; break;
+ case V4IR::OpAdd: op = VM::__qmljs_inplace_add_element; break;
+ case V4IR::OpSub: op = VM::__qmljs_inplace_sub_element; break;
+ case V4IR::OpMul: op = VM::__qmljs_inplace_mul_element; break;
+ case V4IR::OpDiv: op = VM::__qmljs_inplace_div_element; break;
+ case V4IR::OpMod: op = VM::__qmljs_inplace_mod_element; break;
+ case V4IR::OpLShift: op = VM::__qmljs_inplace_shl_element; break;
+ case V4IR::OpRShift: op = VM::__qmljs_inplace_shr_element; break;
+ case V4IR::OpURShift: op = VM::__qmljs_inplace_ushr_element; break;
default: break;
}
@@ -403,21 +403,21 @@ void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR
addInstruction(ieo);
}
-void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName)
+void InstructionSelection::inplaceMemberOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName)
{
VM::InplaceBinOpMember op = 0;
switch (oper) {
- case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_member; break;
- case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_member; break;
- case IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_member; break;
- case IR::OpAdd: op = VM::__qmljs_inplace_add_member; break;
- case IR::OpSub: op = VM::__qmljs_inplace_sub_member; break;
- case IR::OpMul: op = VM::__qmljs_inplace_mul_member; break;
- case IR::OpDiv: op = VM::__qmljs_inplace_div_member; break;
- case IR::OpMod: op = VM::__qmljs_inplace_mod_member; break;
- case IR::OpLShift: op = VM::__qmljs_inplace_shl_member; break;
- case IR::OpRShift: op = VM::__qmljs_inplace_shr_member; break;
- case IR::OpURShift: op = VM::__qmljs_inplace_ushr_member; break;
+ case V4IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_member; break;
+ case V4IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_member; break;
+ case V4IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_member; break;
+ case V4IR::OpAdd: op = VM::__qmljs_inplace_add_member; break;
+ case V4IR::OpSub: op = VM::__qmljs_inplace_sub_member; break;
+ case V4IR::OpMul: op = VM::__qmljs_inplace_mul_member; break;
+ case V4IR::OpDiv: op = VM::__qmljs_inplace_div_member; break;
+ case V4IR::OpMod: op = VM::__qmljs_inplace_mod_member; break;
+ case V4IR::OpLShift: op = VM::__qmljs_inplace_shl_member; break;
+ case V4IR::OpRShift: op = VM::__qmljs_inplace_shr_member; break;
+ case V4IR::OpURShift: op = VM::__qmljs_inplace_ushr_member; break;
default: break;
}
@@ -429,7 +429,7 @@ void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR:
addInstruction(imo);
}
-void InstructionSelection::prepareCallArgs(IR::ExprList *e, quint32 &argc, quint32 &args)
+void InstructionSelection::prepareCallArgs(V4IR::ExprList *e, quint32 &argc, quint32 &args)
{
bool singleArgIsTemp = false;
if (e && e->next == 0 && e->expr->asTemp()) {
@@ -465,7 +465,7 @@ void InstructionSelection::prepareCallArgs(IR::ExprList *e, quint32 &argc, quint
}
}
-void InstructionSelection::visitJump(IR::Jump *s)
+void InstructionSelection::visitJump(V4IR::Jump *s)
{
Instruction::Jump jump;
jump.offset = 0;
@@ -474,12 +474,12 @@ void InstructionSelection::visitJump(IR::Jump *s)
_patches[s->target].append(loc);
}
-void InstructionSelection::visitCJump(IR::CJump *s)
+void InstructionSelection::visitCJump(V4IR::CJump *s)
{
Instr::Param condition;
- if (IR::Temp *t = s->cond->asTemp()) {
+ if (V4IR::Temp *t = s->cond->asTemp()) {
condition = getResultParam(t);
- } else if (IR::Binop *b = s->cond->asBinop()) {
+ } else if (V4IR::Binop *b = s->cond->asBinop()) {
condition = getResultParam(0);
Instruction::Binop binop;
binop.alu = aluOpFunction(b->op);
@@ -505,14 +505,14 @@ void InstructionSelection::visitCJump(IR::CJump *s)
}
}
-void InstructionSelection::visitRet(IR::Ret *s)
+void InstructionSelection::visitRet(V4IR::Ret *s)
{
Instruction::Ret ret;
ret.result = getParam(s->expr);
addInstruction(ret);
}
-void InstructionSelection::visitTry(IR::Try *t)
+void InstructionSelection::visitTry(V4IR::Try *t)
{
Instruction::EnterTry enterTry;
enterTry.tryOffset = 0;
@@ -528,7 +528,7 @@ void InstructionSelection::visitTry(IR::Try *t)
_patches[t->catchBlock].append(catchLoc);
}
-void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
Instruction::CallActivationProperty call;
call.name = identifier(*func->id);
@@ -537,7 +537,7 @@ void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args
addInstruction(call);
}
-void InstructionSelection::callBuiltinTypeofMember(IR::Temp *base, const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinTypeofMember call;
call.base = getParam(base);
@@ -546,7 +546,7 @@ void InstructionSelection::callBuiltinTypeofMember(IR::Temp *base, const QString
addInstruction(call);
}
-void InstructionSelection::callBuiltinTypeofSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
{
Instruction::CallBuiltinTypeofSubscript call;
call.base = getParam(base);
@@ -555,7 +555,7 @@ void InstructionSelection::callBuiltinTypeofSubscript(IR::Temp *base, IR::Temp *
addInstruction(call);
}
-void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofName(const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinTypeofName call;
call.name = identifier(name);
@@ -563,7 +563,7 @@ void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Temp *
addInstruction(call);
}
-void InstructionSelection::callBuiltinTypeofValue(IR::Temp *value, IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofValue(V4IR::Temp *value, V4IR::Temp *result)
{
Instruction::CallBuiltinTypeofValue call;
call.value = getParam(value);
@@ -571,7 +571,7 @@ void InstructionSelection::callBuiltinTypeofValue(IR::Temp *value, IR::Temp *res
addInstruction(call);
}
-void InstructionSelection::callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinDeleteMember call;
call.base = getParam(base);
@@ -580,7 +580,7 @@ void InstructionSelection::callBuiltinDeleteMember(IR::Temp *base, const QString
addInstruction(call);
}
-void InstructionSelection::callBuiltinDeleteSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
{
Instruction::CallBuiltinDeleteSubscript call;
call.base = getParam(base);
@@ -589,7 +589,7 @@ void InstructionSelection::callBuiltinDeleteSubscript(IR::Temp *base, IR::Temp *
addInstruction(call);
}
-void InstructionSelection::callBuiltinDeleteName(const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinDeleteName call;
call.name = identifier(name);
@@ -597,7 +597,7 @@ void InstructionSelection::callBuiltinDeleteName(const QString &name, IR::Temp *
addInstruction(call);
}
-void InstructionSelection::callBuiltinDeleteValue(IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result)
{
Instruction::LoadValue load;
load.value = Instr::Param::createValue(VM::Value::fromBoolean(false));
@@ -605,7 +605,7 @@ void InstructionSelection::callBuiltinDeleteValue(IR::Temp *result)
addInstruction(load);
}
-void InstructionSelection::callBuiltinPostDecrementMember(IR::Temp *base, const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinPostDecrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinPostDecMember call;
call.base = getParam(base);
@@ -614,7 +614,7 @@ void InstructionSelection::callBuiltinPostDecrementMember(IR::Temp *base, const
addInstruction(call);
}
-void InstructionSelection::callBuiltinPostDecrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
+void InstructionSelection::callBuiltinPostDecrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
{
Instruction::CallBuiltinPostDecSubscript call;
call.base = getParam(base);
@@ -623,7 +623,7 @@ void InstructionSelection::callBuiltinPostDecrementSubscript(IR::Temp *base, IR:
addInstruction(call);
}
-void InstructionSelection::callBuiltinPostDecrementName(const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinPostDecrementName(const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinPostDecName call;
call.name = identifier(name);
@@ -631,7 +631,7 @@ void InstructionSelection::callBuiltinPostDecrementName(const QString &name, IR:
addInstruction(call);
}
-void InstructionSelection::callBuiltinPostDecrementValue(IR::Temp *value, IR::Temp *result)
+void InstructionSelection::callBuiltinPostDecrementValue(V4IR::Temp *value, V4IR::Temp *result)
{
Instruction::CallBuiltinPostDecValue call;
call.value = getParam(value);
@@ -639,7 +639,7 @@ void InstructionSelection::callBuiltinPostDecrementValue(IR::Temp *value, IR::Te
addInstruction(call);
}
-void InstructionSelection::callBuiltinPostIncrementMember(IR::Temp *base, const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinPostIncrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinPostIncMember call;
call.base = getParam(base);
@@ -648,7 +648,7 @@ void InstructionSelection::callBuiltinPostIncrementMember(IR::Temp *base, const
addInstruction(call);
}
-void InstructionSelection::callBuiltinPostIncrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
+void InstructionSelection::callBuiltinPostIncrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
{
Instruction::CallBuiltinPostIncSubscript call;
call.base = getParam(base);
@@ -657,7 +657,7 @@ void InstructionSelection::callBuiltinPostIncrementSubscript(IR::Temp *base, IR:
addInstruction(call);
}
-void InstructionSelection::callBuiltinPostIncrementName(const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinPostIncrementName(const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinPostIncName call;
call.name = identifier(name);
@@ -665,7 +665,7 @@ void InstructionSelection::callBuiltinPostIncrementName(const QString &name, IR:
addInstruction(call);
}
-void InstructionSelection::callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result)
+void InstructionSelection::callBuiltinPostIncrementValue(V4IR::Temp *value, V4IR::Temp *result)
{
Instruction::CallBuiltinPostIncValue call;
call.value = getParam(value);
@@ -673,7 +673,7 @@ void InstructionSelection::callBuiltinPostIncrementValue(IR::Temp *value, IR::Te
addInstruction(call);
}
-void InstructionSelection::callBuiltinThrow(IR::Temp *arg)
+void InstructionSelection::callBuiltinThrow(V4IR::Temp *arg)
{
Instruction::CallBuiltinThrow call;
call.arg = getParam(arg);
@@ -686,7 +686,7 @@ void InstructionSelection::callBuiltinFinishTry()
addInstruction(call);
}
-void InstructionSelection::callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result)
+void InstructionSelection::callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result)
{
Instruction::CallBuiltinForeachIteratorObject call;
call.arg = getParam(arg);
@@ -694,7 +694,7 @@ void InstructionSelection::callBuiltinForeachIteratorObject(IR::Temp *arg, IR::T
addInstruction(call);
}
-void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result)
+void InstructionSelection::callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result)
{
Instruction::CallBuiltinForeachNextPropertyName call;
call.arg = getParam(arg);
@@ -702,7 +702,7 @@ void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Temp *arg, IR:
addInstruction(call);
}
-void InstructionSelection::callBuiltinPushWithScope(IR::Temp *arg)
+void InstructionSelection::callBuiltinPushWithScope(V4IR::Temp *arg)
{
Instruction::CallBuiltinPushScope call;
call.arg = getParam(arg);
@@ -723,7 +723,7 @@ void InstructionSelection::callBuiltinDeclareVar(bool deletable, const QString &
addInstruction(call);
}
-void InstructionSelection::callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter)
+void InstructionSelection::callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter)
{
Instruction::CallBuiltinDefineGetterSetter call;
call.object = getParam(object);
@@ -733,7 +733,7 @@ void InstructionSelection::callBuiltinDefineGetterSetter(IR::Temp *object, const
addInstruction(call);
}
-void InstructionSelection::callBuiltinDefineProperty(IR::Temp *object, const QString &name, IR::Temp *value)
+void InstructionSelection::callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, V4IR::Temp *value)
{
Instruction::CallBuiltinDefineProperty call;
call.object = getParam(object);
@@ -742,7 +742,7 @@ void InstructionSelection::callBuiltinDefineProperty(IR::Temp *object, const QSt
addInstruction(call);
}
-void InstructionSelection::callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args)
+void InstructionSelection::callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args)
{
Instruction::CallBuiltinDefineArray call;
prepareCallArgs(args, call.argc, call.args);
@@ -779,7 +779,7 @@ ptrdiff_t InstructionSelection::addInstructionHelper(Instr::Type type, Instr &in
void InstructionSelection::patchJumpAddresses()
{
- typedef QHash<IR::BasicBlock *, QVector<ptrdiff_t> >::ConstIterator PatchIt;
+ typedef QHash<V4IR::BasicBlock *, QVector<ptrdiff_t> >::ConstIterator PatchIt;
for (PatchIt i = _patches.begin(), ei = _patches.end(); i != ei; ++i) {
Q_ASSERT(_addrs.contains(i.key()));
ptrdiff_t target = _addrs.value(i.key());
diff --git a/src/v4/moth/qv4isel_moth_p.h b/src/v4/moth/qv4isel_moth_p.h
index 2d5dec476b..14de9e8f9a 100644
--- a/src/v4/moth/qv4isel_moth_p.h
+++ b/src/v4/moth/qv4isel_moth_p.h
@@ -11,71 +11,71 @@ namespace QQmlJS {
namespace Moth {
class Q_V4_EXPORT InstructionSelection:
- public IR::InstructionSelection,
+ public V4IR::InstructionSelection,
public EvalInstructionSelection
{
public:
- InstructionSelection(VM::ExecutionEngine *engine, IR::Module *module);
+ InstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module);
~InstructionSelection();
- virtual void run(VM::Function *vmFunction, IR::Function *function);
+ virtual void run(VM::Function *vmFunction, V4IR::Function *function);
protected:
- virtual void visitJump(IR::Jump *);
- virtual void visitCJump(IR::CJump *);
- virtual void visitRet(IR::Ret *);
- virtual void visitTry(IR::Try *);
-
- virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result);
- virtual void callBuiltinTypeofMember(IR::Temp *base, const QString &name, IR::Temp *result);
- virtual void callBuiltinTypeofSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result);
- virtual void callBuiltinTypeofName(const QString &name, IR::Temp *result);
- virtual void callBuiltinTypeofValue(IR::Temp *value, IR::Temp *result);
- virtual void callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result);
- virtual void callBuiltinDeleteSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result);
- virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result);
- virtual void callBuiltinDeleteValue(IR::Temp *result);
- virtual void callBuiltinPostDecrementMember(IR::Temp *base, const QString &name, IR::Temp *result);
- virtual void callBuiltinPostDecrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result);
- virtual void callBuiltinPostDecrementName(const QString &name, IR::Temp *result);
- virtual void callBuiltinPostDecrementValue(IR::Temp *value, IR::Temp *result);
- virtual void callBuiltinPostIncrementMember(IR::Temp *base, const QString &name, IR::Temp *result);
- virtual void callBuiltinPostIncrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result);
- virtual void callBuiltinPostIncrementName(const QString &name, IR::Temp *result);
- virtual void callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result);
- virtual void callBuiltinThrow(IR::Temp *arg);
+ virtual void visitJump(V4IR::Jump *);
+ virtual void visitCJump(V4IR::CJump *);
+ virtual void visitRet(V4IR::Ret *);
+ virtual void visitTry(V4IR::Try *);
+
+ virtual void callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void callBuiltinTypeofMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinTypeofSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result);
+ virtual void callBuiltinTypeofName(const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinTypeofValue(V4IR::Temp *value, V4IR::Temp *result);
+ virtual void callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result);
+ virtual void callBuiltinDeleteName(const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinDeleteValue(V4IR::Temp *result);
+ virtual void callBuiltinPostDecrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinPostDecrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result);
+ virtual void callBuiltinPostDecrementName(const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinPostDecrementValue(V4IR::Temp *value, V4IR::Temp *result);
+ virtual void callBuiltinPostIncrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinPostIncrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result);
+ virtual void callBuiltinPostIncrementName(const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinPostIncrementValue(V4IR::Temp *value, V4IR::Temp *result);
+ virtual void callBuiltinThrow(V4IR::Temp *arg);
virtual void callBuiltinFinishTry();
- virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result);
- virtual void callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result);
- virtual void callBuiltinPushWithScope(IR::Temp *arg);
+ virtual void callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result);
+ virtual void callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result);
+ virtual void callBuiltinPushWithScope(V4IR::Temp *arg);
virtual void callBuiltinPopScope();
virtual void callBuiltinDeclareVar(bool deletable, const QString &name);
- virtual void callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter);
- virtual void callBuiltinDefineProperty(IR::Temp *object, const QString &name, IR::Temp *value);
- virtual void callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args);
- virtual void callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result);
- virtual void callProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result);
- virtual void callSubscript(IR::Temp *base, IR::Temp *index, IR::ExprList *args, IR::Temp *result);
- virtual void constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result);
- virtual void constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result);
- virtual void constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result);
- virtual void loadThisObject(IR::Temp *temp);
- virtual void loadConst(IR::Const *sourceConst, IR::Temp *targetTemp);
- virtual void loadString(const QString &str, IR::Temp *targetTemp);
- virtual void loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp);
- virtual void getActivationProperty(const QString &name, IR::Temp *temp);
- virtual void setActivationProperty(IR::Temp *source, const QString &targetName);
- virtual void initClosure(IR::Closure *closure, IR::Temp *target);
- virtual void getProperty(IR::Temp *base, const QString &name, IR::Temp *target);
- virtual void setProperty(IR::Temp *source, IR::Temp *targetBase, const QString &targetName);
- virtual void getElement(IR::Temp *base, IR::Temp *index, IR::Temp *target);
- virtual void setElement(IR::Temp *source, IR::Temp *targetBase, IR::Temp *targetIndex);
- virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp);
- virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp);
- virtual void binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target);
- virtual void inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName);
- virtual void inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp);
- virtual void inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName);
+ virtual void callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter);
+ virtual void callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, V4IR::Temp *value);
+ virtual void callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args);
+ virtual void callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void callProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void callSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void loadThisObject(V4IR::Temp *temp);
+ virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp);
+ virtual void loadString(const QString &str, V4IR::Temp *targetTemp);
+ virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp);
+ virtual void getActivationProperty(const QString &name, V4IR::Temp *temp);
+ virtual void setActivationProperty(V4IR::Temp *source, const QString &targetName);
+ virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target);
+ virtual void getProperty(V4IR::Temp *base, const QString &name, V4IR::Temp *target);
+ virtual void setProperty(V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName);
+ virtual void getElement(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *target);
+ virtual void setElement(V4IR::Temp *source, V4IR::Temp *targetBase, V4IR::Temp *targetIndex);
+ virtual void copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
+ virtual void unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
+ virtual void binop(V4IR::AluOp oper, V4IR::Temp *leftSource, V4IR::Temp *rightSource, V4IR::Temp *target);
+ virtual void inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSource, const QString &targetName);
+ virtual void inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBaseTemp, V4IR::Temp *targetIndexTemp);
+ virtual void inplaceMemberOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName);
private:
struct Instruction {
@@ -86,14 +86,14 @@ private:
Instruction();
};
- Instr::Param getParam(IR::Expr *e)
+ Instr::Param getParam(V4IR::Expr *e)
{
typedef Instr::Param Param;
assert(e);
- if (IR::Const *c = e->asConst()) {
+ if (V4IR::Const *c = e->asConst()) {
return Param::createValue(convertToValue(c));
- } else if (IR::Temp *t = e->asTemp()) {
+ } else if (V4IR::Temp *t = e->asTemp()) {
const int index = t->index;
if (index < 0) {
return Param::createArgument(-index - 1);
@@ -112,7 +112,7 @@ private:
}
}
- Instr::Param getResultParam(IR::Temp *result)
+ Instr::Param getResultParam(V4IR::Temp *result)
{
if (result)
return getParam(result);
@@ -120,8 +120,8 @@ private:
return Instr::Param::createTemp(scratchTempIndex());
}
- void simpleMove(IR::Move *);
- void prepareCallArgs(IR::ExprList *, quint32 &, quint32 &);
+ void simpleMove(V4IR::Move *);
+ void prepareCallArgs(V4IR::ExprList *, quint32 &, quint32 &);
int outgoingArgumentTempStart() const { return _function->tempCount - _function->locals.size(); }
int scratchTempIndex() const { return outgoingArgumentTempStart() + _function->maxNumberOfArguments; }
@@ -135,12 +135,12 @@ private:
VM::String *identifier(const QString &s);
- IR::Function *_function;
+ V4IR::Function *_function;
VM::Function *_vmFunction;
- IR::BasicBlock *_block;
+ V4IR::BasicBlock *_block;
- QHash<IR::BasicBlock *, QVector<ptrdiff_t> > _patches;
- QHash<IR::BasicBlock *, ptrdiff_t> _addrs;
+ QHash<V4IR::BasicBlock *, QVector<ptrdiff_t> > _patches;
+ QHash<V4IR::BasicBlock *, ptrdiff_t> _addrs;
uchar *_codeStart;
uchar *_codeNext;
@@ -151,7 +151,7 @@ class Q_V4_EXPORT ISelFactory: public EvalISelFactory
{
public:
virtual ~ISelFactory() {}
- virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, IR::Module *module)
+ virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, V4IR::Module *module)
{ return new InstructionSelection(engine, module); }
};
diff --git a/src/v4/qv4codegen.cpp b/src/v4/qv4codegen.cpp
index b80f5d5172..c73b58a5b9 100644
--- a/src/v4/qv4codegen.cpp
+++ b/src/v4/qv4codegen.cpp
@@ -66,58 +66,58 @@ using namespace AST;
namespace {
QTextStream qout(stdout, QIODevice::WriteOnly);
-void dfs(IR::BasicBlock *block,
- QSet<IR::BasicBlock *> *V,
- QVector<IR::BasicBlock *> *blocks)
+void dfs(V4IR::BasicBlock *block,
+ QSet<V4IR::BasicBlock *> *V,
+ QVector<V4IR::BasicBlock *> *blocks)
{
if (! V->contains(block)) {
V->insert(block);
- foreach (IR::BasicBlock *succ, block->out)
+ foreach (V4IR::BasicBlock *succ, block->out)
dfs(succ, V, blocks);
blocks->append(block);
}
}
-struct ComputeUseDef: IR::StmtVisitor, IR::ExprVisitor
+struct ComputeUseDef: V4IR::StmtVisitor, V4IR::ExprVisitor
{
- IR::Function *_function;
- IR::Stmt *_stmt;
+ V4IR::Function *_function;
+ V4IR::Stmt *_stmt;
- ComputeUseDef(IR::Function *function)
+ ComputeUseDef(V4IR::Function *function)
: _function(function)
, _stmt(0) {}
- void operator()(IR::Stmt *s) {
+ void operator()(V4IR::Stmt *s) {
assert(! s->d);
- s->d = new IR::Stmt::Data;
+ s->d = new V4IR::Stmt::Data;
qSwap(_stmt, s);
_stmt->accept(this);
qSwap(_stmt, s);
}
- virtual void visitConst(IR::Const *) {}
- virtual void visitString(IR::String *) {}
- virtual void visitRegExp(IR::RegExp *) {}
- virtual void visitName(IR::Name *) {}
- virtual void visitClosure(IR::Closure *) {}
- virtual void visitUnop(IR::Unop *e) { e->expr->accept(this); }
- virtual void visitBinop(IR::Binop *e) { e->left->accept(this); e->right->accept(this); }
- virtual void visitSubscript(IR::Subscript *e) { e->base->accept(this); e->index->accept(this); }
- virtual void visitMember(IR::Member *e) { e->base->accept(this); }
- virtual void visitExp(IR::Exp *s) { s->expr->accept(this); }
- virtual void visitEnter(IR::Enter *) {}
- virtual void visitLeave(IR::Leave *) {}
- virtual void visitJump(IR::Jump *) {}
- virtual void visitCJump(IR::CJump *s) { s->cond->accept(this); }
- virtual void visitRet(IR::Ret *s) { s->expr->accept(this); }
- virtual void visitTry(IR::Try *t) {
+ virtual void visitConst(V4IR::Const *) {}
+ virtual void visitString(V4IR::String *) {}
+ virtual void visitRegExp(V4IR::RegExp *) {}
+ virtual void visitName(V4IR::Name *) {}
+ virtual void visitClosure(V4IR::Closure *) {}
+ virtual void visitUnop(V4IR::Unop *e) { e->expr->accept(this); }
+ virtual void visitBinop(V4IR::Binop *e) { e->left->accept(this); e->right->accept(this); }
+ virtual void visitSubscript(V4IR::Subscript *e) { e->base->accept(this); e->index->accept(this); }
+ virtual void visitMember(V4IR::Member *e) { e->base->accept(this); }
+ virtual void visitExp(V4IR::Exp *s) { s->expr->accept(this); }
+ virtual void visitEnter(V4IR::Enter *) {}
+ virtual void visitLeave(V4IR::Leave *) {}
+ virtual void visitJump(V4IR::Jump *) {}
+ virtual void visitCJump(V4IR::CJump *s) { s->cond->accept(this); }
+ virtual void visitRet(V4IR::Ret *s) { s->expr->accept(this); }
+ virtual void visitTry(V4IR::Try *t) {
if (! _stmt->d->defs.contains(t->exceptionVar->index))
_stmt->d->defs.append(t->exceptionVar->index);
}
- virtual void visitTemp(IR::Temp *e) {
+ virtual void visitTemp(V4IR::Temp *e) {
if (e->index < 0 || e->scope != 0)
return;
@@ -125,20 +125,20 @@ struct ComputeUseDef: IR::StmtVisitor, IR::ExprVisitor
_stmt->d->uses.append(e->index);
}
- virtual void visitCall(IR::Call *e) {
+ virtual void visitCall(V4IR::Call *e) {
e->base->accept(this);
- for (IR::ExprList *it = e->args; it; it = it->next)
+ for (V4IR::ExprList *it = e->args; it; it = it->next)
it->expr->accept(this);
}
- virtual void visitNew(IR::New *e) {
+ virtual void visitNew(V4IR::New *e) {
e->base->accept(this);
- for (IR::ExprList *it = e->args; it; it = it->next)
+ for (V4IR::ExprList *it = e->args; it; it = it->next)
it->expr->accept(this);
}
- virtual void visitMove(IR::Move *s) {
- if (IR::Temp *t = s->target->asTemp()) {
+ virtual void visitMove(V4IR::Move *s) {
+ if (V4IR::Temp *t = s->target->asTemp()) {
if (t->index >= 0 && t->scope == 0) // only collect unscoped locals and temps
if (! _stmt->d->defs.contains(t->index))
_stmt->d->defs.append(t->index);
@@ -154,14 +154,14 @@ struct ComputeUseDef: IR::StmtVisitor, IR::ExprVisitor
}
};
-void liveness(IR::Function *function)
+void liveness(V4IR::Function *function)
{
- QSet<IR::BasicBlock *> V;
- QVector<IR::BasicBlock *> blocks;
+ QSet<V4IR::BasicBlock *> V;
+ QVector<V4IR::BasicBlock *> blocks;
ComputeUseDef computeUseDef(function);
- foreach (IR::BasicBlock *block, function->basicBlocks) {
- foreach (IR::Stmt *s, block->statements)
+ foreach (V4IR::BasicBlock *block, function->basicBlocks) {
+ foreach (V4IR::Stmt *s, block->statements)
computeUseDef(s);
}
@@ -171,15 +171,15 @@ void liveness(IR::Function *function)
do {
changed = false;
- foreach (IR::BasicBlock *block, blocks) {
+ foreach (V4IR::BasicBlock *block, blocks) {
const QBitArray previousLiveIn = block->liveIn;
const QBitArray previousLiveOut = block->liveOut;
QBitArray live(function->tempCount);
- foreach (IR::BasicBlock *succ, block->out)
+ foreach (V4IR::BasicBlock *succ, block->out)
live |= succ->liveIn;
block->liveOut = live;
for (int i = block->statements.size() - 1; i != -1; --i) {
- IR::Stmt *s = block->statements.at(i);
+ V4IR::Stmt *s = block->statements.at(i);
s->d->liveOut = live;
foreach (unsigned d, s->d->defs)
live.clearBit(d);
@@ -196,18 +196,18 @@ void liveness(IR::Function *function)
} while (changed);
}
-static inline bool isDeadAssignment(IR::Stmt *stmt, int localCount)
+static inline bool isDeadAssignment(V4IR::Stmt *stmt, int localCount)
{
- IR::Move *move = stmt->asMove();
- if (!move || move->op != IR::OpInvalid)
+ V4IR::Move *move = stmt->asMove();
+ if (!move || move->op != V4IR::OpInvalid)
return false;
- IR::Temp *target = move->target->asTemp();
+ V4IR::Temp *target = move->target->asTemp();
if (!target)
return false;
if (target->scope || target->index < localCount)
return false;
- if (IR::Name *n = move->source->asName()) {
+ if (V4IR::Name *n = move->source->asName()) {
if (*n->id != QStringLiteral("this"))
return false;
} else if (!move->source->asConst() && !move->source->asTemp()) {
@@ -217,11 +217,11 @@ static inline bool isDeadAssignment(IR::Stmt *stmt, int localCount)
return !stmt->d->liveOut.at(target->index);
}
-void removeDeadAssignments(IR::Function *function)
+void removeDeadAssignments(V4IR::Function *function)
{
const int localCount = function->locals.size();
- foreach (IR::BasicBlock *bb, function->basicBlocks) {
- QVector<IR::Stmt *> &statements = bb->statements;
+ foreach (V4IR::BasicBlock *bb, function->basicBlocks) {
+ QVector<V4IR::Stmt *> &statements = bb->statements;
for (int i = 0; i < statements.size(); ) {
// qout<<"removeDeadAssignments: considering ";statements.at(i)->dump(qout);qout<<"\n";qout.flush();
if (isDeadAssignment(statements.at(i), localCount))
@@ -232,7 +232,7 @@ void removeDeadAssignments(IR::Function *function)
}
}
-class ConstantPropagation: public IR::StmtVisitor, public IR::ExprVisitor
+class ConstantPropagation: public V4IR::StmtVisitor, public V4IR::ExprVisitor
{
struct Value {
enum Type {
@@ -247,14 +247,14 @@ class ConstantPropagation: public IR::StmtVisitor, public IR::ExprVisitor
union {
double numberValue;
- IR::String *stringValue;
+ V4IR::String *stringValue;
};
Value()
: type(InvalidType), stringValue(0)
{}
- explicit Value(IR::String *str)
+ explicit Value(V4IR::String *str)
: type(StringType), stringValue(str)
{}
@@ -305,7 +305,7 @@ class ConstantPropagation: public IR::StmtVisitor, public IR::ExprVisitor
};
public:
- void run(IR::Function *function)
+ void run(V4IR::Function *function)
{
if (function->hasTry)
return;
@@ -313,20 +313,20 @@ public:
if (function->hasWith) {
thisTemp = -1;
} else {
- IR::BasicBlock *entryBlock = function->basicBlocks.at(0);
+ V4IR::BasicBlock *entryBlock = function->basicBlocks.at(0);
thisTemp = entryBlock->newTemp();
- IR::Move *fetchThis = function->New<IR::Move>();
+ V4IR::Move *fetchThis = function->New<V4IR::Move>();
fetchThis->init(entryBlock->TEMP(thisTemp),
entryBlock->NAME(QStringLiteral("this"), 0, 0),
- IR::OpInvalid);
+ V4IR::OpInvalid);
entryBlock->statements.prepend(fetchThis);
}
- foreach (IR::BasicBlock *block, function->basicBlocks) {
+ foreach (V4IR::BasicBlock *block, function->basicBlocks) {
// qDebug()<<"--- Starting with BB"<<block->index;
reset();
- QVector<IR::Stmt *> &statements = block->statements;
- foreach (IR::Stmt *stmt, statements) {
+ QVector<V4IR::Stmt *> &statements = block->statements;
+ foreach (V4IR::Stmt *stmt, statements) {
// qout<<"*** ";stmt->dump(qout);qout<<"\n";qout.flush();
stmt->accept(this);
}
@@ -334,36 +334,36 @@ public:
}
protected:
- virtual void visitConst(IR::Const *) {}
- virtual void visitString(IR::String *) {}
- virtual void visitRegExp(IR::RegExp *) {}
- virtual void visitName(IR::Name *) {}
- virtual void visitClosure(IR::Closure *) {}
- virtual void visitUnop(IR::Unop *e) { e->expr->accept(this); }
- virtual void visitBinop(IR::Binop *e) { e->left->accept(this); e->right->accept(this); }
- virtual void visitSubscript(IR::Subscript *e) { e->base->accept(this); e->index->accept(this); }
- virtual void visitMember(IR::Member *e) { e->base->accept(this); }
- virtual void visitExp(IR::Exp *s) { s->expr->accept(this); }
- virtual void visitEnter(IR::Enter *) {}
- virtual void visitLeave(IR::Leave *) {}
- virtual void visitJump(IR::Jump *) {}
- virtual void visitCJump(IR::CJump *s) { s->cond->accept(this); }
- virtual void visitRet(IR::Ret *s) { s->expr->accept(this); }
- virtual void visitTry(IR::Try *) {}
-
- virtual void visitCall(IR::Call *e) {
+ virtual void visitConst(V4IR::Const *) {}
+ virtual void visitString(V4IR::String *) {}
+ virtual void visitRegExp(V4IR::RegExp *) {}
+ virtual void visitName(V4IR::Name *) {}
+ virtual void visitClosure(V4IR::Closure *) {}
+ virtual void visitUnop(V4IR::Unop *e) { e->expr->accept(this); }
+ virtual void visitBinop(V4IR::Binop *e) { e->left->accept(this); e->right->accept(this); }
+ virtual void visitSubscript(V4IR::Subscript *e) { e->base->accept(this); e->index->accept(this); }
+ virtual void visitMember(V4IR::Member *e) { e->base->accept(this); }
+ virtual void visitExp(V4IR::Exp *s) { s->expr->accept(this); }
+ virtual void visitEnter(V4IR::Enter *) {}
+ virtual void visitLeave(V4IR::Leave *) {}
+ virtual void visitJump(V4IR::Jump *) {}
+ virtual void visitCJump(V4IR::CJump *s) { s->cond->accept(this); }
+ virtual void visitRet(V4IR::Ret *s) { s->expr->accept(this); }
+ virtual void visitTry(V4IR::Try *) {}
+
+ virtual void visitCall(V4IR::Call *e) {
e->base->accept(this);
- for (IR::ExprList *it = e->args; it; it = it->next)
+ for (V4IR::ExprList *it = e->args; it; it = it->next)
it->expr->accept(this);
}
- virtual void visitNew(IR::New *e) {
+ virtual void visitNew(V4IR::New *e) {
e->base->accept(this);
- for (IR::ExprList *it = e->args; it; it = it->next)
+ for (V4IR::ExprList *it = e->args; it; it = it->next)
it->expr->accept(this);
}
- virtual void visitTemp(IR::Temp *e) {
+ virtual void visitTemp(V4IR::Temp *e) {
if (e->scope)
return;
@@ -374,29 +374,29 @@ protected:
}
}
- virtual void visitMove(IR::Move *s) {
- IR::Temp *targetTemp = s->target->asTemp();
+ virtual void visitMove(V4IR::Move *s) {
+ V4IR::Temp *targetTemp = s->target->asTemp();
if (targetTemp && targetTemp->index >= localCount && !targetTemp->scope) {
- if (s->op == IR::OpInvalid) {
- if (IR::Name *n = s->source->asName()) {
+ if (s->op == V4IR::OpInvalid) {
+ if (V4IR::Name *n = s->source->asName()) {
if (thisTemp != -1) {
if (*n->id == QStringLiteral("this")) {
check(targetTemp->index, Value(Value::ThisType));
return;
}
}
- } else if (IR::Const *c = s->source->asConst()) {
+ } else if (V4IR::Const *c = s->source->asConst()) {
Value value;
switch (c->type) {
- case IR::UndefinedType: value.type = Value::UndefinedType; break;
- case IR::NullType: value.type = Value::NullType; break;
- case IR::BoolType: value.type = Value::BoolType; value.numberValue = c->value == 0 ? 0 : 1; break;
- case IR::NumberType: value.type = Value::NumberType; value.numberValue = c->value; break;
+ case V4IR::UndefinedType: value.type = Value::UndefinedType; break;
+ case V4IR::NullType: value.type = Value::NullType; break;
+ case V4IR::BoolType: value.type = Value::BoolType; value.numberValue = c->value == 0 ? 0 : 1; break;
+ case V4IR::NumberType: value.type = Value::NumberType; value.numberValue = c->value; break;
default: Q_ASSERT("unknown const type"); return;
}
check(targetTemp->index, value);
return;
- } else if (IR::String *str = s->source->asString()) {
+ } else if (V4IR::String *str = s->source->asString()) {
check(targetTemp->index, Value(str));
return;
}
@@ -465,10 +465,10 @@ private:
#else // !DEBUG_TEMP_COMPRESSION
# define DBTC(x)
#endif // DEBUG_TEMP_COMPRESSION
-class CompressTemps: public IR::StmtVisitor, IR::ExprVisitor
+class CompressTemps: public V4IR::StmtVisitor, V4IR::ExprVisitor
{
public:
- void run(IR::Function *function)
+ void run(V4IR::Function *function)
{
_nextFree = 0;
_active.reserve(function->tempCount);
@@ -477,8 +477,8 @@ public:
DBTC(qDebug() << "starting on function" << (*function->name) << "with" << (function->tempCount - _localCount) << "temps.";)
QVector<int> pinned;
- foreach (IR::BasicBlock *block, function->basicBlocks) {
- if (IR::Stmt *last = block->terminator()) {
+ foreach (V4IR::BasicBlock *block, function->basicBlocks) {
+ if (V4IR::Stmt *last = block->terminator()) {
const QBitArray &liveOut = last->d->liveOut;
for (int i = _localCount, ei = liveOut.size(); i < ei; ++i) {
if (liveOut.at(i) && !pinned.contains(i)) {
@@ -492,7 +492,7 @@ public:
int maxUsed = _nextFree;
- foreach (IR::BasicBlock *block, function->basicBlocks) {
+ foreach (V4IR::BasicBlock *block, function->basicBlocks) {
DBTC(qDebug("L%d:", block->index));
for (int i = 0, ei = block->statements.size(); i < ei; ++i ) {
@@ -512,24 +512,24 @@ public:
}
protected:
- virtual void visitConst(IR::Const *) {}
- virtual void visitString(IR::String *) {}
- virtual void visitRegExp(IR::RegExp *) {}
- virtual void visitName(IR::Name *) {}
- virtual void visitClosure(IR::Closure *) {}
- virtual void visitUnop(IR::Unop *e) { e->expr->accept(this); }
- virtual void visitBinop(IR::Binop *e) { e->left->accept(this); e->right->accept(this); }
- virtual void visitSubscript(IR::Subscript *e) { e->base->accept(this); e->index->accept(this); }
- virtual void visitMember(IR::Member *e) { e->base->accept(this); }
- virtual void visitExp(IR::Exp *s) { s->expr->accept(this); }
- virtual void visitEnter(IR::Enter *) {}
- virtual void visitLeave(IR::Leave *) {}
- virtual void visitJump(IR::Jump *) {}
- virtual void visitCJump(IR::CJump *s) { s->cond->accept(this); }
- virtual void visitRet(IR::Ret *s) { s->expr->accept(this); }
- virtual void visitTry(IR::Try *t) { visitTemp(t->exceptionVar); }
-
- virtual void visitTemp(IR::Temp *e) {
+ virtual void visitConst(V4IR::Const *) {}
+ virtual void visitString(V4IR::String *) {}
+ virtual void visitRegExp(V4IR::RegExp *) {}
+ virtual void visitName(V4IR::Name *) {}
+ virtual void visitClosure(V4IR::Closure *) {}
+ virtual void visitUnop(V4IR::Unop *e) { e->expr->accept(this); }
+ virtual void visitBinop(V4IR::Binop *e) { e->left->accept(this); e->right->accept(this); }
+ virtual void visitSubscript(V4IR::Subscript *e) { e->base->accept(this); e->index->accept(this); }
+ virtual void visitMember(V4IR::Member *e) { e->base->accept(this); }
+ virtual void visitExp(V4IR::Exp *s) { s->expr->accept(this); }
+ virtual void visitEnter(V4IR::Enter *) {}
+ virtual void visitLeave(V4IR::Leave *) {}
+ virtual void visitJump(V4IR::Jump *) {}
+ virtual void visitCJump(V4IR::CJump *s) { s->cond->accept(this); }
+ virtual void visitRet(V4IR::Ret *s) { s->expr->accept(this); }
+ virtual void visitTry(V4IR::Try *t) { visitTemp(t->exceptionVar); }
+
+ virtual void visitTemp(V4IR::Temp *e) {
if (e->scope) // scoped local
return;
if (e->index < _localCount) // local or argument
@@ -538,19 +538,19 @@ protected:
e->index = remap(e->index - _localCount) + _localCount;
}
- virtual void visitCall(IR::Call *e) {
+ virtual void visitCall(V4IR::Call *e) {
e->base->accept(this);
- for (IR::ExprList *it = e->args; it; it = it->next)
+ for (V4IR::ExprList *it = e->args; it; it = it->next)
it->expr->accept(this);
}
- virtual void visitNew(IR::New *e) {
+ virtual void visitNew(V4IR::New *e) {
e->base->accept(this);
- for (IR::ExprList *it = e->args; it; it = it->next)
+ for (V4IR::ExprList *it = e->args; it; it = it->next)
it->expr->accept(this);
}
- virtual void visitMove(IR::Move *s) {
+ virtual void visitMove(V4IR::Move *s) {
s->target->accept(this);
s->source->accept(this);
}
@@ -608,7 +608,7 @@ private:
private:
typedef QVector<QPair<int, int> > ActiveTemps;
ActiveTemps _active;
- IR::Stmt *_currentStatement;
+ V4IR::Stmt *_currentStatement;
int _localCount;
int _nextFree;
int _pinnedCount;
@@ -1022,10 +1022,10 @@ Codegen::Codegen(ErrorHandler *errorHandler, bool strictMode)
{
}
-IR::Function *Codegen::operator()(const QString &fileName,
+V4IR::Function *Codegen::operator()(const QString &fileName,
const QString &sourceCode,
Program *node,
- IR::Module *module,
+ V4IR::Module *module,
Mode mode,
const QStringList &inheritedLocals)
{
@@ -1038,7 +1038,7 @@ IR::Function *Codegen::operator()(const QString &fileName,
ScanFunctions scan(this, sourceCode);
scan(node);
- IR::Function *globalCode = defineFunction(QStringLiteral("%entry"), node, 0,
+ V4IR::Function *globalCode = defineFunction(QStringLiteral("%entry"), node, 0,
node->elements, mode, inheritedLocals);
if (_debugger) {
if (node->elements->element) {
@@ -1047,7 +1047,7 @@ IR::Function *Codegen::operator()(const QString &fileName,
}
}
- foreach (IR::Function *function, _module->functions) {
+ foreach (V4IR::Function *function, _module->functions) {
linearize(function);
}
@@ -1057,10 +1057,10 @@ IR::Function *Codegen::operator()(const QString &fileName,
return globalCode;
}
-IR::Function *Codegen::operator()(const QString &fileName,
+V4IR::Function *Codegen::operator()(const QString &fileName,
const QString &sourceCode,
AST::FunctionExpression *ast,
- IR::Module *module)
+ V4IR::Module *module)
{
_fileName = fileName;
_module = module;
@@ -1072,11 +1072,11 @@ IR::Function *Codegen::operator()(const QString &fileName,
scan(ast);
scan.leaveEnvironment();
- IR::Function *function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0);
+ V4IR::Function *function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0);
if (_debugger)
_debugger->setSourceLocation(function, ast->functionToken.startLine, ast->functionToken.startColumn);
- foreach (IR::Function *function, _module->functions) {
+ foreach (V4IR::Function *function, _module->functions) {
linearize(function);
}
@@ -1099,7 +1099,7 @@ void Codegen::leaveEnvironment()
_env = _env->parent;
}
-void Codegen::enterLoop(Statement *node, IR::BasicBlock *breakBlock, IR::BasicBlock *continueBlock)
+void Codegen::enterLoop(Statement *node, V4IR::BasicBlock *breakBlock, V4IR::BasicBlock *continueBlock)
{
_loop = new Loop(node, breakBlock, continueBlock, _loop);
_loop->labelledStatement = _labelledStatement; // consume the enclosing labelled statement
@@ -1114,7 +1114,7 @@ void Codegen::leaveLoop()
delete current;
}
-IR::Expr *Codegen::member(IR::Expr *base, const QString *name)
+V4IR::Expr *Codegen::member(V4IR::Expr *base, const QString *name)
{
if (base->asTemp() /*|| base->asName()*/)
return _block->MEMBER(base->asTemp(), name);
@@ -1125,7 +1125,7 @@ IR::Expr *Codegen::member(IR::Expr *base, const QString *name)
}
}
-IR::Expr *Codegen::subscript(IR::Expr *base, IR::Expr *index)
+V4IR::Expr *Codegen::subscript(V4IR::Expr *base, V4IR::Expr *index)
{
if (! base->asTemp()) {
const unsigned t = _block->newTemp();
@@ -1143,7 +1143,7 @@ IR::Expr *Codegen::subscript(IR::Expr *base, IR::Expr *index)
return _block->SUBSCRIPT(base->asTemp(), index->asTemp());
}
-IR::Expr *Codegen::argument(IR::Expr *expr)
+V4IR::Expr *Codegen::argument(V4IR::Expr *expr)
{
if (expr && ! expr->asTemp()) {
const unsigned t = _block->newTemp();
@@ -1154,7 +1154,7 @@ IR::Expr *Codegen::argument(IR::Expr *expr)
}
// keeps references alive, converts other expressions to temps
-IR::Expr *Codegen::reference(IR::Expr *expr)
+V4IR::Expr *Codegen::reference(V4IR::Expr *expr)
{
if (expr && !expr->asTemp() && !expr->asName() && !expr->asMember() && !expr->asSubscript()) {
const unsigned t = _block->newTemp();
@@ -1164,23 +1164,23 @@ IR::Expr *Codegen::reference(IR::Expr *expr)
return expr;
}
-IR::Expr *Codegen::unop(IR::AluOp op, IR::Expr *expr)
+V4IR::Expr *Codegen::unop(V4IR::AluOp op, V4IR::Expr *expr)
{
- if (IR::Const *c = expr->asConst()) {
- if (c->type == IR::NumberType) {
+ if (V4IR::Const *c = expr->asConst()) {
+ if (c->type == V4IR::NumberType) {
switch (op) {
- case IR::OpNot:
- return _block->CONST(IR::BoolType, !c->value);
- case IR::OpUMinus:
- return _block->CONST(IR::NumberType, -c->value);
- case IR::OpUPlus:
+ case V4IR::OpNot:
+ return _block->CONST(V4IR::BoolType, !c->value);
+ case V4IR::OpUMinus:
+ return _block->CONST(V4IR::NumberType, -c->value);
+ case V4IR::OpUPlus:
return expr;
- case IR::OpCompl:
- return _block->CONST(IR::NumberType, ~VM::Value::toInt32(c->value));
- case IR::OpIncrement:
- return _block->CONST(IR::NumberType, c->value + 1);
- case IR::OpDecrement:
- return _block->CONST(IR::NumberType, c->value - 1);
+ case V4IR::OpCompl:
+ return _block->CONST(V4IR::NumberType, ~VM::Value::toInt32(c->value));
+ case V4IR::OpIncrement:
+ return _block->CONST(V4IR::NumberType, c->value + 1);
+ case V4IR::OpDecrement:
+ return _block->CONST(V4IR::NumberType, c->value - 1);
default:
break;
}
@@ -1195,53 +1195,53 @@ IR::Expr *Codegen::unop(IR::AluOp op, IR::Expr *expr)
return _block->UNOP(op, expr->asTemp());
}
-IR::Expr *Codegen::binop(IR::AluOp op, IR::Expr *left, IR::Expr *right)
+V4IR::Expr *Codegen::binop(V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right)
{
- if (IR::Const *c1 = left->asConst()) {
- if (IR::Const *c2 = right->asConst()) {
- if (c1->type == IR::NumberType && c2->type == IR::NumberType) {
+ if (V4IR::Const *c1 = left->asConst()) {
+ if (V4IR::Const *c2 = right->asConst()) {
+ if (c1->type == V4IR::NumberType && c2->type == V4IR::NumberType) {
switch (op) {
- case IR::OpAdd: return _block->CONST(IR::NumberType, c1->value + c2->value);
- case IR::OpAnd: return _block->CONST(IR::BoolType, c1->value ? c2->value : 0);
- case IR::OpBitAnd: return _block->CONST(IR::NumberType, int(c1->value) & int(c2->value));
- case IR::OpBitOr: return _block->CONST(IR::NumberType, int(c1->value) | int(c2->value));
- case IR::OpBitXor: return _block->CONST(IR::NumberType, int(c1->value) ^ int(c2->value));
- case IR::OpDiv: return _block->CONST(IR::NumberType, c1->value / c2->value);
- case IR::OpEqual: return _block->CONST(IR::BoolType, c1->value == c2->value);
- case IR::OpNotEqual: return _block->CONST(IR::BoolType, c1->value != c2->value);
- case IR::OpStrictEqual: return _block->CONST(IR::BoolType, c1->value == c2->value);
- case IR::OpStrictNotEqual: return _block->CONST(IR::BoolType, c1->value != c2->value);
- case IR::OpGe: return _block->CONST(IR::BoolType, c1->value >= c2->value);
- case IR::OpGt: return _block->CONST(IR::BoolType, c1->value > c2->value);
- case IR::OpLe: return _block->CONST(IR::BoolType, c1->value <= c2->value);
- case IR::OpLt: return _block->CONST(IR::BoolType, c1->value < c2->value);
- case IR::OpLShift: return _block->CONST(IR::NumberType, VM::Value::toInt32(c1->value) << (VM::Value::toUInt32(c2->value) & 0x1f));
- case IR::OpMod: return _block->CONST(IR::NumberType, ::fmod(c1->value, c2->value));
- case IR::OpMul: return _block->CONST(IR::NumberType, c1->value * c2->value);
- case IR::OpOr: return _block->CONST(IR::NumberType, c1->value ? c1->value : c2->value);
- case IR::OpRShift: return _block->CONST(IR::NumberType, VM::Value::toInt32(c1->value) >> (VM::Value::toUInt32(c2->value) & 0x1f));
- case IR::OpSub: return _block->CONST(IR::NumberType, c1->value - c2->value);
- case IR::OpURShift: return _block->CONST(IR::NumberType,VM::Value::toUInt32(c1->value) >> (VM::Value::toUInt32(c2->value) & 0x1f));
-
- case IR::OpInstanceof:
- case IR::OpIn:
+ case V4IR::OpAdd: return _block->CONST(V4IR::NumberType, c1->value + c2->value);
+ case V4IR::OpAnd: return _block->CONST(V4IR::BoolType, c1->value ? c2->value : 0);
+ case V4IR::OpBitAnd: return _block->CONST(V4IR::NumberType, int(c1->value) & int(c2->value));
+ case V4IR::OpBitOr: return _block->CONST(V4IR::NumberType, int(c1->value) | int(c2->value));
+ case V4IR::OpBitXor: return _block->CONST(V4IR::NumberType, int(c1->value) ^ int(c2->value));
+ case V4IR::OpDiv: return _block->CONST(V4IR::NumberType, c1->value / c2->value);
+ case V4IR::OpEqual: return _block->CONST(V4IR::BoolType, c1->value == c2->value);
+ case V4IR::OpNotEqual: return _block->CONST(V4IR::BoolType, c1->value != c2->value);
+ case V4IR::OpStrictEqual: return _block->CONST(V4IR::BoolType, c1->value == c2->value);
+ case V4IR::OpStrictNotEqual: return _block->CONST(V4IR::BoolType, c1->value != c2->value);
+ case V4IR::OpGe: return _block->CONST(V4IR::BoolType, c1->value >= c2->value);
+ case V4IR::OpGt: return _block->CONST(V4IR::BoolType, c1->value > c2->value);
+ case V4IR::OpLe: return _block->CONST(V4IR::BoolType, c1->value <= c2->value);
+ case V4IR::OpLt: return _block->CONST(V4IR::BoolType, c1->value < c2->value);
+ case V4IR::OpLShift: return _block->CONST(V4IR::NumberType, VM::Value::toInt32(c1->value) << (VM::Value::toUInt32(c2->value) & 0x1f));
+ case V4IR::OpMod: return _block->CONST(V4IR::NumberType, ::fmod(c1->value, c2->value));
+ case V4IR::OpMul: return _block->CONST(V4IR::NumberType, c1->value * c2->value);
+ case V4IR::OpOr: return _block->CONST(V4IR::NumberType, c1->value ? c1->value : c2->value);
+ case V4IR::OpRShift: return _block->CONST(V4IR::NumberType, VM::Value::toInt32(c1->value) >> (VM::Value::toUInt32(c2->value) & 0x1f));
+ case V4IR::OpSub: return _block->CONST(V4IR::NumberType, c1->value - c2->value);
+ case V4IR::OpURShift: return _block->CONST(V4IR::NumberType,VM::Value::toUInt32(c1->value) >> (VM::Value::toUInt32(c2->value) & 0x1f));
+
+ case V4IR::OpInstanceof:
+ case V4IR::OpIn:
break;
- case IR::OpIfTrue: // unary ops
- case IR::OpNot:
- case IR::OpUMinus:
- case IR::OpUPlus:
- case IR::OpCompl:
- case IR::OpIncrement:
- case IR::OpDecrement:
- case IR::OpInvalid:
+ case V4IR::OpIfTrue: // unary ops
+ case V4IR::OpNot:
+ case V4IR::OpUMinus:
+ case V4IR::OpUPlus:
+ case V4IR::OpCompl:
+ case V4IR::OpIncrement:
+ case V4IR::OpDecrement:
+ case V4IR::OpInvalid:
break;
}
}
}
- } else if (op == IR::OpAdd) {
- if (IR::String *s1 = left->asString()) {
- if (IR::String *s2 = right->asString()) {
+ } else if (op == V4IR::OpAdd) {
+ if (V4IR::String *s1 = left->asString()) {
+ if (V4IR::String *s2 = right->asString()) {
return _block->STRING(_function->newString(*s1->value + *s2->value));
}
}
@@ -1265,22 +1265,22 @@ IR::Expr *Codegen::binop(IR::AluOp op, IR::Expr *left, IR::Expr *right)
return _block->BINOP(op, left, right);
}
-IR::Expr *Codegen::call(IR::Expr *base, IR::ExprList *args)
+V4IR::Expr *Codegen::call(V4IR::Expr *base, V4IR::ExprList *args)
{
base = reference(base);
return _block->CALL(base, args);
}
-void Codegen::move(IR::Expr *target, IR::Expr *source, IR::AluOp op)
+void Codegen::move(V4IR::Expr *target, V4IR::Expr *source, V4IR::AluOp op)
{
assert(target->isLValue());
- if (!source->asTemp() && !source->asConst() && (op != IR::OpInvalid || ! target->asTemp())) {
+ if (!source->asTemp() && !source->asConst() && (op != V4IR::OpInvalid || ! target->asTemp())) {
unsigned t = _block->newTemp();
_block->MOVE(_block->TEMP(t), source);
source = _block->TEMP(t);
}
- if (source->asConst() && (!target->asTemp() || op != IR::OpInvalid)) {
+ if (source->asConst() && (!target->asTemp() || op != V4IR::OpInvalid)) {
unsigned t = _block->newTemp();
_block->MOVE(_block->TEMP(t), source);
source = _block->TEMP(t);
@@ -1289,7 +1289,7 @@ void Codegen::move(IR::Expr *target, IR::Expr *source, IR::AluOp op)
_block->MOVE(target, source, op);
}
-void Codegen::cjump(IR::Expr *cond, IR::BasicBlock *iftrue, IR::BasicBlock *iffalse)
+void Codegen::cjump(V4IR::Expr *cond, V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse)
{
if (! (cond->asTemp() || cond->asBinop())) {
const unsigned t = _block->newTemp();
@@ -1332,7 +1332,7 @@ void Codegen::statement(ExpressionNode *ast)
}
}
-void Codegen::condition(ExpressionNode *ast, IR::BasicBlock *iftrue, IR::BasicBlock *iffalse)
+void Codegen::condition(ExpressionNode *ast, V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse)
{
if (ast) {
Result r(iftrue, iffalse);
@@ -1411,7 +1411,7 @@ void Codegen::sourceElements(SourceElements *ast)
void Codegen::variableDeclaration(VariableDeclaration *ast)
{
- IR::Expr *initializer = 0;
+ V4IR::Expr *initializer = 0;
if (!ast->expression)
return;
Result expr = expression(ast->expression);
@@ -1607,22 +1607,22 @@ bool Codegen::visit(Expression *ast)
bool Codegen::visit(ArrayLiteral *ast)
{
- IR::ExprList *args = 0;
- IR::ExprList *current = 0;
+ V4IR::ExprList *args = 0;
+ V4IR::ExprList *current = 0;
for (ElementList *it = ast->elements; it; it = it->next) {
for (Elision *elision = it->elision; elision; elision = elision->next) {
- IR::ExprList *arg = _function->New<IR::ExprList>();
+ V4IR::ExprList *arg = _function->New<V4IR::ExprList>();
if (!current) {
args = arg;
} else {
current->next = arg;
}
current = arg;
- current->expr = _block->CONST(IR::MissingType, 0);
+ current->expr = _block->CONST(V4IR::MissingType, 0);
}
Result expr = expression(it->expression);
- IR::ExprList *arg = _function->New<IR::ExprList>();
+ V4IR::ExprList *arg = _function->New<V4IR::ExprList>();
if (!current) {
args = arg;
} else {
@@ -1630,7 +1630,7 @@ bool Codegen::visit(ArrayLiteral *ast)
}
current = arg;
- IR::Expr *exp = *expr;
+ V4IR::Expr *exp = *expr;
if (exp->asTemp() || exp->asConst()) {
current->expr = exp;
} else {
@@ -1640,18 +1640,18 @@ bool Codegen::visit(ArrayLiteral *ast)
}
}
for (Elision *elision = ast->elision; elision; elision = elision->next) {
- IR::ExprList *arg = _function->New<IR::ExprList>();
+ V4IR::ExprList *arg = _function->New<V4IR::ExprList>();
if (!current) {
args = arg;
} else {
current->next = arg;
}
current = arg;
- current->expr = _block->CONST(IR::MissingType, 0);
+ current->expr = _block->CONST(V4IR::MissingType, 0);
}
const unsigned t = _block->newTemp();
- move(_block->TEMP(t), _block->CALL(_block->NAME(IR::Name::builtin_define_array, 0, 0), args));
+ move(_block->TEMP(t), _block->CALL(_block->NAME(V4IR::Name::builtin_define_array, 0, 0), args));
_expr.code = _block->TEMP(t);
return false;
}
@@ -1664,21 +1664,21 @@ bool Codegen::visit(ArrayMemberExpression *ast)
return false;
}
-static IR::AluOp baseOp(int op)
+static V4IR::AluOp baseOp(int op)
{
switch ((QSOperator::Op) op) {
- case QSOperator::InplaceAnd: return IR::OpBitAnd;
- case QSOperator::InplaceSub: return IR::OpSub;
- case QSOperator::InplaceDiv: return IR::OpDiv;
- case QSOperator::InplaceAdd: return IR::OpAdd;
- case QSOperator::InplaceLeftShift: return IR::OpLShift;
- case QSOperator::InplaceMod: return IR::OpMod;
- case QSOperator::InplaceMul: return IR::OpMul;
- case QSOperator::InplaceOr: return IR::OpBitOr;
- case QSOperator::InplaceRightShift: return IR::OpRShift;
- case QSOperator::InplaceURightShift: return IR::OpURShift;
- case QSOperator::InplaceXor: return IR::OpBitXor;
- default: return IR::OpInvalid;
+ case QSOperator::InplaceAnd: return V4IR::OpBitAnd;
+ case QSOperator::InplaceSub: return V4IR::OpSub;
+ case QSOperator::InplaceDiv: return V4IR::OpDiv;
+ case QSOperator::InplaceAdd: return V4IR::OpAdd;
+ case QSOperator::InplaceLeftShift: return V4IR::OpLShift;
+ case QSOperator::InplaceMod: return V4IR::OpMod;
+ case QSOperator::InplaceMul: return V4IR::OpMul;
+ case QSOperator::InplaceOr: return V4IR::OpBitOr;
+ case QSOperator::InplaceRightShift: return V4IR::OpRShift;
+ case QSOperator::InplaceURightShift: return V4IR::OpURShift;
+ case QSOperator::InplaceXor: return V4IR::OpBitXor;
+ default: return V4IR::OpInvalid;
}
}
@@ -1686,13 +1686,13 @@ bool Codegen::visit(BinaryExpression *ast)
{
if (ast->op == QSOperator::And) {
if (_expr.accept(cx)) {
- IR::BasicBlock *iftrue = _function->newBasicBlock();
+ V4IR::BasicBlock *iftrue = _function->newBasicBlock();
condition(ast->left, iftrue, _expr.iffalse);
_block = iftrue;
condition(ast->right, _expr.iftrue, _expr.iffalse);
} else {
- IR::BasicBlock *iftrue = _function->newBasicBlock();
- IR::BasicBlock *endif = _function->newBasicBlock();
+ V4IR::BasicBlock *iftrue = _function->newBasicBlock();
+ V4IR::BasicBlock *endif = _function->newBasicBlock();
const unsigned r = _block->newTemp();
@@ -1708,13 +1708,13 @@ bool Codegen::visit(BinaryExpression *ast)
return false;
} else if (ast->op == QSOperator::Or) {
if (_expr.accept(cx)) {
- IR::BasicBlock *iffalse = _function->newBasicBlock();
+ V4IR::BasicBlock *iffalse = _function->newBasicBlock();
condition(ast->left, _expr.iftrue, iffalse);
_block = iffalse;
condition(ast->right, _expr.iftrue, _expr.iffalse);
} else {
- IR::BasicBlock *iffalse = _function->newBasicBlock();
- IR::BasicBlock *endif = _function->newBasicBlock();
+ V4IR::BasicBlock *iffalse = _function->newBasicBlock();
+ V4IR::BasicBlock *endif = _function->newBasicBlock();
const unsigned r = _block->newTemp();
move(_block->TEMP(r), *expression(ast->left));
@@ -1729,7 +1729,7 @@ bool Codegen::visit(BinaryExpression *ast)
return false;
}
- IR::Expr* left = *expression(ast->left);
+ V4IR::Expr* left = *expression(ast->left);
throwSyntaxErrorOnEvalOrArgumentsInStrictMode(left, ast->left->lastSourceLocation());
switch (ast->op) {
@@ -1738,7 +1738,7 @@ bool Codegen::visit(BinaryExpression *ast)
break;
case QSOperator::Assign: {
- IR::Expr* right = *expression(ast->right);
+ V4IR::Expr* right = *expression(ast->right);
if (! (left->asTemp() || left->asName() || left->asSubscript() || left->asMember()))
throwReferenceError(ast->operatorToken, QCoreApplication::translate("qv4codegen", "left-hand side of assignment operator is not an lvalue"));
@@ -1764,7 +1764,7 @@ bool Codegen::visit(BinaryExpression *ast)
case QSOperator::InplaceRightShift:
case QSOperator::InplaceURightShift:
case QSOperator::InplaceXor: {
- IR::Expr* right = *expression(ast->right);
+ V4IR::Expr* right = *expression(ast->right);
if (!left->isLValue())
throwSyntaxError(ast->operatorToken, QCoreApplication::translate("qv4codegen", "left-hand side of inplace operator is not an lvalue"));
@@ -1795,12 +1795,12 @@ bool Codegen::visit(BinaryExpression *ast)
left = _block->TEMP(t);
}
- IR::Expr* right = *expression(ast->right);
+ V4IR::Expr* right = *expression(ast->right);
if (_expr.accept(cx)) {
- cjump(binop(IR::binaryOperator(ast->op), left, right), _expr.iftrue, _expr.iffalse);
+ cjump(binop(V4IR::binaryOperator(ast->op), left, right), _expr.iftrue, _expr.iffalse);
} else {
- IR::Expr *e = binop(IR::binaryOperator(ast->op), left, right);
+ V4IR::Expr *e = binop(V4IR::binaryOperator(ast->op), left, right);
if (e->asConst() || e->asString())
_expr.code = e;
else {
@@ -1829,9 +1829,9 @@ bool Codegen::visit(BinaryExpression *ast)
left = _block->TEMP(t);
}
- IR::Expr* right = *expression(ast->right);
+ V4IR::Expr* right = *expression(ast->right);
- IR::Expr *e = binop(IR::binaryOperator(ast->op), left, right);
+ V4IR::Expr *e = binop(V4IR::binaryOperator(ast->op), left, right);
if (e->asConst() || e->asString())
_expr.code = e;
else {
@@ -1850,11 +1850,11 @@ bool Codegen::visit(BinaryExpression *ast)
bool Codegen::visit(CallExpression *ast)
{
Result base = expression(ast->base);
- IR::ExprList *args = 0, **args_it = &args;
+ V4IR::ExprList *args = 0, **args_it = &args;
for (ArgumentList *it = ast->arguments; it; it = it->next) {
Result arg = expression(it->expression);
- IR::Expr *actual = argument(*arg);
- *args_it = _function->New<IR::ExprList>();
+ V4IR::Expr *actual = argument(*arg);
+ *args_it = _function->New<V4IR::ExprList>();
(*args_it)->init(actual);
args_it = &(*args_it)->next;
}
@@ -1864,9 +1864,9 @@ bool Codegen::visit(CallExpression *ast)
bool Codegen::visit(ConditionalExpression *ast)
{
- IR::BasicBlock *iftrue = _function->newBasicBlock();
- IR::BasicBlock *iffalse = _function->newBasicBlock();
- IR::BasicBlock *endif = _function->newBasicBlock();
+ V4IR::BasicBlock *iftrue = _function->newBasicBlock();
+ V4IR::BasicBlock *iffalse = _function->newBasicBlock();
+ V4IR::BasicBlock *endif = _function->newBasicBlock();
const unsigned t = _block->newTemp();
@@ -1889,13 +1889,13 @@ bool Codegen::visit(ConditionalExpression *ast)
bool Codegen::visit(DeleteExpression *ast)
{
- IR::Expr* expr = *expression(ast->expression);
+ V4IR::Expr* expr = *expression(ast->expression);
// Temporaries cannot be deleted
if (expr->asTemp() && expr->asTemp()->index < _env->members.size()) {
// Trying to delete a function argument might throw.
if (_function->isStrict && expr->asTemp()->index < 0)
throwSyntaxError(ast->deleteToken, "Delete of an unqualified identifier in strict mode.");
- _expr.code = _block->CONST(IR::BoolType, 0);
+ _expr.code = _block->CONST(V4IR::BoolType, 0);
return false;
}
if (_function->isStrict && expr->asName())
@@ -1903,7 +1903,7 @@ bool Codegen::visit(DeleteExpression *ast)
// [[11.4.1]] Return true if it's not a reference
if (expr->asConst() || expr->asString()) {
- _expr.code = _block->CONST(IR::BoolType, 1);
+ _expr.code = _block->CONST(V4IR::BoolType, 1);
return false;
}
@@ -1911,17 +1911,17 @@ bool Codegen::visit(DeleteExpression *ast)
// perform the call to allow for side effects.
if (expr->asCall()) {
_block->EXP(expr);
- _expr.code = _block->CONST(IR::BoolType, 1);
+ _expr.code = _block->CONST(V4IR::BoolType, 1);
return false;
}
if (expr->asTemp() && expr->asTemp()->index >= _env->members.size()) {
- _expr.code = _block->CONST(IR::BoolType, 1);
+ _expr.code = _block->CONST(V4IR::BoolType, 1);
return false;
}
- IR::ExprList *args = _function->New<IR::ExprList>();
+ V4IR::ExprList *args = _function->New<V4IR::ExprList>();
args->init(reference(expr));
- _expr.code = call(_block->NAME(IR::Name::builtin_delete, ast->deleteToken.startLine, ast->deleteToken.startColumn), args);
+ _expr.code = call(_block->NAME(V4IR::Name::builtin_delete, ast->deleteToken.startLine, ast->deleteToken.startColumn), args);
return false;
}
@@ -1930,7 +1930,7 @@ bool Codegen::visit(FalseLiteral *)
if (_expr.accept(cx)) {
_block->JUMP(_expr.iffalse);
} else {
- _expr.code = _block->CONST(IR::BoolType, 0);
+ _expr.code = _block->CONST(V4IR::BoolType, 0);
}
return false;
}
@@ -1944,18 +1944,18 @@ bool Codegen::visit(FieldMemberExpression *ast)
bool Codegen::visit(FunctionExpression *ast)
{
- IR::Function *function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0);
+ V4IR::Function *function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0);
if (_debugger)
_debugger->setSourceLocation(function, ast->functionToken.startLine, ast->functionToken.startColumn);
_expr.code = _block->CLOSURE(function);
return false;
}
-IR::Expr *Codegen::identifier(const QString &name, int line, int col)
+V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
{
uint scope = 0;
Environment *e = _env;
- IR::Function *f = _function;
+ V4IR::Function *f = _function;
while (f && e->parent) {
if ((f->usesArgumentsObject && name == "arguments") || (!f->isStrict && f->hasDirectEval) || f->insideWithOrCatch)
@@ -1997,7 +1997,7 @@ bool Codegen::visit(NestedExpression *ast)
bool Codegen::visit(NewExpression *ast)
{
Result base = expression(ast->expression);
- IR::Expr *expr = *base;
+ V4IR::Expr *expr = *base;
if (expr && !expr->asTemp() && !expr->asName() && !expr->asMember()) {
const unsigned t = _block->newTemp();
move(_block->TEMP(t), expr);
@@ -2010,18 +2010,18 @@ bool Codegen::visit(NewExpression *ast)
bool Codegen::visit(NewMemberExpression *ast)
{
Result base = expression(ast->base);
- IR::Expr *expr = *base;
+ V4IR::Expr *expr = *base;
if (expr && !expr->asTemp() && !expr->asName() && !expr->asMember()) {
const unsigned t = _block->newTemp();
move(_block->TEMP(t), expr);
expr = _block->TEMP(t);
}
- IR::ExprList *args = 0, **args_it = &args;
+ V4IR::ExprList *args = 0, **args_it = &args;
for (ArgumentList *it = ast->arguments; it; it = it->next) {
Result arg = expression(it->expression);
- IR::Expr *actual = argument(*arg);
- *args_it = _function->New<IR::ExprList>();
+ V4IR::Expr *actual = argument(*arg);
+ *args_it = _function->New<V4IR::ExprList>();
(*args_it)->init(actual);
args_it = &(*args_it)->next;
}
@@ -2035,7 +2035,7 @@ bool Codegen::visit(NotExpression *ast)
{
Result expr = expression(ast->expression);
const unsigned r = _block->newTemp();
- move(_block->TEMP(r), unop(IR::OpNot, *expr));
+ move(_block->TEMP(r), unop(V4IR::OpNot, *expr));
_expr.code = _block->TEMP(r);
return false;
}
@@ -2043,7 +2043,7 @@ bool Codegen::visit(NotExpression *ast)
bool Codegen::visit(NullExpression *)
{
if (_expr.accept(cx)) _block->JUMP(_expr.iffalse);
- else _expr.code = _block->CONST(IR::NullType, 0);
+ else _expr.code = _block->CONST(V4IR::NullType, 0);
return false;
}
@@ -2054,15 +2054,15 @@ bool Codegen::visit(NumericLiteral *ast)
if (ast->value) _block->JUMP(_expr.iftrue);
else _block->JUMP(_expr.iffalse);
} else {
- _expr.code = _block->CONST(IR::NumberType, ast->value);
+ _expr.code = _block->CONST(V4IR::NumberType, ast->value);
}
return false;
}
struct ObjectPropertyValue {
- IR::Expr *value;
- IR::Function *getter;
- IR::Function *setter;
+ V4IR::Expr *value;
+ V4IR::Function *getter;
+ V4IR::Function *setter;
};
bool Codegen::visit(ObjectLiteral *ast)
@@ -2083,7 +2083,7 @@ bool Codegen::visit(ObjectLiteral *ast)
valueMap[name].value = *value;
} else if (PropertyGetterSetter *gs = AST::cast<AST::PropertyGetterSetter *>(it->assignment)) {
QString name = propertyName(gs->name);
- IR::Function *function = defineFunction(name, gs, gs->formals, gs->functionBody ? gs->functionBody->elements : 0);
+ V4IR::Function *function = defineFunction(name, gs, gs->formals, gs->functionBody ? gs->functionBody->elements : 0);
if (_debugger)
_debugger->setSourceLocation(function, gs->getSetToken.startLine, gs->getSetToken.startColumn);
ObjectPropertyValue &v = valueMap[name];
@@ -2105,13 +2105,13 @@ bool Codegen::visit(ObjectLiteral *ast)
unsigned getter = 0;
unsigned setter = 0;
for (QMap<QString, ObjectPropertyValue>::const_iterator it = valueMap.constBegin(); it != valueMap.constEnd(); ++it) {
- IR::ExprList *args = _function->New<IR::ExprList>();
- IR::ExprList *current = args;
+ V4IR::ExprList *args = _function->New<V4IR::ExprList>();
+ V4IR::ExprList *current = args;
current->expr = _block->TEMP(t);
- current->next = _function->New<IR::ExprList>();
+ current->next = _function->New<V4IR::ExprList>();
current = current->next;
current->expr = _block->NAME(it.key(), 0, 0);
- current->next = _function->New<IR::ExprList>();
+ current->next = _function->New<V4IR::ExprList>();
current = current->next;
if (it->value) {
@@ -2120,22 +2120,22 @@ bool Codegen::visit(ObjectLiteral *ast)
move(_block->TEMP(value), it->value);
// __qmljs_builtin_define_property(Value object, String *name, Value val, ExecutionContext *ctx)
current->expr = _block->TEMP(value);
- _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_define_property, 0, 0), args));
+ _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_define_property, 0, 0), args));
} else {
if (!getter) {
getter = _block->newTemp();
setter = _block->newTemp();
}
- move(_block->TEMP(getter), it->getter ? _block->CLOSURE(it->getter) : _block->CONST(IR::UndefinedType, 0));
- move(_block->TEMP(setter), it->setter ? _block->CLOSURE(it->setter) : _block->CONST(IR::UndefinedType, 0));
+ move(_block->TEMP(getter), it->getter ? _block->CLOSURE(it->getter) : _block->CONST(V4IR::UndefinedType, 0));
+ move(_block->TEMP(setter), it->setter ? _block->CLOSURE(it->setter) : _block->CONST(V4IR::UndefinedType, 0));
// __qmljs_builtin_define_getter_setter(Value object, String *name, Value getter, Value setter, ExecutionContext *ctx);
current->expr = _block->TEMP(getter);
- current->next = _function->New<IR::ExprList>();
+ current->next = _function->New<V4IR::ExprList>();
current = current->next;
current->expr = _block->TEMP(setter);
- _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_define_getter_setter, 0, 0), args));
+ _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_define_getter_setter, 0, 0), args));
}
}
}
@@ -2152,11 +2152,11 @@ bool Codegen::visit(PostDecrementExpression *ast)
throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->decrementToken);
if (_expr.accept(nx)) {
- move(*expr, unop(IR::OpDecrement, *expr));
+ move(*expr, unop(V4IR::OpDecrement, *expr));
} else {
- IR::ExprList *args = _function->New<IR::ExprList>();
+ V4IR::ExprList *args = _function->New<V4IR::ExprList>();
args->init(*expr);
- _expr.code = call(_block->NAME(IR::Name::builtin_postdecrement, ast->lastSourceLocation().startLine, ast->lastSourceLocation().startColumn), args);
+ _expr.code = call(_block->NAME(V4IR::Name::builtin_postdecrement, ast->lastSourceLocation().startLine, ast->lastSourceLocation().startColumn), args);
}
return false;
}
@@ -2169,11 +2169,11 @@ bool Codegen::visit(PostIncrementExpression *ast)
throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->incrementToken);
if (_expr.accept(nx)) {
- move(*expr, unop(IR::OpIncrement, *expr));
+ move(*expr, unop(V4IR::OpIncrement, *expr));
} else {
- IR::ExprList *args = _function->New<IR::ExprList>();
+ V4IR::ExprList *args = _function->New<V4IR::ExprList>();
args->init(*expr);
- _expr.code = call(_block->NAME(IR::Name::builtin_postincrement, ast->lastSourceLocation().startLine, ast->lastSourceLocation().startColumn), args);
+ _expr.code = call(_block->NAME(V4IR::Name::builtin_postincrement, ast->lastSourceLocation().startLine, ast->lastSourceLocation().startColumn), args);
}
return false;
}
@@ -2182,7 +2182,7 @@ bool Codegen::visit(PreDecrementExpression *ast)
{
Result expr = expression(ast->expression);
throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->decrementToken);
- move(*expr, unop(IR::OpDecrement, *expr));
+ move(*expr, unop(V4IR::OpDecrement, *expr));
if (_expr.accept(nx)) {
// nothing to do
} else {
@@ -2195,7 +2195,7 @@ bool Codegen::visit(PreIncrementExpression *ast)
{
Result expr = expression(ast->expression);
throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->incrementToken);
- move(*expr, unop(IR::OpIncrement, *expr));
+ move(*expr, unop(V4IR::OpIncrement, *expr));
if (_expr.accept(nx)) {
// nothing to do
} else {
@@ -2226,7 +2226,7 @@ bool Codegen::visit(TildeExpression *ast)
{
Result expr = expression(ast->expression);
const unsigned t = _block->newTemp();
- move(_block->TEMP(t), unop(IR::OpCompl, *expr));
+ move(_block->TEMP(t), unop(V4IR::OpCompl, *expr));
_expr.code = _block->TEMP(t);
return false;
}
@@ -2236,7 +2236,7 @@ bool Codegen::visit(TrueLiteral *)
if (_expr.accept(cx)) {
_block->JUMP(_expr.iftrue);
} else {
- _expr.code = _block->CONST(IR::BoolType, 1);
+ _expr.code = _block->CONST(V4IR::BoolType, 1);
}
return false;
}
@@ -2244,9 +2244,9 @@ bool Codegen::visit(TrueLiteral *)
bool Codegen::visit(TypeOfExpression *ast)
{
Result expr = expression(ast->expression);
- IR::ExprList *args = _function->New<IR::ExprList>();
+ V4IR::ExprList *args = _function->New<V4IR::ExprList>();
args->init(reference(*expr));
- _expr.code = call(_block->NAME(IR::Name::builtin_typeof, ast->typeofToken.startLine, ast->typeofToken.startColumn), args);
+ _expr.code = call(_block->NAME(V4IR::Name::builtin_typeof, ast->typeofToken.startLine, ast->typeofToken.startColumn), args);
return false;
}
@@ -2254,7 +2254,7 @@ bool Codegen::visit(UnaryMinusExpression *ast)
{
Result expr = expression(ast->expression);
const unsigned t = _block->newTemp();
- move(_block->TEMP(t), unop(IR::OpUMinus, *expr));
+ move(_block->TEMP(t), unop(V4IR::OpUMinus, *expr));
_expr.code = _block->TEMP(t);
return false;
}
@@ -2263,7 +2263,7 @@ bool Codegen::visit(UnaryPlusExpression *ast)
{
Result expr = expression(ast->expression);
const unsigned t = _block->newTemp();
- move(_block->TEMP(t), unop(IR::OpUPlus, *expr));
+ move(_block->TEMP(t), unop(V4IR::OpUPlus, *expr));
_expr.code = _block->TEMP(t);
return false;
}
@@ -2271,7 +2271,7 @@ bool Codegen::visit(UnaryPlusExpression *ast)
bool Codegen::visit(VoidExpression *ast)
{
statement(ast->expression);
- _expr.code = _block->CONST(IR::UndefinedType, 0);
+ _expr.code = _block->CONST(V4IR::UndefinedType, 0);
return false;
}
@@ -2281,27 +2281,27 @@ bool Codegen::visit(FunctionDeclaration * /*ast*/)
return false;
}
-void Codegen::linearize(IR::Function *function)
+void Codegen::linearize(V4IR::Function *function)
{
- IR::BasicBlock *exitBlock = function->basicBlocks.last();
+ V4IR::BasicBlock *exitBlock = function->basicBlocks.last();
assert(exitBlock->isTerminated());
assert(exitBlock->terminator()->asRet());
- QSet<IR::BasicBlock *> V;
+ QSet<V4IR::BasicBlock *> V;
V.insert(exitBlock);
- QVector<IR::BasicBlock *> trace;
+ QVector<V4IR::BasicBlock *> trace;
for (int i = 0; i < function->basicBlocks.size(); ++i) {
- IR::BasicBlock *block = function->basicBlocks.at(i);
+ V4IR::BasicBlock *block = function->basicBlocks.at(i);
if (!block->isTerminated() && (i + 1) < function->basicBlocks.size()) {
- IR::BasicBlock *next = function->basicBlocks.at(i + 1);
+ V4IR::BasicBlock *next = function->basicBlocks.at(i + 1);
block->JUMP(next);
}
}
- struct I { static void trace(IR::BasicBlock *block, QSet<IR::BasicBlock *> *V,
- QVector<IR::BasicBlock *> *output) {
+ struct I { static void trace(V4IR::BasicBlock *block, QSet<V4IR::BasicBlock *> *V,
+ QVector<V4IR::BasicBlock *> *output) {
if (block == 0 || V->contains(block))
return;
@@ -2309,15 +2309,15 @@ void Codegen::linearize(IR::Function *function)
block->index = output->size();
output->append(block);
- if (IR::Stmt *term = block->terminator()) {
- if (IR::Jump *j = term->asJump()) {
+ if (V4IR::Stmt *term = block->terminator()) {
+ if (V4IR::Jump *j = term->asJump()) {
trace(j->target, V, output);
- } else if (IR::CJump *cj = term->asCJump()) {
+ } else if (V4IR::CJump *cj = term->asCJump()) {
if (! V->contains(cj->iffalse))
trace(cj->iffalse, V, output);
else
trace(cj->iftrue, V, output);
- } else if (IR::Try *t = term->asTry()) {
+ } else if (V4IR::Try *t = term->asTry()) {
trace(t->tryBlock, V, output);
trace(t->catchBlock, V, output);
}
@@ -2336,10 +2336,10 @@ void Codegen::linearize(IR::Function *function)
exitBlock->index = trace.size();
trace.append(exitBlock);
- QVarLengthArray<IR::BasicBlock*> blocksToDelete;
- foreach (IR::BasicBlock *b, function->basicBlocks) {
+ QVarLengthArray<V4IR::BasicBlock*> blocksToDelete;
+ foreach (V4IR::BasicBlock *b, function->basicBlocks) {
if (!V.contains(b)) {
- foreach (IR::BasicBlock *out, b->out) {
+ foreach (V4IR::BasicBlock *out, b->out) {
int idx = out->in.indexOf(b);
if (idx >= 0)
out->in.remove(idx);
@@ -2364,12 +2364,12 @@ void Codegen::linearize(IR::Function *function)
static bool showCode = !qgetenv("SHOW_CODE").isNull();
if (showCode) {
- QVector<IR::Stmt *> code;
- QHash<IR::Stmt *, IR::BasicBlock *> leader;
+ QVector<V4IR::Stmt *> code;
+ QHash<V4IR::Stmt *, V4IR::BasicBlock *> leader;
- foreach (IR::BasicBlock *block, function->basicBlocks) {
+ foreach (V4IR::BasicBlock *block, function->basicBlocks) {
leader.insert(block->statements.first(), block);
- foreach (IR::Stmt *s, block->statements) {
+ foreach (V4IR::Stmt *s, block->statements) {
code.append(s);
}
}
@@ -2394,9 +2394,9 @@ void Codegen::linearize(IR::Function *function)
}
for (int i = 0; i < code.size(); ++i) {
- IR::Stmt *s = code.at(i);
+ V4IR::Stmt *s = code.at(i);
- if (IR::BasicBlock *bb = leader.value(s)) {
+ if (V4IR::BasicBlock *bb = leader.value(s)) {
qout << endl;
QByteArray str;
str.append('L');
@@ -2406,11 +2406,11 @@ void Codegen::linearize(IR::Function *function)
str.append(' ');
qout << str;
qout << "// predecessor blocks:";
- foreach (IR::BasicBlock *in, bb->in)
+ foreach (V4IR::BasicBlock *in, bb->in)
qout << " L" << in->index;
qout << endl;
}
- IR::Stmt *n = (i + 1) < code.size() ? code.at(i + 1) : 0;
+ V4IR::Stmt *n = (i + 1) < code.size() ? code.at(i + 1) : 0;
if (n && s->asJump() && s->asJump()->target == leader.value(n)) {
continue;
}
@@ -2419,7 +2419,7 @@ void Codegen::linearize(IR::Function *function)
QBuffer buf(&str);
buf.open(QIODevice::WriteOnly);
QTextStream out(&buf);
- s->dump(out, IR::Stmt::MIR);
+ s->dump(out, V4IR::Stmt::MIR);
out.flush();
#ifndef QV4_NO_LIVENESS
@@ -2479,7 +2479,7 @@ void Codegen::linearize(IR::Function *function)
CompressTemps().run(function);
}
-IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
+V4IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
AST::FormalParameterList *formals,
AST::SourceElements *body, Mode mode,
const QStringList &inheritedLocals)
@@ -2489,13 +2489,13 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
ScopeAndFinally *scopeAndFinally = 0;
enterEnvironment(ast);
- IR::Function *function = _module->newFunction(name, _function);
+ V4IR::Function *function = _module->newFunction(name, _function);
if (_debugger)
_debugger->addFunction(function);
- IR::BasicBlock *entryBlock = function->newBasicBlock();
- IR::BasicBlock *exitBlock = function->newBasicBlock(IR::Function::DontInsertBlock);
- IR::BasicBlock *throwBlock = function->newBasicBlock();
+ V4IR::BasicBlock *entryBlock = function->newBasicBlock();
+ V4IR::BasicBlock *exitBlock = function->newBasicBlock(V4IR::Function::DontInsertBlock);
+ V4IR::BasicBlock *throwBlock = function->newBasicBlock();
function->hasDirectEval = _env->hasDirectEval;
function->usesArgumentsObject = (_env->usesArgumentsObject == Environment::ArgumentsObjectUsed);
function->maxNumberOfArguments = _env->maxNumberOfArguments;
@@ -2521,31 +2521,31 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
}
}
- IR::ExprList *args = 0;
+ V4IR::ExprList *args = 0;
for (Environment::MemberMap::const_iterator it = _env->members.constBegin(); it != _env->members.constEnd(); ++it) {
const QString &local = it.key();
- IR::ExprList *next = function->New<IR::ExprList>();
+ V4IR::ExprList *next = function->New<V4IR::ExprList>();
next->expr = entryBlock->NAME(local, 0, 0);
next->next = args;
args = next;
}
if (args) {
- IR::ExprList *next = function->New<IR::ExprList>();
- next->expr = entryBlock->CONST(IR::BoolType, mode == EvalCode);
+ V4IR::ExprList *next = function->New<V4IR::ExprList>();
+ next->expr = entryBlock->CONST(V4IR::BoolType, mode == EvalCode);
next->next = args;
args = next;
- entryBlock->EXP(entryBlock->CALL(entryBlock->NAME(IR::Name::builtin_declare_vars, 0, 0), args));
+ entryBlock->EXP(entryBlock->CALL(entryBlock->NAME(V4IR::Name::builtin_declare_vars, 0, 0), args));
}
}
unsigned returnAddress = entryBlock->newTemp();
- entryBlock->MOVE(entryBlock->TEMP(returnAddress), entryBlock->CONST(IR::UndefinedType, 0));
+ entryBlock->MOVE(entryBlock->TEMP(returnAddress), entryBlock->CONST(V4IR::UndefinedType, 0));
exitBlock->RET(exitBlock->TEMP(returnAddress));
- IR::ExprList *throwArgs = function->New<IR::ExprList>();
+ V4IR::ExprList *throwArgs = function->New<V4IR::ExprList>();
throwArgs->expr = throwBlock->TEMP(returnAddress);
- throwBlock->EXP(throwBlock->CALL(throwBlock->NAME(IR::Name::builtin_throw, /*line*/0, /*column*/0), throwArgs));
+ throwBlock->EXP(throwBlock->CALL(throwBlock->NAME(V4IR::Name::builtin_throw, /*line*/0, /*column*/0), throwArgs));
throwBlock->JUMP(exitBlock);
Loop *loop = 0;
@@ -2563,7 +2563,7 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
foreach (const Environment::Member &member, _env->members) {
if (member.function) {
- IR::Function *function = defineFunction(member.function->name.toString(), member.function, member.function->formals,
+ V4IR::Function *function = defineFunction(member.function->name.toString(), member.function, member.function->formals,
member.function->body ? member.function->body->elements : 0);
if (_debugger)
_debugger->setSourceLocation(function, member.function->functionToken.startLine, member.function->functionToken.startColumn);
@@ -2699,9 +2699,9 @@ bool Codegen::visit(DebuggerStatement *)
bool Codegen::visit(DoWhileStatement *ast)
{
- IR::BasicBlock *loopbody = _function->newBasicBlock();
- IR::BasicBlock *loopcond = _function->newBasicBlock();
- IR::BasicBlock *loopend = _function->newBasicBlock();
+ V4IR::BasicBlock *loopbody = _function->newBasicBlock();
+ V4IR::BasicBlock *loopcond = _function->newBasicBlock();
+ V4IR::BasicBlock *loopend = _function->newBasicBlock();
enterLoop(ast, loopend, loopcond);
@@ -2740,19 +2740,19 @@ bool Codegen::visit(ExpressionStatement *ast)
bool Codegen::visit(ForEachStatement *ast)
{
- IR::BasicBlock *foreachin = _function->newBasicBlock();
- IR::BasicBlock *foreachbody = _function->newBasicBlock();
- IR::BasicBlock *foreachend = _function->newBasicBlock();
+ V4IR::BasicBlock *foreachin = _function->newBasicBlock();
+ V4IR::BasicBlock *foreachbody = _function->newBasicBlock();
+ V4IR::BasicBlock *foreachend = _function->newBasicBlock();
enterLoop(ast, foreachend, foreachin);
int objectToIterateOn = _block->newTemp();
move(_block->TEMP(objectToIterateOn), *expression(ast->expression));
- IR::ExprList *args = _function->New<IR::ExprList>();
+ V4IR::ExprList *args = _function->New<V4IR::ExprList>();
args->init(_block->TEMP(objectToIterateOn));
int iterator = _block->newTemp();
- move(_block->TEMP(iterator), _block->CALL(_block->NAME(IR::Name::builtin_foreach_iterator_object, 0, 0), args));
+ move(_block->TEMP(iterator), _block->CALL(_block->NAME(V4IR::Name::builtin_foreach_iterator_object, 0, 0), args));
_block->JUMP(foreachin);
@@ -2764,12 +2764,12 @@ bool Codegen::visit(ForEachStatement *ast)
_block = foreachin;
- args = _function->New<IR::ExprList>();
+ args = _function->New<V4IR::ExprList>();
args->init(_block->TEMP(iterator));
- move(_block->TEMP(temp), _block->CALL(_block->NAME(IR::Name::builtin_foreach_next_property_name, 0, 0), args));
+ move(_block->TEMP(temp), _block->CALL(_block->NAME(V4IR::Name::builtin_foreach_next_property_name, 0, 0), args));
int null = _block->newTemp();
- move(_block->TEMP(null), _block->CONST(IR::NullType, 0));
- cjump(_block->BINOP(IR::OpStrictNotEqual, _block->TEMP(temp), _block->TEMP(null)), foreachbody, foreachend);
+ move(_block->TEMP(null), _block->CONST(V4IR::NullType, 0));
+ cjump(_block->BINOP(V4IR::OpStrictNotEqual, _block->TEMP(temp), _block->TEMP(null)), foreachbody, foreachend);
_block = foreachend;
leaveLoop();
@@ -2778,10 +2778,10 @@ bool Codegen::visit(ForEachStatement *ast)
bool Codegen::visit(ForStatement *ast)
{
- IR::BasicBlock *forcond = _function->newBasicBlock();
- IR::BasicBlock *forbody = _function->newBasicBlock();
- IR::BasicBlock *forstep = _function->newBasicBlock();
- IR::BasicBlock *forend = _function->newBasicBlock();
+ V4IR::BasicBlock *forcond = _function->newBasicBlock();
+ V4IR::BasicBlock *forbody = _function->newBasicBlock();
+ V4IR::BasicBlock *forstep = _function->newBasicBlock();
+ V4IR::BasicBlock *forend = _function->newBasicBlock();
enterLoop(ast, forend, forstep);
@@ -2807,9 +2807,9 @@ bool Codegen::visit(ForStatement *ast)
bool Codegen::visit(IfStatement *ast)
{
- IR::BasicBlock *iftrue = _function->newBasicBlock();
- IR::BasicBlock *iffalse = ast->ko ? _function->newBasicBlock() : 0;
- IR::BasicBlock *endif = _function->newBasicBlock();
+ V4IR::BasicBlock *iftrue = _function->newBasicBlock();
+ V4IR::BasicBlock *iffalse = ast->ko ? _function->newBasicBlock() : 0;
+ V4IR::BasicBlock *endif = _function->newBasicBlock();
condition(ast->expression, iftrue, ast->ko ? iffalse : endif);
_block = iftrue;
@@ -2840,7 +2840,7 @@ bool Codegen::visit(LabelledStatement *ast)
AST::cast<AST::LocalForEachStatement *>(ast->statement)) {
statement(ast->statement); // labelledStatement will be associated with the ast->statement's loop.
} else {
- IR::BasicBlock *breakBlock = _function->newBasicBlock();
+ V4IR::BasicBlock *breakBlock = _function->newBasicBlock();
enterLoop(ast->statement, breakBlock, /*continueBlock*/ 0);
statement(ast->statement);
_block->JUMP(breakBlock);
@@ -2853,9 +2853,9 @@ bool Codegen::visit(LabelledStatement *ast)
bool Codegen::visit(LocalForEachStatement *ast)
{
- IR::BasicBlock *foreachin = _function->newBasicBlock();
- IR::BasicBlock *foreachbody = _function->newBasicBlock();
- IR::BasicBlock *foreachend = _function->newBasicBlock();
+ V4IR::BasicBlock *foreachin = _function->newBasicBlock();
+ V4IR::BasicBlock *foreachbody = _function->newBasicBlock();
+ V4IR::BasicBlock *foreachend = _function->newBasicBlock();
enterLoop(ast, foreachend, foreachin);
@@ -2863,9 +2863,9 @@ bool Codegen::visit(LocalForEachStatement *ast)
int iterator = _block->newTemp();
move(_block->TEMP(iterator), *expression(ast->expression));
- IR::ExprList *args = _function->New<IR::ExprList>();
+ V4IR::ExprList *args = _function->New<V4IR::ExprList>();
args->init(_block->TEMP(iterator));
- move(_block->TEMP(iterator), _block->CALL(_block->NAME(IR::Name::builtin_foreach_iterator_object, 0, 0), args));
+ move(_block->TEMP(iterator), _block->CALL(_block->NAME(V4IR::Name::builtin_foreach_iterator_object, 0, 0), args));
_block->JUMP(foreachin);
@@ -2877,12 +2877,12 @@ bool Codegen::visit(LocalForEachStatement *ast)
_block = foreachin;
- args = _function->New<IR::ExprList>();
+ args = _function->New<V4IR::ExprList>();
args->init(_block->TEMP(iterator));
- move(_block->TEMP(temp), _block->CALL(_block->NAME(IR::Name::builtin_foreach_next_property_name, 0, 0), args));
+ move(_block->TEMP(temp), _block->CALL(_block->NAME(V4IR::Name::builtin_foreach_next_property_name, 0, 0), args));
int null = _block->newTemp();
- move(_block->TEMP(null), _block->CONST(IR::NullType, 0));
- cjump(_block->BINOP(IR::OpStrictNotEqual, _block->TEMP(temp), _block->TEMP(null)), foreachbody, foreachend);
+ move(_block->TEMP(null), _block->CONST(V4IR::NullType, 0));
+ cjump(_block->BINOP(V4IR::OpStrictNotEqual, _block->TEMP(temp), _block->TEMP(null)), foreachbody, foreachend);
_block = foreachend;
leaveLoop();
@@ -2891,10 +2891,10 @@ bool Codegen::visit(LocalForEachStatement *ast)
bool Codegen::visit(LocalForStatement *ast)
{
- IR::BasicBlock *forcond = _function->newBasicBlock();
- IR::BasicBlock *forbody = _function->newBasicBlock();
- IR::BasicBlock *forstep = _function->newBasicBlock();
- IR::BasicBlock *forend = _function->newBasicBlock();
+ V4IR::BasicBlock *forcond = _function->newBasicBlock();
+ V4IR::BasicBlock *forbody = _function->newBasicBlock();
+ V4IR::BasicBlock *forstep = _function->newBasicBlock();
+ V4IR::BasicBlock *forend = _function->newBasicBlock();
enterLoop(ast, forend, forstep);
@@ -2934,13 +2934,13 @@ bool Codegen::visit(ReturnStatement *ast)
bool Codegen::visit(SwitchStatement *ast)
{
- IR::BasicBlock *switchend = _function->newBasicBlock();
+ V4IR::BasicBlock *switchend = _function->newBasicBlock();
if (ast->block) {
Result lhs = expression(ast->expression);
- IR::BasicBlock *switchcond = _block;
+ V4IR::BasicBlock *switchcond = _block;
- QHash<Node *, IR::BasicBlock *> blockMap;
+ QHash<Node *, V4IR::BasicBlock *> blockMap;
enterLoop(ast, switchend, 0);
@@ -2980,18 +2980,18 @@ bool Codegen::visit(SwitchStatement *ast)
for (CaseClauses *it = ast->block->clauses; it; it = it->next) {
CaseClause *clause = it->clause;
Result rhs = expression(clause->expression);
- IR::BasicBlock *iftrue = blockMap[clause];
- IR::BasicBlock *iffalse = _function->newBasicBlock();
- cjump(binop(IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse);
+ V4IR::BasicBlock *iftrue = blockMap[clause];
+ V4IR::BasicBlock *iffalse = _function->newBasicBlock();
+ cjump(binop(V4IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse);
_block = iffalse;
}
for (CaseClauses *it = ast->block->moreClauses; it; it = it->next) {
CaseClause *clause = it->clause;
Result rhs = expression(clause->expression);
- IR::BasicBlock *iftrue = blockMap[clause];
- IR::BasicBlock *iffalse = _function->newBasicBlock();
- cjump(binop(IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse);
+ V4IR::BasicBlock *iftrue = blockMap[clause];
+ V4IR::BasicBlock *iffalse = _function->newBasicBlock();
+ cjump(binop(V4IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse);
_block = iffalse;
}
@@ -3022,25 +3022,25 @@ bool Codegen::visit(TryStatement *ast)
(ast->catchExpression->name == QLatin1String("eval") || ast->catchExpression->name == QLatin1String("arguments")))
throwSyntaxError(ast->catchExpression->identifierToken, QCoreApplication::translate("qv4codegen", "Catch variable name may not be eval or arguments in strict mode"));
- IR::BasicBlock *tryBody = _function->newBasicBlock();
- IR::BasicBlock *catchBody = _function->newBasicBlock();
+ V4IR::BasicBlock *tryBody = _function->newBasicBlock();
+ V4IR::BasicBlock *catchBody = _function->newBasicBlock();
// We always need a finally body to clean up the exception handler
- IR::BasicBlock *finallyBody = _function->newBasicBlock();
+ V4IR::BasicBlock *finallyBody = _function->newBasicBlock();
- IR::BasicBlock *throwBlock = _function->newBasicBlock();
- IR::ExprList *throwArgs = _function->New<IR::ExprList>();
+ V4IR::BasicBlock *throwBlock = _function->newBasicBlock();
+ V4IR::ExprList *throwArgs = _function->New<V4IR::ExprList>();
throwArgs->expr = throwBlock->TEMP(_returnAddress);
- throwBlock->EXP(throwBlock->CALL(throwBlock->NAME(IR::Name::builtin_throw, /*line*/0, /*column*/0), throwArgs));
+ throwBlock->EXP(throwBlock->CALL(throwBlock->NAME(V4IR::Name::builtin_throw, /*line*/0, /*column*/0), throwArgs));
throwBlock->JUMP(catchBody);
qSwap(_throwBlock, throwBlock);
int hasException = _block->newTemp();
- move(_block->TEMP(hasException), _block->CONST(IR::BoolType, false));
+ move(_block->TEMP(hasException), _block->CONST(V4IR::BoolType, false));
// Pass the hidden "needRethrow" TEMP to the
// builtin_delete_exception_handler, in order to have those TEMPs alive for
// the duration of the exception handling block.
- IR::ExprList *finishTryArgs = _function->New<IR::ExprList>();
+ V4IR::ExprList *finishTryArgs = _function->New<V4IR::ExprList>();
finishTryArgs->init(_block->TEMP(hasException));
ScopeAndFinally tcf(_scopeAndFinally, ast->finallyExpression, finishTryArgs);
@@ -3061,12 +3061,12 @@ bool Codegen::visit(TryStatement *ast)
if (ast->catchExpression) {
// check if an exception got thrown within catch. Go to finally
// and then rethrow
- IR::BasicBlock *b = _function->newBasicBlock();
+ V4IR::BasicBlock *b = _function->newBasicBlock();
_block->CJUMP(_block->TEMP(hasException), finallyBody, b);
_block = b;
}
- move(_block->TEMP(hasException), _block->CONST(IR::BoolType, true));
+ move(_block->TEMP(hasException), _block->CONST(V4IR::BoolType, true));
if (ast->catchExpression) {
++_function->insideWithOrCatch;
@@ -3077,7 +3077,7 @@ bool Codegen::visit(TryStatement *ast)
_scopeAndFinally = scope.parent;
}
--_function->insideWithOrCatch;
- move(_block->TEMP(hasException), _block->CONST(IR::BoolType, false));
+ move(_block->TEMP(hasException), _block->CONST(V4IR::BoolType, false));
}
_block->JUMP(finallyBody);
@@ -3085,15 +3085,15 @@ bool Codegen::visit(TryStatement *ast)
qSwap(_throwBlock, throwBlock);
- IR::BasicBlock *after = _function->newBasicBlock();
+ V4IR::BasicBlock *after = _function->newBasicBlock();
_block = finallyBody;
- _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_finish_try, 0, 0), finishTryArgs));
+ _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_finish_try, 0, 0), finishTryArgs));
if (ast->finallyExpression && ast->finallyExpression->statement)
statement(ast->finallyExpression->statement);
- IR::BasicBlock *rethrowBlock = _function->newBasicBlock();
+ V4IR::BasicBlock *rethrowBlock = _function->newBasicBlock();
_block->CJUMP(_block->TEMP(hasException), rethrowBlock, after);
_block = rethrowBlock;
move(_block->TEMP(_returnAddress), _block->TEMP(exception_to_rethrow));
@@ -3112,14 +3112,14 @@ void Codegen::unwindException(Codegen::ScopeAndFinally *outest)
while (_scopeAndFinally != outest) {
switch (_scopeAndFinally->type) {
case ScopeAndFinally::WithScope:
- _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_pop_scope, 0, 0)));
+ _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_pop_scope, 0, 0)));
// fall through
case ScopeAndFinally::CatchScope:
_scopeAndFinally = _scopeAndFinally->parent;
--_function->insideWithOrCatch;
break;
case ScopeAndFinally::TryScope: {
- _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_finish_try, 0, 0), _scopeAndFinally->finishTryArgs));
+ _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_finish_try, 0, 0), _scopeAndFinally->finishTryArgs));
ScopeAndFinally *tc = _scopeAndFinally;
_scopeAndFinally = tc->parent;
if (tc->finally && tc->finally->statement)
@@ -3140,9 +3140,9 @@ bool Codegen::visit(VariableStatement *ast)
bool Codegen::visit(WhileStatement *ast)
{
- IR::BasicBlock *whilecond = _function->newBasicBlock();
- IR::BasicBlock *whilebody = _function->newBasicBlock();
- IR::BasicBlock *whileend = _function->newBasicBlock();
+ V4IR::BasicBlock *whilecond = _function->newBasicBlock();
+ V4IR::BasicBlock *whilebody = _function->newBasicBlock();
+ V4IR::BasicBlock *whileend = _function->newBasicBlock();
enterLoop(ast, whileend, whilecond);
@@ -3164,15 +3164,15 @@ bool Codegen::visit(WithStatement *ast)
{
_function->hasWith = true;
- IR::BasicBlock *withBlock = _function->newBasicBlock();
+ V4IR::BasicBlock *withBlock = _function->newBasicBlock();
_block->JUMP(withBlock);
_block = withBlock;
int withObject = _block->newTemp();
_block->MOVE(_block->TEMP(withObject), *expression(ast->expression));
- IR::ExprList *args = _function->New<IR::ExprList>();
+ V4IR::ExprList *args = _function->New<V4IR::ExprList>();
args->init(_block->TEMP(withObject));
- _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_push_with_scope, 0, 0), args));
+ _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_push_with_scope, 0, 0), args));
++_function->insideWithOrCatch;
{
@@ -3182,9 +3182,9 @@ bool Codegen::visit(WithStatement *ast)
_scopeAndFinally = scope.parent;
}
--_function->insideWithOrCatch;
- _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_pop_scope, 0, 0), 0));
+ _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_pop_scope, 0, 0), 0));
- IR::BasicBlock *next = _function->newBasicBlock();
+ V4IR::BasicBlock *next = _function->newBasicBlock();
_block->JUMP(next);
_block = next;
@@ -3227,11 +3227,11 @@ bool Codegen::visit(UiSourceElement *)
return false;
}
-void Codegen::throwSyntaxErrorOnEvalOrArgumentsInStrictMode(IR::Expr *expr, const SourceLocation& loc)
+void Codegen::throwSyntaxErrorOnEvalOrArgumentsInStrictMode(V4IR::Expr *expr, const SourceLocation& loc)
{
if (!_env->isStrict)
return;
- IR::Name *n = expr->asName();
+ V4IR::Name *n = expr->asName();
if (!n)
return;
if (*n->id == QLatin1String("eval") || *n->id == QLatin1String("arguments"))
diff --git a/src/v4/qv4codegen_p.h b/src/v4/qv4codegen_p.h
index 1e1e19b17b..a3ba261347 100644
--- a/src/v4/qv4codegen_p.h
+++ b/src/v4/qv4codegen_p.h
@@ -80,23 +80,23 @@ public:
FunctionCode
};
- IR::Function *operator()(const QString &fileName,
+ V4IR::Function *operator()(const QString &fileName,
const QString &sourceCode,
AST::Program *ast,
- IR::Module *module,
+ V4IR::Module *module,
Mode mode = GlobalCode,
const QStringList &inheritedLocals = QStringList());
- IR::Function *operator()(const QString &fileName,
+ V4IR::Function *operator()(const QString &fileName,
const QString &sourceCode,
AST::FunctionExpression *ast,
- IR::Module *module);
+ V4IR::Module *module);
protected:
enum Format { ex, cx, nx };
struct Result {
- IR::Expr *code;
- IR::BasicBlock *iftrue;
- IR::BasicBlock *iffalse;
+ V4IR::Expr *code;
+ V4IR::BasicBlock *iftrue;
+ V4IR::BasicBlock *iffalse;
Format format;
Format requested;
@@ -107,15 +107,15 @@ protected:
, format(ex)
, requested(requested) {}
- explicit Result(IR::BasicBlock *iftrue, IR::BasicBlock *iffalse)
+ explicit Result(V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse)
: code(0)
, iftrue(iftrue)
, iffalse(iffalse)
, format(ex)
, requested(cx) {}
- inline IR::Expr *operator*() const { Q_ASSERT(format == ex); return code; }
- inline IR::Expr *operator->() const { Q_ASSERT(format == ex); return code; }
+ inline V4IR::Expr *operator*() const { Q_ASSERT(format == ex); return code; }
+ inline V4IR::Expr *operator->() const { Q_ASSERT(format == ex); return code; }
bool accept(Format f)
{
@@ -233,11 +233,11 @@ protected:
ScopeAndFinally *parent;
AST::Finally *finally;
- IR::ExprList *finishTryArgs;
+ V4IR::ExprList *finishTryArgs;
ScopeType type;
ScopeAndFinally(ScopeAndFinally *parent, ScopeType t = WithScope) : parent(parent), finally(0), finishTryArgs(0), type(t) {}
- ScopeAndFinally(ScopeAndFinally *parent, AST::Finally *finally, IR::ExprList *finishTryArgs)
+ ScopeAndFinally(ScopeAndFinally *parent, AST::Finally *finally, V4IR::ExprList *finishTryArgs)
: parent(parent), finally(finally), finishTryArgs(finishTryArgs), type(TryScope)
{}
};
@@ -245,34 +245,34 @@ protected:
struct Loop {
AST::LabelledStatement *labelledStatement;
AST::Statement *node;
- IR::BasicBlock *breakBlock;
- IR::BasicBlock *continueBlock;
+ V4IR::BasicBlock *breakBlock;
+ V4IR::BasicBlock *continueBlock;
Loop *parent;
ScopeAndFinally *scopeAndFinally;
- Loop(AST::Statement *node, IR::BasicBlock *breakBlock, IR::BasicBlock *continueBlock, Loop *parent)
+ Loop(AST::Statement *node, V4IR::BasicBlock *breakBlock, V4IR::BasicBlock *continueBlock, Loop *parent)
: labelledStatement(0), node(node), breakBlock(breakBlock), continueBlock(continueBlock), parent(parent) {}
};
void enterEnvironment(AST::Node *node);
void leaveEnvironment();
- void enterLoop(AST::Statement *node, IR::BasicBlock *breakBlock, IR::BasicBlock *continueBlock);
+ void enterLoop(AST::Statement *node, V4IR::BasicBlock *breakBlock, V4IR::BasicBlock *continueBlock);
void leaveLoop();
- IR::Expr *member(IR::Expr *base, const QString *name);
- IR::Expr *subscript(IR::Expr *base, IR::Expr *index);
- IR::Expr *argument(IR::Expr *expr);
- IR::Expr *reference(IR::Expr *expr);
- IR::Expr *unop(IR::AluOp op, IR::Expr *expr);
- IR::Expr *binop(IR::AluOp op, IR::Expr *left, IR::Expr *right);
- IR::Expr *call(IR::Expr *base, IR::ExprList *args);
- void move(IR::Expr *target, IR::Expr *source, IR::AluOp op = IR::OpInvalid);
- void cjump(IR::Expr *cond, IR::BasicBlock *iftrue, IR::BasicBlock *iffalse);
+ V4IR::Expr *member(V4IR::Expr *base, const QString *name);
+ V4IR::Expr *subscript(V4IR::Expr *base, V4IR::Expr *index);
+ V4IR::Expr *argument(V4IR::Expr *expr);
+ V4IR::Expr *reference(V4IR::Expr *expr);
+ V4IR::Expr *unop(V4IR::AluOp op, V4IR::Expr *expr);
+ V4IR::Expr *binop(V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right);
+ V4IR::Expr *call(V4IR::Expr *base, V4IR::ExprList *args);
+ void move(V4IR::Expr *target, V4IR::Expr *source, V4IR::AluOp op = V4IR::OpInvalid);
+ void cjump(V4IR::Expr *cond, V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse);
- void linearize(IR::Function *function);
- IR::Function *defineFunction(const QString &name, AST::Node *ast,
+ void linearize(V4IR::Function *function);
+ V4IR::Function *defineFunction(const QString &name, AST::Node *ast,
AST::FormalParameterList *formals,
AST::SourceElements *body,
Mode mode = FunctionCode,
@@ -283,7 +283,7 @@ protected:
void statement(AST::Statement *ast);
void statement(AST::ExpressionNode *ast);
- void condition(AST::ExpressionNode *ast, IR::BasicBlock *iftrue, IR::BasicBlock *iffalse);
+ void condition(AST::ExpressionNode *ast, V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse);
Result expression(AST::ExpressionNode *ast);
QString propertyName(AST::PropertyName *ast);
Result sourceElement(AST::SourceElement *ast);
@@ -297,7 +297,7 @@ protected:
void variableDeclaration(AST::VariableDeclaration *ast);
void variableDeclarationList(AST::VariableDeclarationList *ast);
- IR::Expr *identifier(const QString &name, int line = 0, int col = 0);
+ V4IR::Expr *identifier(const QString &name, int line = 0, int col = 0);
// nodes
virtual bool visit(AST::ArgumentList *ast);
@@ -401,7 +401,7 @@ protected:
virtual bool visit(AST::UiScriptBinding *ast);
virtual bool visit(AST::UiSourceElement *ast);
- void throwSyntaxErrorOnEvalOrArgumentsInStrictMode(IR::Expr* expr, const AST::SourceLocation &loc);
+ void throwSyntaxErrorOnEvalOrArgumentsInStrictMode(V4IR::Expr* expr, const AST::SourceLocation &loc);
void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail);
void throwReferenceError(const AST::SourceLocation &loc, const QString &detail);
@@ -411,11 +411,11 @@ private:
Result _expr;
QString _property;
UiMember _uiMember;
- IR::Module *_module;
- IR::Function *_function;
- IR::BasicBlock *_block;
- IR::BasicBlock *_exitBlock;
- IR::BasicBlock *_throwBlock;
+ V4IR::Module *_module;
+ V4IR::Function *_function;
+ V4IR::BasicBlock *_block;
+ V4IR::BasicBlock *_exitBlock;
+ V4IR::BasicBlock *_throwBlock;
unsigned _returnAddress;
Mode _mode;
Environment *_env;
diff --git a/src/v4/qv4engine.cpp b/src/v4/qv4engine.cpp
index 8664847639..2dbaedc816 100644
--- a/src/v4/qv4engine.cpp
+++ b/src/v4/qv4engine.cpp
@@ -436,12 +436,12 @@ Object *ExecutionEngine::newDateObject(const Value &value)
RegExpObject *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
{
- bool global = (flags & IR::RegExp::RegExp_Global);
+ bool global = (flags & V4IR::RegExp::RegExp_Global);
bool ignoreCase = false;
bool multiline = false;
- if (flags & IR::RegExp::RegExp_IgnoreCase)
+ if (flags & V4IR::RegExp::RegExp_IgnoreCase)
ignoreCase = true;
- if (flags & IR::RegExp::RegExp_Multiline)
+ if (flags & V4IR::RegExp::RegExp_Multiline)
multiline = true;
return newRegExpObject(RegExp::create(this, pattern, ignoreCase, multiline), global);
diff --git a/src/v4/qv4functionobject.cpp b/src/v4/qv4functionobject.cpp
index 6cf9989cb3..83762e85b1 100644
--- a/src/v4/qv4functionobject.cpp
+++ b/src/v4/qv4functionobject.cpp
@@ -205,10 +205,10 @@ Value FunctionCtor::construct(Managed *that, ExecutionContext *ctx, Value *args,
if (!fe)
ctx->throwSyntaxError(0);
- IR::Module module;
+ V4IR::Module module;
Codegen cg(ctx, f->strictMode);
- IR::Function *irf = cg(QString(), function, fe, &module);
+ V4IR::Function *irf = cg(QString(), function, fe, &module);
QScopedPointer<EvalInstructionSelection> isel(ctx->engine->iselFactory->create(ctx->engine, &module));
VM::Function *vmf = isel->vmFunction(irf);
diff --git a/src/v4/qv4globalobject.cpp b/src/v4/qv4globalobject.cpp
index 6e87ef6bf5..0520d7bf7b 100644
--- a/src/v4/qv4globalobject.cpp
+++ b/src/v4/qv4globalobject.cpp
@@ -442,7 +442,7 @@ QQmlJS::VM::Function *EvalFunction::parseSource(QQmlJS::VM::ExecutionContext *ct
MemoryManager::GCBlocker gcBlocker(ctx->engine->memoryManager);
VM::ExecutionEngine *vm = ctx->engine;
- IR::Module module;
+ V4IR::Module module;
VM::Function *globalCode = 0;
{
@@ -488,7 +488,7 @@ QQmlJS::VM::Function *EvalFunction::parseSource(QQmlJS::VM::ExecutionContext *ct
inheritedLocals.append(*i ? (*i)->toQString() : QString());
Codegen cg(ctx, strictMode);
- IR::Function *globalIRCode = cg(fileName, source, program, &module, mode, inheritedLocals);
+ V4IR::Function *globalIRCode = cg(fileName, source, program, &module, mode, inheritedLocals);
QScopedPointer<EvalInstructionSelection> isel(ctx->engine->iselFactory->create(vm, &module));
if (inheritContext)
isel->setUseFastLookups(false);
diff --git a/src/v4/qv4isel_masm.cpp b/src/v4/qv4isel_masm.cpp
index 82657f11bc..43721da753 100644
--- a/src/v4/qv4isel_masm.cpp
+++ b/src/v4/qv4isel_masm.cpp
@@ -104,23 +104,23 @@ const int Assembler::calleeSavedRegisterCount = sizeof(calleeSavedRegisters) / s
const Assembler::VoidType Assembler::Void;
-Assembler::Assembler(IR::Function* function, VM::Function *vmFunction)
+Assembler::Assembler(V4IR::Function* function, VM::Function *vmFunction)
: _function(function), _vmFunction(vmFunction)
{
}
-void Assembler::registerBlock(IR::BasicBlock* block)
+void Assembler::registerBlock(V4IR::BasicBlock* block)
{
_addrs[block] = label();
}
-void Assembler::jumpToBlock(IR::BasicBlock* current, IR::BasicBlock *target)
+void Assembler::jumpToBlock(V4IR::BasicBlock* current, V4IR::BasicBlock *target)
{
if (current->index + 1 != target->index)
_patches[target].append(jump());
}
-void Assembler::addPatch(IR::BasicBlock* targetBlock, Jump targetJump)
+void Assembler::addPatch(V4IR::BasicBlock* targetBlock, Jump targetJump)
{
_patches[targetBlock].append(targetJump);
}
@@ -133,12 +133,12 @@ void Assembler::addPatch(DataLabelPtr patch, Label target)
_dataLabelPatches.append(p);
}
-void Assembler::addPatch(DataLabelPtr patch, IR::BasicBlock *target)
+void Assembler::addPatch(DataLabelPtr patch, V4IR::BasicBlock *target)
{
_labelPatches[target].append(patch);
}
-Assembler::Pointer Assembler::loadTempAddress(RegisterID reg, IR::Temp *t)
+Assembler::Pointer Assembler::loadTempAddress(RegisterID reg, V4IR::Temp *t)
{
int32_t offset = 0;
int scope = t->scope;
@@ -188,7 +188,7 @@ void Assembler::copyValue(Result result, Source source)
}
template <typename Result>
-void Assembler::copyValue(Result result, IR::Expr* source)
+void Assembler::copyValue(Result result, V4IR::Expr* source)
{
#ifdef VALUE_FITS_IN_REGISTER
// Use ReturnValueRegister as "scratch" register because loadArgument
@@ -196,10 +196,10 @@ void Assembler::copyValue(Result result, IR::Expr* source)
loadArgument(source, ReturnValueRegister);
storeArgument(ReturnValueRegister, result);
#else
- if (IR::Temp *temp = source->asTemp()) {
+ if (V4IR::Temp *temp = source->asTemp()) {
loadDouble(temp, FPGpr0);
storeDouble(FPGpr0, result);
- } else if (IR::Const *c = source->asConst()) {
+ } else if (V4IR::Const *c = source->asConst()) {
VM::Value v = convertToValue(c);
storeValue(v, result);
} else {
@@ -209,7 +209,7 @@ void Assembler::copyValue(Result result, IR::Expr* source)
}
-void Assembler::storeValue(VM::Value value, IR::Temp* destination)
+void Assembler::storeValue(VM::Value value, V4IR::Temp* destination)
{
Address addr = loadTempAddress(ScratchRegister, destination);
storeValue(value, addr);
@@ -273,7 +273,7 @@ void Assembler::leaveStandardStackFrame(int locals)
#define NULL_OP \
{ 0, 0, 0, 0 }
-const Assembler::BinaryOperationInfo Assembler::binaryOperations[QQmlJS::IR::LastAluOp + 1] = {
+const Assembler::BinaryOperationInfo Assembler::binaryOperations[QQmlJS::V4IR::LastAluOp + 1] = {
NULL_OP, // OpInvalid
NULL_OP, // OpIfTrue
NULL_OP, // OpNot
@@ -314,7 +314,7 @@ const Assembler::BinaryOperationInfo Assembler::binaryOperations[QQmlJS::IR::Las
NULL_OP // OpOr
};
-void Assembler::generateBinOp(IR::AluOp operation, IR::Temp* target, IR::Temp *left, IR::Temp *right)
+void Assembler::generateBinOp(V4IR::AluOp operation, V4IR::Temp* target, V4IR::Temp *left, V4IR::Temp *right)
{
const BinaryOperationInfo& info = binaryOperations[operation];
if (!info.fallbackImplementation) {
@@ -425,10 +425,10 @@ void Assembler::link(VM::Function *vmFunc)
#endif
{
- QHashIterator<IR::BasicBlock *, QVector<Jump> > it(_patches);
+ QHashIterator<V4IR::BasicBlock *, QVector<Jump> > it(_patches);
while (it.hasNext()) {
it.next();
- IR::BasicBlock *block = it.key();
+ V4IR::BasicBlock *block = it.key();
Label target = _addrs.value(block);
assert(target.isSet());
foreach (Jump jump, it.value())
@@ -450,10 +450,10 @@ void Assembler::link(VM::Function *vmFunc)
linkBuffer.patch(p.dataLabel, linkBuffer.locationOf(p.target));
{
- QHashIterator<IR::BasicBlock *, QVector<DataLabelPtr> > it(_labelPatches);
+ QHashIterator<V4IR::BasicBlock *, QVector<DataLabelPtr> > it(_labelPatches);
while (it.hasNext()) {
it.next();
- IR::BasicBlock *block = it.key();
+ V4IR::BasicBlock *block = it.key();
Label target = _addrs.value(block);
assert(target.isSet());
foreach (DataLabelPtr label, it.value())
@@ -492,7 +492,7 @@ void Assembler::link(VM::Function *vmFunc)
vmFunc->code = (Value (*)(VM::ExecutionContext *, const uchar *)) vmFunc->codeRef.code().executableAddress();
}
-InstructionSelection::InstructionSelection(VM::ExecutionEngine *engine, IR::Module *module)
+InstructionSelection::InstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module)
: EvalInstructionSelection(engine, module)
, _block(0)
, _function(0)
@@ -506,10 +506,10 @@ InstructionSelection::~InstructionSelection()
delete _as;
}
-void InstructionSelection::run(VM::Function *vmFunction, IR::Function *function)
+void InstructionSelection::run(VM::Function *vmFunction, V4IR::Function *function)
{
QVector<Lookup> lookups;
- QSet<IR::BasicBlock*> reentryBlocks;
+ QSet<V4IR::BasicBlock*> reentryBlocks;
qSwap(_function, function);
qSwap(_vmFunction, vmFunction);
qSwap(_lookups, lookups);
@@ -535,7 +535,7 @@ void InstructionSelection::run(VM::Function *vmFunction, IR::Function *function)
_as->loadPtr(addressForArgument(contextPointer), Assembler::ContextRegister);
#endif
- foreach (IR::BasicBlock *block, _function->basicBlocks) {
+ foreach (V4IR::BasicBlock *block, _function->basicBlocks) {
_block = block;
_as->registerBlock(_block);
@@ -550,7 +550,7 @@ void InstructionSelection::run(VM::Function *vmFunction, IR::Function *function)
#endif
}
- foreach (IR::Stmt *s, block->statements) {
+ foreach (V4IR::Stmt *s, block->statements) {
s->accept(this);
}
}
@@ -583,107 +583,107 @@ void InstructionSelection::run(VM::Function *vmFunction, IR::Function *function)
_as = oldAssembler;
}
-void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
callRuntimeMethod(result, __qmljs_call_activation_property, func, args);
}
-void InstructionSelection::callBuiltinTypeofMember(IR::Temp *base, const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof_member, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::Reference(base), identifier(name));
}
-void InstructionSelection::callBuiltinTypeofSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof_element,
Assembler::ContextRegister, Assembler::PointerToValue(result),
Assembler::Reference(base), Assembler::Reference(index));
}
-void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofName(const QString &name, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof_name, Assembler::ContextRegister, Assembler::PointerToValue(result), identifier(name));
}
-void InstructionSelection::callBuiltinTypeofValue(IR::Temp *value, IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofValue(V4IR::Temp *value, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::Reference(value));
}
-void InstructionSelection::callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_delete_member, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::Reference(base), identifier(name));
}
-void InstructionSelection::callBuiltinDeleteSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_delete_subscript, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::Reference(base), Assembler::Reference(index));
}
-void InstructionSelection::callBuiltinDeleteName(const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_delete_name, Assembler::ContextRegister, Assembler::PointerToValue(result), identifier(name));
}
-void InstructionSelection::callBuiltinDeleteValue(IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result)
{
_as->storeValue(Value::fromBoolean(false), result);
}
-void InstructionSelection::callBuiltinPostIncrementMember(IR::Temp *base, const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinPostIncrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_post_increment_member, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::PointerToValue(base), identifier(name));
}
-void InstructionSelection::callBuiltinPostIncrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
+void InstructionSelection::callBuiltinPostIncrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_post_increment_element, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::Reference(base), Assembler::PointerToValue(index));
}
-void InstructionSelection::callBuiltinPostIncrementName(const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinPostIncrementName(const QString &name, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_post_increment_name, Assembler::ContextRegister,
Assembler::PointerToValue(result), identifier(name));
}
-void InstructionSelection::callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result)
+void InstructionSelection::callBuiltinPostIncrementValue(V4IR::Temp *value, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_post_increment, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::PointerToValue(value));
}
-void InstructionSelection::callBuiltinPostDecrementMember(IR::Temp *base, const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinPostDecrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_post_decrement_member, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::Reference(base), identifier(name));
}
-void InstructionSelection::callBuiltinPostDecrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result)
+void InstructionSelection::callBuiltinPostDecrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_post_decrement_element, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::Reference(base),
Assembler::Reference(index));
}
-void InstructionSelection::callBuiltinPostDecrementName(const QString &name, IR::Temp *result)
+void InstructionSelection::callBuiltinPostDecrementName(const QString &name, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_post_decrement_name, Assembler::ContextRegister,
Assembler::PointerToValue(result), identifier(name));
}
-void InstructionSelection::callBuiltinPostDecrementValue(IR::Temp *value, IR::Temp *result)
+void InstructionSelection::callBuiltinPostDecrementValue(V4IR::Temp *value, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_post_decrement, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::PointerToValue(value));
}
-void InstructionSelection::callBuiltinThrow(IR::Temp *arg)
+void InstructionSelection::callBuiltinThrow(V4IR::Temp *arg)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_throw, Assembler::ContextRegister, Assembler::Reference(arg));
}
@@ -712,7 +712,7 @@ static void *tryWrapper(ExecutionContext *context, void *localsPtr, MiddleOfFunc
return addressToContinueAt;
}
-void InstructionSelection::visitTry(IR::Try *t)
+void InstructionSelection::visitTry(V4IR::Try *t)
{
// Call tryWrapper, which is going to re-enter the same function at the address of the try block. At then end
// of the try function the JIT code will return with the address of the sub-sequent instruction, which tryWrapper
@@ -737,17 +737,17 @@ void InstructionSelection::callBuiltinFinishTry()
_as->addPatch(continuation, _as->label());
}
-void InstructionSelection::callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result)
+void InstructionSelection::callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_foreach_iterator_object, Assembler::ContextRegister, Assembler::PointerToValue(result), Assembler::Reference(arg), Assembler::ContextRegister);
}
-void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result)
+void InstructionSelection::callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result)
{
generateFunctionCall(Assembler::Void, __qmljs_foreach_next_property_name, Assembler::PointerToValue(result), Assembler::Reference(arg));
}
-void InstructionSelection::callBuiltinPushWithScope(IR::Temp *arg)
+void InstructionSelection::callBuiltinPushWithScope(V4IR::Temp *arg)
{
generateFunctionCall(Assembler::ContextRegister, __qmljs_builtin_push_with_scope, Assembler::Reference(arg), Assembler::ContextRegister);
}
@@ -763,19 +763,19 @@ void InstructionSelection::callBuiltinDeclareVar(bool deletable, const QString &
Assembler::TrustedImm32(deletable), identifier(name));
}
-void InstructionSelection::callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter)
+void InstructionSelection::callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_define_getter_setter, Assembler::ContextRegister,
Assembler::Reference(object), identifier(name), Assembler::PointerToValue(getter), Assembler::PointerToValue(setter));
}
-void InstructionSelection::callBuiltinDefineProperty(IR::Temp *object, const QString &name, IR::Temp *value)
+void InstructionSelection::callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, V4IR::Temp *value)
{
generateFunctionCall(Assembler::Void, __qmljs_builtin_define_property, Assembler::ContextRegister,
Assembler::Reference(object), identifier(name), Assembler::PointerToValue(value));
}
-void InstructionSelection::callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args)
+void InstructionSelection::callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args)
{
int length = prepareVariableArguments(args);
generateFunctionCall(Assembler::Void, __qmljs_builtin_define_array, Assembler::ContextRegister,
@@ -783,32 +783,32 @@ void InstructionSelection::callBuiltinDefineArray(IR::Temp *result, IR::ExprList
baseAddressForCallArguments(), Assembler::TrustedImm32(length));
}
-void InstructionSelection::callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result)
{
int argc = prepareVariableArguments(args);
- IR::Temp* thisObject = 0;
+ V4IR::Temp* thisObject = 0;
generateFunctionCall(Assembler::Void, __qmljs_call_value, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::PointerToValue(thisObject),
Assembler::Reference(value), baseAddressForCallArguments(), Assembler::TrustedImm32(argc));
}
-void InstructionSelection::loadThisObject(IR::Temp *temp)
+void InstructionSelection::loadThisObject(V4IR::Temp *temp)
{
generateFunctionCall(Assembler::Void, __qmljs_get_thisObject, Assembler::ContextRegister, Assembler::PointerToValue(temp));
}
-void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Temp *targetTemp)
+void InstructionSelection::loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp)
{
_as->storeValue(convertToValue(sourceConst), targetTemp);
}
-void InstructionSelection::loadString(const QString &str, IR::Temp *targetTemp)
+void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp)
{
Value v = Value::fromString(identifier(str));
_as->storeValue(v, targetTemp);
}
-void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp)
+void InstructionSelection::loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp)
{
Value v = Value::fromObject(engine()->newRegExpObject(*sourceRegexp->value,
sourceRegexp->flags));
@@ -816,27 +816,27 @@ void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *target
_as->storeValue(v, targetTemp);
}
-void InstructionSelection::getActivationProperty(const QString &name, IR::Temp *temp)
+void InstructionSelection::getActivationProperty(const QString &name, V4IR::Temp *temp)
{
String *propertyName = identifier(name);
generateFunctionCall(Assembler::Void, __qmljs_get_activation_property, Assembler::ContextRegister, Assembler::PointerToValue(temp), propertyName);
}
-void InstructionSelection::setActivationProperty(IR::Temp *source, const QString &targetName)
+void InstructionSelection::setActivationProperty(V4IR::Temp *source, const QString &targetName)
{
String *propertyName = identifier(targetName);
generateFunctionCall(Assembler::Void, __qmljs_set_activation_property,
Assembler::ContextRegister, propertyName, Assembler::Reference(source));
}
-void InstructionSelection::initClosure(IR::Closure *closure, IR::Temp *target)
+void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *target)
{
VM::Function *vmFunc = vmFunction(closure->value);
assert(vmFunc);
generateFunctionCall(Assembler::Void, __qmljs_init_closure, Assembler::ContextRegister, Assembler::PointerToValue(target), Assembler::TrustedImmPtr(vmFunc));
}
-void InstructionSelection::getProperty(IR::Temp *base, const QString &name, IR::Temp *target)
+void InstructionSelection::getProperty(V4IR::Temp *base, const QString &name, V4IR::Temp *target)
{
if (useFastLookups) {
VM::String *s = identifier(name);
@@ -849,7 +849,7 @@ void InstructionSelection::getProperty(IR::Temp *base, const QString &name, IR::
}
}
-void InstructionSelection::setProperty(IR::Temp *source, IR::Temp *targetBase, const QString &targetName)
+void InstructionSelection::setProperty(V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName)
{
if (useFastLookups) {
VM::String *s = identifier(targetName);
@@ -864,21 +864,21 @@ void InstructionSelection::setProperty(IR::Temp *source, IR::Temp *targetBase, c
}
}
-void InstructionSelection::getElement(IR::Temp *base, IR::Temp *index, IR::Temp *target)
+void InstructionSelection::getElement(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *target)
{
generateFunctionCall(Assembler::Void, __qmljs_get_element, Assembler::ContextRegister,
Assembler::PointerToValue(target), Assembler::Reference(base),
Assembler::Reference(index));
}
-void InstructionSelection::setElement(IR::Temp *source, IR::Temp *targetBase, IR::Temp *targetIndex)
+void InstructionSelection::setElement(V4IR::Temp *source, V4IR::Temp *targetBase, V4IR::Temp *targetIndex)
{
generateFunctionCall(Assembler::Void, __qmljs_set_element, Assembler::ContextRegister,
Assembler::Reference(targetBase), Assembler::Reference(targetIndex),
Assembler::Reference(source));
}
-void InstructionSelection::copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp)
+void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
{
_as->copyValue(targetTemp, sourceTemp);
}
@@ -886,18 +886,18 @@ void InstructionSelection::copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp)
#define setOp(op, opName, operation) \
do { op = operation; opName = isel_stringIfy(operation); } while (0)
-void InstructionSelection::unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp)
+void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
{
VM::UnaryOpName op = 0;
const char *opName = 0;
switch (oper) {
- case IR::OpIfTrue: assert(!"unreachable"); break;
- case IR::OpNot: setOp(op, opName, __qmljs_not); break;
- case IR::OpUMinus: setOp(op, opName, __qmljs_uminus); break;
- case IR::OpUPlus: setOp(op, opName, __qmljs_uplus); break;
- case IR::OpCompl: setOp(op, opName, __qmljs_compl); break;
- case IR::OpIncrement: setOp(op, opName, __qmljs_increment); break;
- case IR::OpDecrement: setOp(op, opName, __qmljs_decrement); break;
+ case V4IR::OpIfTrue: assert(!"unreachable"); break;
+ case V4IR::OpNot: setOp(op, opName, __qmljs_not); break;
+ case V4IR::OpUMinus: setOp(op, opName, __qmljs_uminus); break;
+ case V4IR::OpUPlus: setOp(op, opName, __qmljs_uplus); break;
+ case V4IR::OpCompl: setOp(op, opName, __qmljs_compl); break;
+ case V4IR::OpIncrement: setOp(op, opName, __qmljs_increment); break;
+ case V4IR::OpDecrement: setOp(op, opName, __qmljs_decrement); break;
default: assert(!"unreachable"); break;
} // switch
@@ -906,27 +906,27 @@ void InstructionSelection::unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *
Assembler::Reference(sourceTemp));
}
-void InstructionSelection::binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target)
+void InstructionSelection::binop(V4IR::AluOp oper, V4IR::Temp *leftSource, V4IR::Temp *rightSource, V4IR::Temp *target)
{
_as->generateBinOp(oper, target, leftSource, rightSource);
}
-void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName)
+void InstructionSelection::inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSource, const QString &targetName)
{
VM::InplaceBinOpName op = 0;
const char *opName = 0;
switch (oper) {
- case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_name); break;
- case IR::OpBitOr: setOp(op, opName, __qmljs_inplace_bit_or_name); break;
- case IR::OpBitXor: setOp(op, opName, __qmljs_inplace_bit_xor_name); break;
- case IR::OpAdd: setOp(op, opName, __qmljs_inplace_add_name); break;
- case IR::OpSub: setOp(op, opName, __qmljs_inplace_sub_name); break;
- case IR::OpMul: setOp(op, opName, __qmljs_inplace_mul_name); break;
- case IR::OpDiv: setOp(op, opName, __qmljs_inplace_div_name); break;
- case IR::OpMod: setOp(op, opName, __qmljs_inplace_mod_name); break;
- case IR::OpLShift: setOp(op, opName, __qmljs_inplace_shl_name); break;
- case IR::OpRShift: setOp(op, opName, __qmljs_inplace_shr_name); break;
- case IR::OpURShift: setOp(op, opName, __qmljs_inplace_ushr_name); break;
+ case V4IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_name); break;
+ case V4IR::OpBitOr: setOp(op, opName, __qmljs_inplace_bit_or_name); break;
+ case V4IR::OpBitXor: setOp(op, opName, __qmljs_inplace_bit_xor_name); break;
+ case V4IR::OpAdd: setOp(op, opName, __qmljs_inplace_add_name); break;
+ case V4IR::OpSub: setOp(op, opName, __qmljs_inplace_sub_name); break;
+ case V4IR::OpMul: setOp(op, opName, __qmljs_inplace_mul_name); break;
+ case V4IR::OpDiv: setOp(op, opName, __qmljs_inplace_div_name); break;
+ case V4IR::OpMod: setOp(op, opName, __qmljs_inplace_mod_name); break;
+ case V4IR::OpLShift: setOp(op, opName, __qmljs_inplace_shl_name); break;
+ case V4IR::OpRShift: setOp(op, opName, __qmljs_inplace_shr_name); break;
+ case V4IR::OpURShift: setOp(op, opName, __qmljs_inplace_ushr_name); break;
default:
Q_UNREACHABLE();
break;
@@ -937,22 +937,22 @@ void InstructionSelection::inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource,
}
}
-void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp)
+void InstructionSelection::inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBaseTemp, V4IR::Temp *targetIndexTemp)
{
VM::InplaceBinOpElement op = 0;
const char *opName = 0;
switch (oper) {
- case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_element); break;
- case IR::OpBitOr: setOp(op, opName, __qmljs_inplace_bit_or_element); break;
- case IR::OpBitXor: setOp(op, opName, __qmljs_inplace_bit_xor_element); break;
- case IR::OpAdd: setOp(op, opName, __qmljs_inplace_add_element); break;
- case IR::OpSub: setOp(op, opName, __qmljs_inplace_sub_element); break;
- case IR::OpMul: setOp(op, opName, __qmljs_inplace_mul_element); break;
- case IR::OpDiv: setOp(op, opName, __qmljs_inplace_div_element); break;
- case IR::OpMod: setOp(op, opName, __qmljs_inplace_mod_element); break;
- case IR::OpLShift: setOp(op, opName, __qmljs_inplace_shl_element); break;
- case IR::OpRShift: setOp(op, opName, __qmljs_inplace_shr_element); break;
- case IR::OpURShift: setOp(op, opName, __qmljs_inplace_ushr_element); break;
+ case V4IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_element); break;
+ case V4IR::OpBitOr: setOp(op, opName, __qmljs_inplace_bit_or_element); break;
+ case V4IR::OpBitXor: setOp(op, opName, __qmljs_inplace_bit_xor_element); break;
+ case V4IR::OpAdd: setOp(op, opName, __qmljs_inplace_add_element); break;
+ case V4IR::OpSub: setOp(op, opName, __qmljs_inplace_sub_element); break;
+ case V4IR::OpMul: setOp(op, opName, __qmljs_inplace_mul_element); break;
+ case V4IR::OpDiv: setOp(op, opName, __qmljs_inplace_div_element); break;
+ case V4IR::OpMod: setOp(op, opName, __qmljs_inplace_mod_element); break;
+ case V4IR::OpLShift: setOp(op, opName, __qmljs_inplace_shl_element); break;
+ case V4IR::OpRShift: setOp(op, opName, __qmljs_inplace_shr_element); break;
+ case V4IR::OpURShift: setOp(op, opName, __qmljs_inplace_ushr_element); break;
default:
Q_UNREACHABLE();
break;
@@ -965,22 +965,22 @@ void InstructionSelection::inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR
}
}
-void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName)
+void InstructionSelection::inplaceMemberOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName)
{
VM::InplaceBinOpMember op = 0;
const char *opName = 0;
switch (oper) {
- case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_member); break;
- case IR::OpBitOr: setOp(op, opName, __qmljs_inplace_bit_or_member); break;
- case IR::OpBitXor: setOp(op, opName, __qmljs_inplace_bit_xor_member); break;
- case IR::OpAdd: setOp(op, opName, __qmljs_inplace_add_member); break;
- case IR::OpSub: setOp(op, opName, __qmljs_inplace_sub_member); break;
- case IR::OpMul: setOp(op, opName, __qmljs_inplace_mul_member); break;
- case IR::OpDiv: setOp(op, opName, __qmljs_inplace_div_member); break;
- case IR::OpMod: setOp(op, opName, __qmljs_inplace_mod_member); break;
- case IR::OpLShift: setOp(op, opName, __qmljs_inplace_shl_member); break;
- case IR::OpRShift: setOp(op, opName, __qmljs_inplace_shr_member); break;
- case IR::OpURShift: setOp(op, opName, __qmljs_inplace_ushr_member); break;
+ case V4IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_member); break;
+ case V4IR::OpBitOr: setOp(op, opName, __qmljs_inplace_bit_or_member); break;
+ case V4IR::OpBitXor: setOp(op, opName, __qmljs_inplace_bit_xor_member); break;
+ case V4IR::OpAdd: setOp(op, opName, __qmljs_inplace_add_member); break;
+ case V4IR::OpSub: setOp(op, opName, __qmljs_inplace_sub_member); break;
+ case V4IR::OpMul: setOp(op, opName, __qmljs_inplace_mul_member); break;
+ case V4IR::OpDiv: setOp(op, opName, __qmljs_inplace_div_member); break;
+ case V4IR::OpMod: setOp(op, opName, __qmljs_inplace_mod_member); break;
+ case V4IR::OpLShift: setOp(op, opName, __qmljs_inplace_shl_member); break;
+ case V4IR::OpRShift: setOp(op, opName, __qmljs_inplace_shr_member); break;
+ case V4IR::OpURShift: setOp(op, opName, __qmljs_inplace_ushr_member); break;
default:
Q_UNREACHABLE();
break;
@@ -994,8 +994,8 @@ void InstructionSelection::inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR:
}
}
-void InstructionSelection::callProperty(IR::Temp *base, const QString &name,
- IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::callProperty(V4IR::Temp *base, const QString &name,
+ V4IR::ExprList *args, V4IR::Temp *result)
{
assert(base != 0);
@@ -1018,7 +1018,7 @@ void InstructionSelection::callProperty(IR::Temp *base, const QString &name,
}
}
-void InstructionSelection::callSubscript(IR::Temp *base, IR::Temp *index, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::callSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::ExprList *args, V4IR::Temp *result)
{
assert(base != 0);
@@ -1037,21 +1037,21 @@ String *InstructionSelection::identifier(const QString &s)
return str;
}
-void InstructionSelection::constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
assert(func != 0);
callRuntimeMethod(result, __qmljs_construct_activation_property, func, args);
}
-void InstructionSelection::constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result)
{
int argc = prepareVariableArguments(args);
generateFunctionCall(Assembler::Void, __qmljs_construct_property, Assembler::ContextRegister,
Assembler::PointerToValue(result), Assembler::Reference(base), identifier(name), baseAddressForCallArguments(), Assembler::TrustedImm32(argc));
}
-void InstructionSelection::constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
+void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result)
{
assert(value != 0);
@@ -1060,14 +1060,14 @@ void InstructionSelection::constructValue(IR::Temp *value, IR::ExprList *args, I
Assembler::PointerToValue(result), Assembler::Reference(value), baseAddressForCallArguments(), Assembler::TrustedImm32(argc));
}
-void InstructionSelection::visitJump(IR::Jump *s)
+void InstructionSelection::visitJump(V4IR::Jump *s)
{
_as->jumpToBlock(_block, s->target);
}
-void InstructionSelection::visitCJump(IR::CJump *s)
+void InstructionSelection::visitCJump(V4IR::CJump *s)
{
- if (IR::Temp *t = s->cond->asTemp()) {
+ if (V4IR::Temp *t = s->cond->asTemp()) {
Address temp = _as->loadTempAddress(Assembler::ScratchRegister, t);
Address tag = temp;
tag.offset += offsetof(VM::Value, tag);
@@ -1089,22 +1089,22 @@ void InstructionSelection::visitCJump(IR::CJump *s)
_as->jumpToBlock(_block, s->iffalse);
return;
- } else if (IR::Binop *b = s->cond->asBinop()) {
+ } else if (V4IR::Binop *b = s->cond->asBinop()) {
if (b->left->asTemp() && b->right->asTemp()) {
VM::CmpOp op = 0;
const char *opName = 0;
switch (b->op) {
default: Q_UNREACHABLE(); assert(!"todo"); break;
- case IR::OpGt: setOp(op, opName, __qmljs_cmp_gt); break;
- case IR::OpLt: setOp(op, opName, __qmljs_cmp_lt); break;
- case IR::OpGe: setOp(op, opName, __qmljs_cmp_ge); break;
- case IR::OpLe: setOp(op, opName, __qmljs_cmp_le); break;
- case IR::OpEqual: setOp(op, opName, __qmljs_cmp_eq); break;
- case IR::OpNotEqual: setOp(op, opName, __qmljs_cmp_ne); break;
- case IR::OpStrictEqual: setOp(op, opName, __qmljs_cmp_se); break;
- case IR::OpStrictNotEqual: setOp(op, opName, __qmljs_cmp_sne); break;
- case IR::OpInstanceof: setOp(op, opName, __qmljs_cmp_instanceof); break;
- case IR::OpIn: setOp(op, opName, __qmljs_cmp_in); break;
+ case V4IR::OpGt: setOp(op, opName, __qmljs_cmp_gt); break;
+ case V4IR::OpLt: setOp(op, opName, __qmljs_cmp_lt); break;
+ case V4IR::OpGe: setOp(op, opName, __qmljs_cmp_ge); break;
+ case V4IR::OpLe: setOp(op, opName, __qmljs_cmp_le); break;
+ case V4IR::OpEqual: setOp(op, opName, __qmljs_cmp_eq); break;
+ case V4IR::OpNotEqual: setOp(op, opName, __qmljs_cmp_ne); break;
+ case V4IR::OpStrictEqual: setOp(op, opName, __qmljs_cmp_se); break;
+ case V4IR::OpStrictNotEqual: setOp(op, opName, __qmljs_cmp_sne); break;
+ case V4IR::OpInstanceof: setOp(op, opName, __qmljs_cmp_instanceof); break;
+ case V4IR::OpIn: setOp(op, opName, __qmljs_cmp_in); break;
} // switch
_as->generateFunctionCallImp(Assembler::ReturnValueRegister, opName, op, Assembler::ContextRegister,
@@ -1125,9 +1125,9 @@ void InstructionSelection::visitCJump(IR::CJump *s)
assert(!"TODO");
}
-void InstructionSelection::visitRet(IR::Ret *s)
+void InstructionSelection::visitRet(V4IR::Ret *s)
{
- if (IR::Temp *t = s->expr->asTemp()) {
+ if (V4IR::Temp *t = s->expr->asTemp()) {
#if defined(ARGUMENTS_IN_REGISTERS) && defined(VALUE_FITS_IN_REGISTER)
_as->copyValue(Assembler::ReturnValueRegister, t);
#else
@@ -1140,16 +1140,16 @@ void InstructionSelection::visitRet(IR::Ret *s)
Q_UNUSED(s);
}
-int InstructionSelection::prepareVariableArguments(IR::ExprList* args)
+int InstructionSelection::prepareVariableArguments(V4IR::ExprList* args)
{
int argc = 0;
- for (IR::ExprList *it = args; it; it = it->next) {
+ for (V4IR::ExprList *it = args; it; it = it->next) {
++argc;
}
int i = 0;
- for (IR::ExprList *it = args; it; it = it->next, ++i) {
-// IR::Temp *arg = it->expr->asTemp();
+ for (V4IR::ExprList *it = args; it; it = it->next, ++i) {
+// V4IR::Temp *arg = it->expr->asTemp();
// assert(arg != 0);
_as->copyValue(argumentAddressForCall(i), it->expr);
}
@@ -1157,9 +1157,9 @@ int InstructionSelection::prepareVariableArguments(IR::ExprList* args)
return argc;
}
-void InstructionSelection::callRuntimeMethodImp(IR::Temp *result, const char* name, ActivationMethod method, IR::Expr *base, IR::ExprList *args)
+void InstructionSelection::callRuntimeMethodImp(V4IR::Temp *result, const char* name, ActivationMethod method, V4IR::Expr *base, V4IR::ExprList *args)
{
- IR::Name *baseName = base->asName();
+ V4IR::Name *baseName = base->asName();
assert(baseName != 0);
int argc = prepareVariableArguments(args);
diff --git a/src/v4/qv4isel_masm_p.h b/src/v4/qv4isel_masm_p.h
index 55825da75d..371e1c12f0 100644
--- a/src/v4/qv4isel_masm_p.h
+++ b/src/v4/qv4isel_masm_p.h
@@ -59,7 +59,7 @@ namespace MASM {
class Assembler : public JSC::MacroAssembler
{
public:
- Assembler(IR::Function* function, VM::Function *vmFunction);
+ Assembler(V4IR::Function* function, VM::Function *vmFunction);
#if CPU(X86)
#undef VALUE_FITS_IN_REGISTER
@@ -197,17 +197,17 @@ public:
const char* functionName;
};
struct PointerToValue {
- PointerToValue(IR::Temp *value) : value(value) {}
- IR::Temp *value;
+ PointerToValue(V4IR::Temp *value) : value(value) {}
+ V4IR::Temp *value;
};
struct Reference {
- Reference(IR::Temp *value) : value(value) {}
- IR::Temp *value;
+ Reference(V4IR::Temp *value) : value(value) {}
+ V4IR::Temp *value;
};
struct ReentryBlock {
- ReentryBlock(IR::BasicBlock *b) : block(b) {}
- IR::BasicBlock *block;
+ ReentryBlock(V4IR::BasicBlock *b) : block(b) {}
+ V4IR::BasicBlock *block;
};
void callAbsolute(const char* functionName, FunctionPtr function) {
@@ -218,13 +218,13 @@ public:
_callsToLink.append(ctl);
}
- void registerBlock(IR::BasicBlock*);
- void jumpToBlock(IR::BasicBlock* current, IR::BasicBlock *target);
- void addPatch(IR::BasicBlock* targetBlock, Jump targetJump);
+ void registerBlock(V4IR::BasicBlock*);
+ void jumpToBlock(V4IR::BasicBlock* current, V4IR::BasicBlock *target);
+ void addPatch(V4IR::BasicBlock* targetBlock, Jump targetJump);
void addPatch(DataLabelPtr patch, Label target);
- void addPatch(DataLabelPtr patch, IR::BasicBlock *target);
+ void addPatch(DataLabelPtr patch, V4IR::BasicBlock *target);
- Pointer loadTempAddress(RegisterID reg, IR::Temp *t);
+ Pointer loadTempAddress(RegisterID reg, V4IR::Temp *t);
void loadArgument(RegisterID source, RegisterID dest)
{
@@ -266,7 +266,7 @@ public:
}
#ifdef VALUE_FITS_IN_REGISTER
- void loadArgument(IR::Temp* temp, RegisterID dest)
+ void loadArgument(V4IR::Temp* temp, RegisterID dest)
{
if (!temp) {
VM::Value undefined = VM::Value::undefinedValue();
@@ -277,13 +277,13 @@ public:
}
}
- void loadArgument(IR::Const* c, RegisterID dest)
+ void loadArgument(V4IR::Const* c, RegisterID dest)
{
VM::Value v = convertToValue(c);
move(TrustedImm64(v.val), dest);
}
- void loadArgument(IR::Expr* expr, RegisterID dest)
+ void loadArgument(V4IR::Expr* expr, RegisterID dest)
{
if (!expr) {
VM::Value undefined = VM::Value::undefinedValue();
@@ -297,7 +297,7 @@ public:
}
}
#else
- void loadArgument(IR::Expr*, RegisterID)
+ void loadArgument(V4IR::Expr*, RegisterID)
{
assert(!"unimplemented: expression in loadArgument");
}
@@ -315,7 +315,7 @@ public:
move(imm32, dest);
}
- void storeArgument(RegisterID src, IR::Temp *temp)
+ void storeArgument(RegisterID src, V4IR::Temp *temp)
{
if (temp) {
Pointer addr = loadTempAddress(ScratchRegister, temp);
@@ -393,7 +393,7 @@ public:
addPatch(patch, block.block);
}
- void push(IR::Temp* temp)
+ void push(V4IR::Temp* temp)
{
if (temp) {
Address addr = loadTempAddress(ScratchRegister, temp);
@@ -407,20 +407,20 @@ public:
}
}
- void push(IR::Const* c)
+ void push(V4IR::Const* c)
{
VM::Value v = convertToValue(c);
push(v);
}
- void push(IR::Expr* e)
+ void push(V4IR::Expr* e)
{
if (!e) {
VM::Value undefined = VM::Value::undefinedValue();
push(undefined);
- } else if (IR::Const *c = e->asConst())
+ } else if (V4IR::Const *c = e->asConst())
push(c);
- else if (IR::Temp *t = e->asTemp()) {
+ else if (V4IR::Temp *t = e->asTemp()) {
push(t);
} else {
assert(!"Trying to push an expression that is not a Temp or Const");
@@ -439,14 +439,14 @@ public:
}
using JSC::MacroAssembler::loadDouble;
- void loadDouble(IR::Temp* temp, FPRegisterID dest)
+ void loadDouble(V4IR::Temp* temp, FPRegisterID dest)
{
Pointer ptr = loadTempAddress(ScratchRegister, temp);
loadDouble(ptr, dest);
}
using JSC::MacroAssembler::storeDouble;
- void storeDouble(FPRegisterID source, IR::Temp* temp)
+ void storeDouble(FPRegisterID source, V4IR::Temp* temp)
{
Pointer ptr = loadTempAddress(ScratchRegister, temp);
storeDouble(source, ptr);
@@ -455,7 +455,7 @@ public:
template <typename Result, typename Source>
void copyValue(Result result, Source source);
template <typename Result>
- void copyValue(Result result, IR::Expr* source);
+ void copyValue(Result result, V4IR::Expr* source);
void storeValue(VM::Value value, Address destination)
{
@@ -468,7 +468,7 @@ public:
#endif
}
- void storeValue(VM::Value value, IR::Temp* temp);
+ void storeValue(VM::Value value, V4IR::Temp* temp);
void enterStandardStackFrame(int locals);
void leaveStandardStackFrame(int locals);
@@ -477,9 +477,9 @@ public:
{ return 0; }
static inline int sizeOfArgument(RegisterID)
{ return RegisterSize; }
- static inline int sizeOfArgument(IR::Temp*)
+ static inline int sizeOfArgument(V4IR::Temp*)
{ return 8; } // Size of value
- static inline int sizeOfArgument(IR::Expr*)
+ static inline int sizeOfArgument(V4IR::Expr*)
{ return 8; } // Size of value
static inline int sizeOfArgument(const Pointer&)
{ return sizeof(void*); }
@@ -595,9 +595,9 @@ public:
ImmRegBinOp inlineImmRegOp;
};
- static const BinaryOperationInfo binaryOperations[QQmlJS::IR::LastAluOp + 1];
+ static const BinaryOperationInfo binaryOperations[QQmlJS::V4IR::LastAluOp + 1];
- void generateBinOp(IR::AluOp operation, IR::Temp* target, IR::Temp* left, IR::Temp* right);
+ void generateBinOp(V4IR::AluOp operation, V4IR::Temp* target, V4IR::Temp* left, V4IR::Temp* right);
Jump inline_add32(Address addr, RegisterID reg)
{
@@ -743,10 +743,10 @@ public:
void link(VM::Function *vmFunc);
private:
- IR::Function *_function;
+ V4IR::Function *_function;
VM::Function *_vmFunction;
- QHash<IR::BasicBlock *, Label> _addrs;
- QHash<IR::BasicBlock *, QVector<Jump> > _patches;
+ QHash<V4IR::BasicBlock *, Label> _addrs;
+ QHash<V4IR::BasicBlock *, QVector<Jump> > _patches;
QList<CallToLink> _callsToLink;
struct DataLabelPatch {
@@ -755,67 +755,67 @@ private:
};
QList<DataLabelPatch> _dataLabelPatches;
- QHash<IR::BasicBlock *, QVector<DataLabelPtr> > _labelPatches;
+ QHash<V4IR::BasicBlock *, QVector<DataLabelPtr> > _labelPatches;
};
class Q_V4_EXPORT InstructionSelection:
- protected IR::InstructionSelection,
+ protected V4IR::InstructionSelection,
public EvalInstructionSelection
{
public:
- InstructionSelection(VM::ExecutionEngine *engine, IR::Module *module);
+ InstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module);
~InstructionSelection();
- virtual void run(VM::Function *vmFunction, IR::Function *function);
+ virtual void run(VM::Function *vmFunction, V4IR::Function *function);
protected:
- virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result);
- virtual void callBuiltinTypeofMember(IR::Temp *base, const QString &name, IR::Temp *result);
- virtual void callBuiltinTypeofSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result);
- virtual void callBuiltinTypeofName(const QString &name, IR::Temp *result);
- virtual void callBuiltinTypeofValue(IR::Temp *value, IR::Temp *result);
- virtual void callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result);
- virtual void callBuiltinDeleteSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result);
- virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result);
- virtual void callBuiltinDeleteValue(IR::Temp *result);
- virtual void callBuiltinPostDecrementMember(IR::Temp *base, const QString &name, IR::Temp *result);
- virtual void callBuiltinPostDecrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result);
- virtual void callBuiltinPostDecrementName(const QString &name, IR::Temp *result);
- virtual void callBuiltinPostDecrementValue(IR::Temp *value, IR::Temp *result);
- virtual void callBuiltinPostIncrementMember(IR::Temp *base, const QString &name, IR::Temp *result);
- virtual void callBuiltinPostIncrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result);
- virtual void callBuiltinPostIncrementName(const QString &name, IR::Temp *result);
- virtual void callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result);
- virtual void callBuiltinThrow(IR::Temp *arg);
+ virtual void callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void callBuiltinTypeofMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinTypeofSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result);
+ virtual void callBuiltinTypeofName(const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinTypeofValue(V4IR::Temp *value, V4IR::Temp *result);
+ virtual void callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result);
+ virtual void callBuiltinDeleteName(const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinDeleteValue(V4IR::Temp *result);
+ virtual void callBuiltinPostDecrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinPostDecrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result);
+ virtual void callBuiltinPostDecrementName(const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinPostDecrementValue(V4IR::Temp *value, V4IR::Temp *result);
+ virtual void callBuiltinPostIncrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinPostIncrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result);
+ virtual void callBuiltinPostIncrementName(const QString &name, V4IR::Temp *result);
+ virtual void callBuiltinPostIncrementValue(V4IR::Temp *value, V4IR::Temp *result);
+ virtual void callBuiltinThrow(V4IR::Temp *arg);
virtual void callBuiltinFinishTry();
- virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result);
- virtual void callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result);
- virtual void callBuiltinPushWithScope(IR::Temp *arg);
+ virtual void callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result);
+ virtual void callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result);
+ virtual void callBuiltinPushWithScope(V4IR::Temp *arg);
virtual void callBuiltinPopScope();
virtual void callBuiltinDeclareVar(bool deletable, const QString &name);
- virtual void callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter);
- virtual void callBuiltinDefineProperty(IR::Temp *object, const QString &name, IR::Temp *value);
- virtual void callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args);
- virtual void callProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result);
- virtual void callSubscript(IR::Temp *base, IR::Temp *index, IR::ExprList *args, IR::Temp *result);
- virtual void callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result);
- virtual void loadThisObject(IR::Temp *temp);
- virtual void loadConst(IR::Const *sourceConst, IR::Temp *targetTemp);
- virtual void loadString(const QString &str, IR::Temp *targetTemp);
- virtual void loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp);
- virtual void getActivationProperty(const QString &name, IR::Temp *temp);
- virtual void setActivationProperty(IR::Temp *source, const QString &targetName);
- virtual void initClosure(IR::Closure *closure, IR::Temp *target);
- virtual void getProperty(IR::Temp *base, const QString &name, IR::Temp *target);
- virtual void setProperty(IR::Temp *source, IR::Temp *targetBase, const QString &targetName);
- virtual void getElement(IR::Temp *base, IR::Temp *index, IR::Temp *target);
- virtual void setElement(IR::Temp *source, IR::Temp *targetBase, IR::Temp *targetIndex);
- virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp);
- virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp);
- virtual void binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target);
- virtual void inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName);
- virtual void inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp);
- virtual void inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName);
+ virtual void callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter);
+ virtual void callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, V4IR::Temp *value);
+ virtual void callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args);
+ virtual void callProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void callSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void loadThisObject(V4IR::Temp *temp);
+ virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp);
+ virtual void loadString(const QString &str, V4IR::Temp *targetTemp);
+ virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp);
+ virtual void getActivationProperty(const QString &name, V4IR::Temp *temp);
+ virtual void setActivationProperty(V4IR::Temp *source, const QString &targetName);
+ virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target);
+ virtual void getProperty(V4IR::Temp *base, const QString &name, V4IR::Temp *target);
+ virtual void setProperty(V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName);
+ virtual void getElement(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *target);
+ virtual void setElement(V4IR::Temp *source, V4IR::Temp *targetBase, V4IR::Temp *targetIndex);
+ virtual void copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
+ virtual void unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
+ virtual void binop(V4IR::AluOp oper, V4IR::Temp *leftSource, V4IR::Temp *rightSource, V4IR::Temp *target);
+ virtual void inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSource, const QString &targetName);
+ virtual void inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBaseTemp, V4IR::Temp *targetIndexTemp);
+ virtual void inplaceMemberOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName);
typedef Assembler::Address Address;
typedef Assembler::Pointer Pointer;
@@ -844,14 +844,14 @@ protected:
}
VM::String *identifier(const QString &s);
- virtual void constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result);
- virtual void constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result);
- virtual void constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result);
+ virtual void constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
+ virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
- virtual void visitJump(IR::Jump *);
- virtual void visitCJump(IR::CJump *);
- virtual void visitRet(IR::Ret *);
- virtual void visitTry(IR::Try *);
+ virtual void visitJump(V4IR::Jump *);
+ virtual void visitCJump(V4IR::CJump *);
+ virtual void visitRet(V4IR::Ret *);
+ virtual void visitTry(V4IR::Try *);
private:
#define isel_stringIfyx(s) #s
@@ -860,28 +860,28 @@ private:
#define generateFunctionCall(t, function, ...) \
_as->generateFunctionCallImp(t, isel_stringIfy(function), function, __VA_ARGS__)
- int prepareVariableArguments(IR::ExprList* args);
+ int prepareVariableArguments(V4IR::ExprList* args);
typedef void (*ActivationMethod)(VM::ExecutionContext *, VM::Value *result, VM::String *name, VM::Value *args, int argc);
- void callRuntimeMethodImp(IR::Temp *result, const char* name, ActivationMethod method, IR::Expr *base, IR::ExprList *args);
+ void callRuntimeMethodImp(V4IR::Temp *result, const char* name, ActivationMethod method, V4IR::Expr *base, V4IR::ExprList *args);
#define callRuntimeMethod(result, function, ...) \
callRuntimeMethodImp(result, isel_stringIfy(function), function, __VA_ARGS__)
uint addLookup(VM::String *name);
- IR::BasicBlock *_block;
- IR::Function* _function;
+ V4IR::BasicBlock *_block;
+ V4IR::Function* _function;
VM::Function* _vmFunction;
QVector<VM::Lookup> _lookups;
Assembler* _as;
- QSet<IR::BasicBlock*> _reentryBlocks;
+ QSet<V4IR::BasicBlock*> _reentryBlocks;
};
class Q_V4_EXPORT ISelFactory: public EvalISelFactory
{
public:
virtual ~ISelFactory() {}
- virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, IR::Module *module)
+ virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, V4IR::Module *module)
{ return new InstructionSelection(engine, module); }
};
diff --git a/src/v4/qv4isel_p.cpp b/src/v4/qv4isel_p.cpp
index 30204a5b6a..d355e16104 100644
--- a/src/v4/qv4isel_p.cpp
+++ b/src/v4/qv4isel_p.cpp
@@ -14,7 +14,7 @@ QTextStream qout(stderr, QIODevice::WriteOnly);
} // anonymous namespace
using namespace QQmlJS;
-using namespace QQmlJS::IR;
+using namespace QQmlJS::V4IR;
EvalInstructionSelection::EvalInstructionSelection(VM::ExecutionEngine *engine, Module *module)
: _engine(engine)
@@ -24,7 +24,7 @@ EvalInstructionSelection::EvalInstructionSelection(VM::ExecutionEngine *engine,
assert(module);
createFunctionMapping(0, module->rootFunction);
- foreach (IR::Function *f, module->functions) {
+ foreach (V4IR::Function *f, module->functions) {
assert(_irToVM.contains(f));
}
}
@@ -57,7 +57,7 @@ VM::Function *EvalInstructionSelection::createFunctionMapping(VM::Function *oute
if (local)
vmFunction->locals.append(_engine->newString(*local));
- foreach (IR::Function *function, irFunction->nestedFunctions)
+ foreach (V4IR::Function *function, irFunction->nestedFunctions)
createFunctionMapping(vmFunction, function);
if (_engine->debugger)
@@ -73,66 +73,66 @@ VM::Function *EvalInstructionSelection::vmFunction(Function *f) {
return function;
}
-void InstructionSelection::visitMove(IR::Move *s)
+void InstructionSelection::visitMove(V4IR::Move *s)
{
- if (s->op == IR::OpInvalid) {
- if (IR::Name *n = s->target->asName()) {
+ if (s->op == V4IR::OpInvalid) {
+ if (V4IR::Name *n = s->target->asName()) {
if (s->source->asTemp()) {
setActivationProperty(s->source->asTemp(), *n->id);
return;
}
- } else if (IR::Temp *t = s->target->asTemp()) {
- if (IR::Name *n = s->source->asName()) {
+ } else if (V4IR::Temp *t = s->target->asTemp()) {
+ if (V4IR::Name *n = s->source->asName()) {
if (*n->id == QStringLiteral("this")) // TODO: `this' should be a builtin.
loadThisObject(t);
else
getActivationProperty(*n->id, t);
return;
- } else if (IR::Const *c = s->source->asConst()) {
+ } else if (V4IR::Const *c = s->source->asConst()) {
loadConst(c, t);
return;
- } else if (IR::Temp *t2 = s->source->asTemp()) {
+ } else if (V4IR::Temp *t2 = s->source->asTemp()) {
copyValue(t2, t);
return;
- } else if (IR::String *str = s->source->asString()) {
+ } else if (V4IR::String *str = s->source->asString()) {
loadString(*str->value, t);
return;
- } else if (IR::RegExp *re = s->source->asRegExp()) {
+ } else if (V4IR::RegExp *re = s->source->asRegExp()) {
loadRegexp(re, t);
return;
- } else if (IR::Closure *clos = s->source->asClosure()) {
+ } else if (V4IR::Closure *clos = s->source->asClosure()) {
initClosure(clos, t);
return;
- } else if (IR::New *ctor = s->source->asNew()) {
+ } else if (V4IR::New *ctor = s->source->asNew()) {
if (Name *func = ctor->base->asName()) {
constructActivationProperty(func, ctor->args, t);
return;
- } else if (IR::Member *member = ctor->base->asMember()) {
+ } else if (V4IR::Member *member = ctor->base->asMember()) {
constructProperty(member->base->asTemp(), *member->name, ctor->args, t);
return;
- } else if (IR::Temp *value = ctor->base->asTemp()) {
+ } else if (V4IR::Temp *value = ctor->base->asTemp()) {
constructValue(value, ctor->args, t);
return;
}
- } else if (IR::Member *m = s->source->asMember()) {
- if (IR::Temp *base = m->base->asTemp()) {
+ } else if (V4IR::Member *m = s->source->asMember()) {
+ if (V4IR::Temp *base = m->base->asTemp()) {
getProperty(base, *m->name, t);
return;
}
- } else if (IR::Subscript *ss = s->source->asSubscript()) {
+ } else if (V4IR::Subscript *ss = s->source->asSubscript()) {
getElement(ss->base->asTemp(), ss->index->asTemp(), t);
return;
- } else if (IR::Unop *u = s->source->asUnop()) {
- if (IR::Temp *e = u->expr->asTemp()) {
+ } else if (V4IR::Unop *u = s->source->asUnop()) {
+ if (V4IR::Temp *e = u->expr->asTemp()) {
unop(u->op, e, t);
return;
}
- } else if (IR::Binop *b = s->source->asBinop()) {
+ } else if (V4IR::Binop *b = s->source->asBinop()) {
if (b->left->asTemp() && b->right->asTemp()) {
binop(b->op, b->left->asTemp(), b->right->asTemp(), t);
return;
}
- } else if (IR::Call *c = s->source->asCall()) {
+ } else if (V4IR::Call *c = s->source->asCall()) {
if (c->base->asName()) {
callBuiltin(c, t);
return;
@@ -142,19 +142,19 @@ void InstructionSelection::visitMove(IR::Move *s)
} else if (Subscript *s = c->base->asSubscript()) {
callSubscript(s->base, s->index, c->args, t);
return;
- } else if (IR::Temp *value = c->base->asTemp()) {
+ } else if (V4IR::Temp *value = c->base->asTemp()) {
callValue(value, c->args, t);
return;
}
}
- } else if (IR::Member *m = s->target->asMember()) {
- if (IR::Temp *base = m->base->asTemp()) {
+ } else if (V4IR::Member *m = s->target->asMember()) {
+ if (V4IR::Temp *base = m->base->asTemp()) {
if (s->source->asTemp()) {
setProperty(s->source->asTemp(), base, *m->name);
return;
}
}
- } else if (IR::Subscript *ss = s->target->asSubscript()) {
+ } else if (V4IR::Subscript *ss = s->target->asSubscript()) {
if (s->source->asTemp()) {
setElement(s->source->asTemp(), ss->base->asTemp(), ss->index->asTemp());
return;
@@ -162,23 +162,23 @@ void InstructionSelection::visitMove(IR::Move *s)
}
} else {
// inplace assignment, e.g. x += 1, ++x, ...
- if (IR::Temp *t = s->target->asTemp()) {
+ if (V4IR::Temp *t = s->target->asTemp()) {
if (s->source->asTemp()) {
binop(s->op, t, s->source->asTemp(), t);
return;
}
- } else if (IR::Name *n = s->target->asName()) {
+ } else if (V4IR::Name *n = s->target->asName()) {
if (s->source->asTemp()) {
inplaceNameOp(s->op, s->source->asTemp(), *n->id);
return;
}
- } else if (IR::Subscript *ss = s->target->asSubscript()) {
+ } else if (V4IR::Subscript *ss = s->target->asSubscript()) {
if (s->source->asTemp()) {
inplaceElementOp(s->op, s->source->asTemp(), ss->base->asTemp(),
ss->index->asTemp());
return;
}
- } else if (IR::Member *m = s->target->asMember()) {
+ } else if (V4IR::Member *m = s->target->asMember()) {
if (s->source->asTemp()) {
inplaceMemberOp(s->op, s->source->asTemp(), m->base->asTemp(), *m->name);
return;
@@ -188,7 +188,7 @@ void InstructionSelection::visitMove(IR::Move *s)
// For anything else...:
Q_UNIMPLEMENTED();
- s->dump(qout, IR::Stmt::MIR);
+ s->dump(qout, V4IR::Stmt::MIR);
qout << endl;
assert(!"TODO");
}
@@ -207,9 +207,9 @@ void InstructionSelection::visitLeave(Leave *)
Q_UNREACHABLE();
}
-void InstructionSelection::visitExp(IR::Exp *s)
+void InstructionSelection::visitExp(V4IR::Exp *s)
{
- if (IR::Call *c = s->expr->asCall()) {
+ if (V4IR::Call *c = s->expr->asCall()) {
// These are calls where the result is ignored.
if (c->base->asName()) {
callBuiltin(c, 0);
@@ -227,41 +227,41 @@ void InstructionSelection::visitExp(IR::Exp *s)
}
}
-void InstructionSelection::callBuiltin(IR::Call *call, IR::Temp *result)
+void InstructionSelection::callBuiltin(V4IR::Call *call, V4IR::Temp *result)
{
- IR::Name *baseName = call->base->asName();
+ V4IR::Name *baseName = call->base->asName();
assert(baseName != 0);
switch (baseName->builtin) {
- case IR::Name::builtin_invalid:
+ case V4IR::Name::builtin_invalid:
callBuiltinInvalid(baseName, call->args, result);
return;
- case IR::Name::builtin_typeof: {
- if (IR::Member *m = call->args->expr->asMember()) {
+ case V4IR::Name::builtin_typeof: {
+ if (V4IR::Member *m = call->args->expr->asMember()) {
callBuiltinTypeofMember(m->base->asTemp(), *m->name, result);
return;
- } else if (IR::Subscript *ss = call->args->expr->asSubscript()) {
+ } else if (V4IR::Subscript *ss = call->args->expr->asSubscript()) {
callBuiltinTypeofSubscript(ss->base->asTemp(), ss->index->asTemp(), result);
return;
- } else if (IR::Name *n = call->args->expr->asName()) {
+ } else if (V4IR::Name *n = call->args->expr->asName()) {
callBuiltinTypeofName(*n->id, result);
return;
- } else if (IR::Temp *arg = call->args->expr->asTemp()){
+ } else if (V4IR::Temp *arg = call->args->expr->asTemp()){
assert(arg != 0);
callBuiltinTypeofValue(arg, result);
return;
}
} break;
- case IR::Name::builtin_delete: {
- if (IR::Member *m = call->args->expr->asMember()) {
+ case V4IR::Name::builtin_delete: {
+ if (V4IR::Member *m = call->args->expr->asMember()) {
callBuiltinDeleteMember(m->base->asTemp(), *m->name, result);
return;
- } else if (IR::Subscript *ss = call->args->expr->asSubscript()) {
+ } else if (V4IR::Subscript *ss = call->args->expr->asSubscript()) {
callBuiltinDeleteSubscript(ss->base->asTemp(), ss->index->asTemp(), result);
return;
- } else if (IR::Name *n = call->args->expr->asName()) {
+ } else if (V4IR::Name *n = call->args->expr->asName()) {
callBuiltinDeleteName(*n->id, result);
return;
} else if (call->args->expr->asTemp()){
@@ -271,119 +271,119 @@ void InstructionSelection::callBuiltin(IR::Call *call, IR::Temp *result)
}
} break;
- case IR::Name::builtin_postincrement: {
- if (IR::Member *m = call->args->expr->asMember()) {
+ case V4IR::Name::builtin_postincrement: {
+ if (V4IR::Member *m = call->args->expr->asMember()) {
callBuiltinPostIncrementMember(m->base->asTemp(), *m->name, result);
return;
- } else if (IR::Subscript *ss = call->args->expr->asSubscript()) {
+ } else if (V4IR::Subscript *ss = call->args->expr->asSubscript()) {
callBuiltinPostIncrementSubscript(ss->base->asTemp(), ss->index->asTemp(), result);
return;
- } else if (IR::Name *n = call->args->expr->asName()) {
+ } else if (V4IR::Name *n = call->args->expr->asName()) {
callBuiltinPostIncrementName(*n->id, result);
return;
- } else if (IR::Temp *arg = call->args->expr->asTemp()){
+ } else if (V4IR::Temp *arg = call->args->expr->asTemp()){
assert(arg != 0);
callBuiltinPostIncrementValue(arg, result);
return;
}
} break;
- case IR::Name::builtin_postdecrement: {
- if (IR::Member *m = call->args->expr->asMember()) {
+ case V4IR::Name::builtin_postdecrement: {
+ if (V4IR::Member *m = call->args->expr->asMember()) {
callBuiltinPostDecrementMember(m->base->asTemp(), *m->name, result);
return;
- } else if (IR::Subscript *ss = call->args->expr->asSubscript()) {
+ } else if (V4IR::Subscript *ss = call->args->expr->asSubscript()) {
callBuiltinPostDecrementSubscript(ss->base->asTemp(), ss->index->asTemp(), result);
return;
- } else if (IR::Name *n = call->args->expr->asName()) {
+ } else if (V4IR::Name *n = call->args->expr->asName()) {
callBuiltinPostDecrementName(*n->id, result);
return;
- } else if (IR::Temp *arg = call->args->expr->asTemp()){
+ } else if (V4IR::Temp *arg = call->args->expr->asTemp()){
assert(arg != 0);
callBuiltinPostDecrementValue(arg, result);
return;
}
} break;
- case IR::Name::builtin_throw: {
- IR::Temp *arg = call->args->expr->asTemp();
+ case V4IR::Name::builtin_throw: {
+ V4IR::Temp *arg = call->args->expr->asTemp();
assert(arg != 0);
callBuiltinThrow(arg);
} return;
- case IR::Name::builtin_finish_try:
+ case V4IR::Name::builtin_finish_try:
callBuiltinFinishTry();
return;
- case IR::Name::builtin_foreach_iterator_object: {
- IR::Temp *arg = call->args->expr->asTemp();
+ case V4IR::Name::builtin_foreach_iterator_object: {
+ V4IR::Temp *arg = call->args->expr->asTemp();
assert(arg != 0);
callBuiltinForeachIteratorObject(arg, result);
} return;
- case IR::Name::builtin_foreach_next_property_name: {
- IR::Temp *arg = call->args->expr->asTemp();
+ case V4IR::Name::builtin_foreach_next_property_name: {
+ V4IR::Temp *arg = call->args->expr->asTemp();
assert(arg != 0);
callBuiltinForeachNextPropertyname(arg, result);
} return;
- case IR::Name::builtin_push_with_scope: {
- IR::Temp *arg = call->args->expr->asTemp();
+ case V4IR::Name::builtin_push_with_scope: {
+ V4IR::Temp *arg = call->args->expr->asTemp();
assert(arg != 0);
callBuiltinPushWithScope(arg);
} return;
- case IR::Name::builtin_pop_scope:
+ case V4IR::Name::builtin_pop_scope:
callBuiltinPopScope();
return;
- case IR::Name::builtin_declare_vars: {
+ case V4IR::Name::builtin_declare_vars: {
if (!call->args)
return;
- IR::Const *deletable = call->args->expr->asConst();
- assert(deletable->type == IR::BoolType);
- for (IR::ExprList *it = call->args->next; it; it = it->next) {
- IR::Name *arg = it->expr->asName();
+ V4IR::Const *deletable = call->args->expr->asConst();
+ assert(deletable->type == V4IR::BoolType);
+ for (V4IR::ExprList *it = call->args->next; it; it = it->next) {
+ V4IR::Name *arg = it->expr->asName();
assert(arg != 0);
callBuiltinDeclareVar(deletable->value != 0, *arg->id);
}
} return;
- case IR::Name::builtin_define_getter_setter: {
+ case V4IR::Name::builtin_define_getter_setter: {
if (!call->args)
return;
- IR::ExprList *args = call->args;
- IR::Temp *object = args->expr->asTemp();
+ V4IR::ExprList *args = call->args;
+ V4IR::Temp *object = args->expr->asTemp();
assert(object);
args = args->next;
assert(args);
- IR::Name *name = args->expr->asName();
+ V4IR::Name *name = args->expr->asName();
args = args->next;
assert(args);
- IR::Temp *getter = args->expr->asTemp();
+ V4IR::Temp *getter = args->expr->asTemp();
args = args->next;
assert(args);
- IR::Temp *setter = args->expr->asTemp();
+ V4IR::Temp *setter = args->expr->asTemp();
callBuiltinDefineGetterSetter(object, *name->id, getter, setter);
} return;
- case IR::Name::builtin_define_property: {
+ case V4IR::Name::builtin_define_property: {
if (!call->args)
return;
- IR::ExprList *args = call->args;
- IR::Temp *object = args->expr->asTemp();
+ V4IR::ExprList *args = call->args;
+ V4IR::Temp *object = args->expr->asTemp();
assert(object);
args = args->next;
assert(args);
- IR::Name *name = args->expr->asName();
+ V4IR::Name *name = args->expr->asName();
args = args->next;
assert(args);
- IR::Temp *value = args->expr->asTemp();
+ V4IR::Temp *value = args->expr->asTemp();
callBuiltinDefineProperty(object, *name->id, value);
} return;
- case IR::Name::builtin_define_array:
+ case V4IR::Name::builtin_define_array:
callBuiltinDefineArray(result, call->args);
return;
diff --git a/src/v4/qv4isel_p.h b/src/v4/qv4isel_p.h
index 4e7d588dfd..b1218adbc5 100644
--- a/src/v4/qv4isel_p.h
+++ b/src/v4/qv4isel_p.h
@@ -46,21 +46,21 @@ struct Function;
class Q_V4_EXPORT EvalInstructionSelection
{
public:
- EvalInstructionSelection(VM::ExecutionEngine *engine, IR::Module *module);
+ EvalInstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module);
virtual ~EvalInstructionSelection() = 0;
- VM::Function *vmFunction(IR::Function *f);
+ VM::Function *vmFunction(V4IR::Function *f);
void setUseFastLookups(bool b) { useFastLookups = b; }
protected:
- VM::Function *createFunctionMapping(VM::Function *outer, IR::Function *irFunction);
+ VM::Function *createFunctionMapping(VM::Function *outer, V4IR::Function *irFunction);
VM::ExecutionEngine *engine() const { return _engine; }
- virtual void run(VM::Function *vmFunction, IR::Function *function) = 0;
+ virtual void run(VM::Function *vmFunction, V4IR::Function *function) = 0;
private:
VM::ExecutionEngine *_engine;
- QHash<IR::Function *, VM::Function *> _irToVM;
+ QHash<V4IR::Function *, VM::Function *> _irToVM;
protected:
bool useFastLookups;
};
@@ -69,75 +69,75 @@ class Q_V4_EXPORT EvalISelFactory
{
public:
virtual ~EvalISelFactory() = 0;
- virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, IR::Module *module) = 0;
+ virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, V4IR::Module *module) = 0;
};
-namespace IR {
-class Q_V4_EXPORT InstructionSelection: protected IR::StmtVisitor
+namespace V4IR {
+class Q_V4_EXPORT InstructionSelection: protected V4IR::StmtVisitor
{
public:
virtual ~InstructionSelection() = 0;
public: // visitor methods for StmtVisitor:
- virtual void visitMove(IR::Move *s);
- virtual void visitEnter(IR::Enter *);
- virtual void visitLeave(IR::Leave *);
- virtual void visitExp(IR::Exp *s);
+ virtual void visitMove(V4IR::Move *s);
+ virtual void visitEnter(V4IR::Enter *);
+ virtual void visitLeave(V4IR::Leave *);
+ virtual void visitExp(V4IR::Exp *s);
public: // to implement by subclasses:
- virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result) = 0;
- virtual void callBuiltinTypeofMember(IR::Temp *base, const QString &name, IR::Temp *result) = 0;
- virtual void callBuiltinTypeofSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result) = 0;
- virtual void callBuiltinTypeofName(const QString &name, IR::Temp *result) = 0;
- virtual void callBuiltinTypeofValue(IR::Temp *value, IR::Temp *result) = 0;
- virtual void callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result) = 0;
- virtual void callBuiltinDeleteSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result) = 0;
- virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result) = 0;
- virtual void callBuiltinDeleteValue(IR::Temp *result) = 0;
- virtual void callBuiltinPostDecrementMember(IR::Temp *base, const QString &name, IR::Temp *result) = 0;
- virtual void callBuiltinPostDecrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result) = 0;
- virtual void callBuiltinPostDecrementName(const QString &name, IR::Temp *result) = 0;
- virtual void callBuiltinPostDecrementValue(IR::Temp *value, IR::Temp *result) = 0;
- virtual void callBuiltinPostIncrementMember(IR::Temp *base, const QString &name, IR::Temp *result) = 0;
- virtual void callBuiltinPostIncrementSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result) = 0;
- virtual void callBuiltinPostIncrementName(const QString &name, IR::Temp *result) = 0;
- virtual void callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result) = 0;
- virtual void callBuiltinThrow(IR::Temp *arg) = 0;
+ virtual void callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result) = 0;
+ virtual void callBuiltinTypeofMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result) = 0;
+ virtual void callBuiltinTypeofSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result) = 0;
+ virtual void callBuiltinTypeofName(const QString &name, V4IR::Temp *result) = 0;
+ virtual void callBuiltinTypeofValue(V4IR::Temp *value, V4IR::Temp *result) = 0;
+ virtual void callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result) = 0;
+ virtual void callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result) = 0;
+ virtual void callBuiltinDeleteName(const QString &name, V4IR::Temp *result) = 0;
+ virtual void callBuiltinDeleteValue(V4IR::Temp *result) = 0;
+ virtual void callBuiltinPostDecrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result) = 0;
+ virtual void callBuiltinPostDecrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result) = 0;
+ virtual void callBuiltinPostDecrementName(const QString &name, V4IR::Temp *result) = 0;
+ virtual void callBuiltinPostDecrementValue(V4IR::Temp *value, V4IR::Temp *result) = 0;
+ virtual void callBuiltinPostIncrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result) = 0;
+ virtual void callBuiltinPostIncrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result) = 0;
+ virtual void callBuiltinPostIncrementName(const QString &name, V4IR::Temp *result) = 0;
+ virtual void callBuiltinPostIncrementValue(V4IR::Temp *value, V4IR::Temp *result) = 0;
+ virtual void callBuiltinThrow(V4IR::Temp *arg) = 0;
virtual void callBuiltinFinishTry() = 0;
- virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result) = 0;
- virtual void callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result) = 0;
- virtual void callBuiltinPushWithScope(IR::Temp *arg) = 0;
+ virtual void callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result) = 0;
+ virtual void callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result) = 0;
+ virtual void callBuiltinPushWithScope(V4IR::Temp *arg) = 0;
virtual void callBuiltinPopScope() = 0;
virtual void callBuiltinDeclareVar(bool deletable, const QString &name) = 0;
- virtual void callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter) = 0;
- virtual void callBuiltinDefineProperty(IR::Temp *object, const QString &name, IR::Temp *value) = 0;
- virtual void callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args) = 0;
- virtual void callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result) = 0;
- virtual void callProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result) = 0;
- virtual void callSubscript(IR::Temp *base, IR::Temp *index, IR::ExprList *args, IR::Temp *result) = 0;
- virtual void constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result) = 0;
- virtual void constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result) = 0;
- virtual void constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result) = 0;
- virtual void loadThisObject(IR::Temp *temp) = 0;
- virtual void loadConst(IR::Const *sourceConst, IR::Temp *targetTemp) = 0;
- virtual void loadString(const QString &str, IR::Temp *targetTemp) = 0;
- virtual void loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp) = 0;
- virtual void getActivationProperty(const QString &name, IR::Temp *temp) = 0;
- virtual void setActivationProperty(IR::Temp *source, const QString &targetName) = 0;
- virtual void initClosure(IR::Closure *closure, IR::Temp *target) = 0;
- virtual void getProperty(IR::Temp *base, const QString &name, IR::Temp *target) = 0;
- virtual void setProperty(IR::Temp *source, IR::Temp *targetBase, const QString &targetName) = 0;
- virtual void getElement(IR::Temp *base, IR::Temp *index, IR::Temp *target) = 0;
- virtual void setElement(IR::Temp *source, IR::Temp *targetBase, IR::Temp *targetIndex) = 0;
- virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp) = 0;
- virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp) = 0;
- virtual void binop(IR::AluOp oper, IR::Temp *leftSource, IR::Temp *rightSource, IR::Temp *target) = 0;
- virtual void inplaceNameOp(IR::AluOp oper, IR::Temp *rightSource, const QString &targetName) = 0;
- virtual void inplaceElementOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBaseTemp, IR::Temp *targetIndexTemp) = 0;
- virtual void inplaceMemberOp(IR::AluOp oper, IR::Temp *source, IR::Temp *targetBase, const QString &targetName) = 0;
+ virtual void callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter) = 0;
+ virtual void callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, V4IR::Temp *value) = 0;
+ virtual void callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args) = 0;
+ virtual void callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result) = 0;
+ virtual void callProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result) = 0;
+ virtual void callSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::ExprList *args, V4IR::Temp *result) = 0;
+ virtual void constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result) = 0;
+ virtual void constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result) = 0;
+ virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result) = 0;
+ virtual void loadThisObject(V4IR::Temp *temp) = 0;
+ virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp) = 0;
+ virtual void loadString(const QString &str, V4IR::Temp *targetTemp) = 0;
+ virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp) = 0;
+ virtual void getActivationProperty(const QString &name, V4IR::Temp *temp) = 0;
+ virtual void setActivationProperty(V4IR::Temp *source, const QString &targetName) = 0;
+ virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target) = 0;
+ virtual void getProperty(V4IR::Temp *base, const QString &name, V4IR::Temp *target) = 0;
+ virtual void setProperty(V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName) = 0;
+ virtual void getElement(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *target) = 0;
+ virtual void setElement(V4IR::Temp *source, V4IR::Temp *targetBase, V4IR::Temp *targetIndex) = 0;
+ virtual void copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp) = 0;
+ virtual void unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp) = 0;
+ virtual void binop(V4IR::AluOp oper, V4IR::Temp *leftSource, V4IR::Temp *rightSource, V4IR::Temp *target) = 0;
+ virtual void inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSource, const QString &targetName) = 0;
+ virtual void inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBaseTemp, V4IR::Temp *targetIndexTemp) = 0;
+ virtual void inplaceMemberOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName) = 0;
private:
- void callBuiltin(IR::Call *c, IR::Temp *temp);
+ void callBuiltin(V4IR::Call *c, V4IR::Temp *temp);
};
} // namespace IR
diff --git a/src/v4/qv4isel_util_p.h b/src/v4/qv4isel_util_p.h
index 1027fd964e..57672ba241 100644
--- a/src/v4/qv4isel_util_p.h
+++ b/src/v4/qv4isel_util_p.h
@@ -43,18 +43,18 @@ inline VM::Value nonExistantValue()
return v;
}
-inline VM::Value convertToValue(IR::Const *c)
+inline VM::Value convertToValue(V4IR::Const *c)
{
switch (c->type) {
- case IR::MissingType:
+ case V4IR::MissingType:
return nonExistantValue();
- case IR::NullType:
+ case V4IR::NullType:
return VM::Value::nullValue();
- case IR::UndefinedType:
+ case V4IR::UndefinedType:
return VM::Value::undefinedValue();
- case IR::BoolType:
+ case V4IR::BoolType:
return VM::Value::fromBoolean(c->value != 0);
- case IR::NumberType: {
+ case V4IR::NumberType: {
int ival = (int)c->value;
// +0 != -0, so we need to convert to double when negating 0
if (ival == c->value && !(c->value == 0 && isNegative(c->value))) {
diff --git a/src/v4/qv4jsir.cpp b/src/v4/qv4jsir.cpp
index 908643bff4..3c55131a5d 100644
--- a/src/v4/qv4jsir.cpp
+++ b/src/v4/qv4jsir.cpp
@@ -51,7 +51,7 @@
QT_BEGIN_NAMESPACE
namespace QQmlJS {
-namespace IR {
+namespace V4IR {
const char *typeName(Type t)
{
@@ -141,7 +141,7 @@ AluOp binaryOperator(int op)
}
}
-struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
+struct RemoveSharedExpressions: V4IR::StmtVisitor, V4IR::ExprVisitor
{
CloneExpr clone;
QSet<Expr *> subexpressions; // contains all the non-cloned subexpressions in the given function
@@ -149,7 +149,7 @@ struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
RemoveSharedExpressions(): uniqueExpr(0) {}
- void operator()(IR::Function *function)
+ void operator()(V4IR::Function *function)
{
subexpressions.clear();
@@ -172,7 +172,7 @@ struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
}
subexpressions.insert(expr);
- IR::Expr *e = expr;
+ V4IR::Expr *e = expr;
qSwap(uniqueExpr, e);
expr->accept(this);
qSwap(uniqueExpr, e);
@@ -243,14 +243,14 @@ struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
virtual void visitCall(Call *e)
{
e->base = cleanup(e->base);
- for (IR::ExprList *it = e->args; it; it = it->next)
+ for (V4IR::ExprList *it = e->args; it; it = it->next)
it->expr = cleanup(it->expr);
}
virtual void visitNew(New *e)
{
e->base = cleanup(e->base);
- for (IR::ExprList *it = e->args; it; it = it->next)
+ for (V4IR::ExprList *it = e->args; it; it = it->next)
it->expr = cleanup(it->expr);
}
@@ -269,13 +269,13 @@ struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
void Const::dump(QTextStream &out)
{
switch (type) {
- case QQmlJS::IR::UndefinedType:
+ case QQmlJS::V4IR::UndefinedType:
out << "undefined";
break;
- case QQmlJS::IR::NullType:
+ case QQmlJS::V4IR::NullType:
out << "null";
break;
- case QQmlJS::IR::BoolType:
+ case QQmlJS::V4IR::BoolType:
out << (value ? "true" : "false");
break;
default:
@@ -358,21 +358,21 @@ static const char *builtin_to_string(Name::Builtin b)
return "builtin_throw";
case Name::builtin_finish_try:
return "builtin_finish_try";
- case IR::Name::builtin_foreach_iterator_object:
+ case V4IR::Name::builtin_foreach_iterator_object:
return "builtin_foreach_iterator_object";
- case IR::Name::builtin_foreach_next_property_name:
+ case V4IR::Name::builtin_foreach_next_property_name:
return "builtin_foreach_next_property_name";
- case IR::Name::builtin_push_with_scope:
+ case V4IR::Name::builtin_push_with_scope:
return "builtin_push_with_scope";
- case IR::Name::builtin_pop_scope:
+ case V4IR::Name::builtin_pop_scope:
return "builtin_pop_scope";
- case IR::Name::builtin_declare_vars:
+ case V4IR::Name::builtin_declare_vars:
return "builtin_declare_vars";
- case IR::Name::builtin_define_property:
+ case V4IR::Name::builtin_define_property:
return "builtin_define_property";
- case IR::Name::builtin_define_array:
+ case V4IR::Name::builtin_define_array:
return "builtin_define_array";
- case IR::Name::builtin_define_getter_setter:
+ case V4IR::Name::builtin_define_getter_setter:
return "builtin_define_getter_setter";
}
return "builtin_(###FIXME)";
@@ -551,8 +551,8 @@ Function::~Function()
{
// destroy the Stmt::Data blocks manually, because memory pool cleanup won't
// call the Stmt destructors.
- foreach (IR::BasicBlock *b, basicBlocks)
- foreach (IR::Stmt *s, b->statements)
+ foreach (V4IR::BasicBlock *b, basicBlocks)
+ foreach (V4IR::Stmt *s, b->statements)
s->destroyData();
qDeleteAll(basicBlocks);
@@ -840,7 +840,7 @@ ExprList *CloneExpr::clone(ExprList *list)
if (! list)
return 0;
- ExprList *clonedList = block->function->New<IR::ExprList>();
+ ExprList *clonedList = block->function->New<V4IR::ExprList>();
clonedList->init(clone(list->expr), clone(list->next));
return clonedList;
}
diff --git a/src/v4/qv4jsir_p.h b/src/v4/qv4jsir_p.h
index da00991233..2202124f6b 100644
--- a/src/v4/qv4jsir_p.h
+++ b/src/v4/qv4jsir_p.h
@@ -85,7 +85,7 @@ struct ExecutionContext;
struct Value;
}
-namespace IR {
+namespace V4IR {
struct BasicBlock;
struct Function;
@@ -161,7 +161,7 @@ enum AluOp {
LastAluOp = OpOr
};
AluOp binaryOperator(int op);
-const char *opname(IR::AluOp op);
+const char *opname(V4IR::AluOp op);
enum Type {
MissingType, // Used to indicate holes in array initialization (e.g. [,,])
@@ -752,7 +752,7 @@ struct BasicBlock {
Stmt *ENTER(Expr *expr);
Stmt *LEAVE();
- Stmt *MOVE(Expr *target, Expr *source, AluOp op = IR::OpInvalid);
+ Stmt *MOVE(Expr *target, Expr *source, AluOp op = V4IR::OpInvalid);
Stmt *JUMP(BasicBlock *target);
Stmt *CJUMP(Expr *cond, BasicBlock *iftrue, BasicBlock *iffalse);
@@ -762,12 +762,12 @@ struct BasicBlock {
void dump(QTextStream &out, Stmt::Mode mode = Stmt::HIR);
};
-class CloneExpr: protected IR::ExprVisitor
+class CloneExpr: protected V4IR::ExprVisitor
{
public:
- explicit CloneExpr(IR::BasicBlock *block = 0);
+ explicit CloneExpr(V4IR::BasicBlock *block = 0);
- void setBasicBlock(IR::BasicBlock *block);
+ void setBasicBlock(V4IR::BasicBlock *block);
template <typename _Expr>
_Expr *operator()(_Expr *expr)
@@ -786,7 +786,7 @@ public:
}
protected:
- IR::ExprList *clone(IR::ExprList *list);
+ V4IR::ExprList *clone(V4IR::ExprList *list);
virtual void visitConst(Const *);
virtual void visitString(String *);
@@ -802,8 +802,8 @@ protected:
virtual void visitMember(Member *);
private:
- IR::BasicBlock *block;
- IR::Expr *cloned;
+ V4IR::BasicBlock *block;
+ V4IR::Expr *cloned;
};
} // end of namespace IR
diff --git a/src/v4/qv4v8.cpp b/src/v4/qv4v8.cpp
index 0c30df4e49..09ab67d3bd 100644
--- a/src/v4/qv4v8.cpp
+++ b/src/v4/qv4v8.cpp
@@ -1225,11 +1225,11 @@ Local<RegExp> RegExp::New(Handle<String> pattern, RegExp::Flags flags)
{
int f = 0;
if (flags & kGlobal)
- f |= IR::RegExp::RegExp_Global;
+ f |= V4IR::RegExp::RegExp_Global;
if (flags & kIgnoreCase)
- f |= IR::RegExp::RegExp_IgnoreCase;
+ f |= V4IR::RegExp::RegExp_IgnoreCase;
if (flags & kMultiline)
- f |= IR::RegExp::RegExp_Multiline;
+ f |= V4IR::RegExp::RegExp_Multiline;
VM::Object *o = currentEngine()->newRegExpObject(pattern->asQString(), f);
return Local<RegExp>::New(Value::fromVmValue(VM::Value::fromObject(o)));
}