// call the property on the loaded base
Instruction::CallProperty call;
call.base = getParam(base);
- call.name = identifier(name);
+ call.name = stringId(name);
prepareCallArgs(args, call.argc, call.args);
call.result = getResultParam(result);
addInstruction(call);
V4IR::Temp *result)
{
Instruction::CreateActivationProperty create;
- create.name = identifier(*func->id);
+ create.name = stringId(*func->id);
prepareCallArgs(args, create.argc, create.args);
create.result = getResultParam(result);
addInstruction(create);
{
Instruction::CreateProperty create;
create.base = getParam(base);
- create.name = identifier(name);
+ create.name = stringId(name);
prepareCallArgs(args, create.argc, create.args);
create.result = getResultParam(result);
addInstruction(create);
void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp)
{
- Instruction::LoadValue load;
- load.value = Instr::Param::createValue(QV4::Value::fromString(identifier(str)));
+ Instruction::LoadString load;
+ load.stringId = stringId(str);
load.result = getResultParam(targetTemp);
addInstruction(load);
}
void InstructionSelection::getActivationProperty(const V4IR::Name *name, V4IR::Temp *temp)
{
Instruction::LoadName load;
- load.name = identifier(*name->id);
+ load.name = stringId(*name->id);
load.result = getResultParam(temp);
addInstruction(load);
}
{
Instruction::StoreName store;
store.source = getParam(source);
- store.name = identifier(targetName);
+ store.name = stringId(targetName);
addInstruction(store);
}
{
Instruction::LoadProperty load;
load.base = getParam(base);
- load.name = identifier(name);
+ load.name = stringId(name);
load.result = getResultParam(target);
addInstruction(load);
}
{
Instruction::StoreProperty store;
store.base = getParam(targetBase);
- store.name = identifier(targetName);
+ store.name = stringId(targetName);
store.source = getParam(source);
addInstruction(store);
}
if (op) {
Instruction::InplaceNameOp ieo;
ieo.alu = op;
- ieo.name = identifier(targetName);
+ ieo.name = stringId(targetName);
ieo.source = getParam(rightSource);
addInstruction(ieo);
}
Instruction::InplaceMemberOp imo;
imo.alu = op;
imo.base = getParam(targetBase);
- imo.member = identifier(targetName);
+ imo.member = stringId(targetName);
imo.source = getParam(source);
addInstruction(imo);
}
Instruction::EnterTry enterTry;
enterTry.tryOffset = 0;
enterTry.catchOffset = 0;
- enterTry.exceptionVarName = identifier(*t->exceptionVarName);
+ enterTry.exceptionVarName = stringId(*t->exceptionVarName);
enterTry.exceptionVar = getParam(t->exceptionVar);
ptrdiff_t enterTryLoc = addInstruction(enterTry);
void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
Instruction::CallActivationProperty call;
- call.name = identifier(*func->id);
+ call.name = stringId(*func->id);
prepareCallArgs(args, call.argc, call.args);
call.result = getResultParam(result);
addInstruction(call);
{
Instruction::CallBuiltinTypeofMember call;
call.base = getParam(base);
- call.member = identifier(name);
+ call.member = stringId(name);
call.result = getResultParam(result);
addInstruction(call);
}
void InstructionSelection::callBuiltinTypeofName(const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinTypeofName call;
- call.name = identifier(name);
+ call.name = stringId(name);
call.result = getResultParam(result);
addInstruction(call);
}
{
Instruction::CallBuiltinDeleteMember call;
call.base = getParam(base);
- call.member = identifier(name);
+ call.member = stringId(name);
call.result = getResultParam(result);
addInstruction(call);
}
void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinDeleteName call;
- call.name = identifier(name);
+ call.name = stringId(name);
call.result = getResultParam(result);
addInstruction(call);
}
{
Instruction::CallBuiltinPostDecMember call;
call.base = getParam(base);
- call.member = identifier(name);
+ call.member = stringId(name);
call.result = getResultParam(result);
addInstruction(call);
}
void InstructionSelection::callBuiltinPostDecrementName(const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinPostDecName call;
- call.name = identifier(name);
+ call.name = stringId(name);
call.result = getResultParam(result);
addInstruction(call);
}
{
Instruction::CallBuiltinPostIncMember call;
call.base = getParam(base);
- call.member = identifier(name);
+ call.member = stringId(name);
call.result = getResultParam(result);
addInstruction(call);
}
void InstructionSelection::callBuiltinPostIncrementName(const QString &name, V4IR::Temp *result)
{
Instruction::CallBuiltinPostIncName call;
- call.name = identifier(name);
+ call.name = stringId(name);
call.result = getResultParam(result);
addInstruction(call);
}
{
Instruction::CallBuiltinDeclareVar call;
call.isDeletable = deletable;
- call.varName = identifier(name);
+ call.varName = stringId(name);
addInstruction(call);
}
{
Instruction::CallBuiltinDefineGetterSetter call;
call.object = getParam(object);
- call.name = identifier(name);
+ call.name = stringId(name);
call.getter = getParam(getter);
call.setter = getParam(setter);
addInstruction(call);
{
Instruction::CallBuiltinDefineProperty call;
call.object = getParam(object);
- call.name = identifier(name);
+ call.name = stringId(name);
call.value = getParam(value);
addInstruction(call);
}
return squeezed;
}
-QV4::String *InstructionSelection::identifier(const QString &s)
-{
- QV4::String *str = engine()->newIdentifier(s);
- _vmFunction->identifiers.append(str);
- return str;
-}
-
Instr::Param InstructionSelection::getParam(V4IR::Expr *e) {
typedef Instr::Param Param;
assert(e);
}
#endif
+ QV4::String ** const runtimeStrings = context->runtimeFunction()->compilationUnit->runtimeStrings;
context->interpreterInstructionPointer = &code;
#ifdef MOTH_THREADED_INTERPRETER
VALUE(instr.result) = VALUE(instr.value);
MOTH_END_INSTR(LoadValue)
+ MOTH_BEGIN_INSTR(LoadString)
+// TRACE(value, "%s", instr.value.toString(context)->toQString().toUtf8().constData());
+ VALUE(instr.result) = QV4::Value::fromString(runtimeStrings[instr.stringId]);
+ MOTH_END_INSTR(LoadString)
+
MOTH_BEGIN_INSTR(LoadClosure)
__qmljs_init_closure(context, VALUEPTR(instr.result), instr.value);
MOTH_END_INSTR(LoadClosure)
MOTH_BEGIN_INSTR(LoadName)
TRACE(inline, "property name = %s", instr.name->toQString().toUtf8().constData());
- __qmljs_get_activation_property(context, VALUEPTR(instr.result), instr.name);
+ __qmljs_get_activation_property(context, VALUEPTR(instr.result), runtimeStrings[instr.name]);
MOTH_END_INSTR(LoadName)
MOTH_BEGIN_INSTR(StoreName)
TRACE(inline, "property name = %s", instr.name->toQString().toUtf8().constData());
- __qmljs_set_activation_property(context, instr.name, VALUE(instr.source));
+ __qmljs_set_activation_property(context, runtimeStrings[instr.name], VALUE(instr.source));
MOTH_END_INSTR(StoreName)
MOTH_BEGIN_INSTR(LoadElement)
MOTH_END_INSTR(StoreElement)
MOTH_BEGIN_INSTR(LoadProperty)
- __qmljs_get_property(context, VALUEPTR(instr.result), VALUE(instr.base), instr.name);
+ __qmljs_get_property(context, VALUEPTR(instr.result), VALUE(instr.base), runtimeStrings[instr.name]);
MOTH_END_INSTR(LoadProperty)
MOTH_BEGIN_INSTR(StoreProperty)
- __qmljs_set_property(context, VALUE(instr.base), instr.name, VALUE(instr.source));
+ __qmljs_set_property(context, VALUE(instr.base), runtimeStrings[instr.name], VALUE(instr.source));
MOTH_END_INSTR(StoreProperty)
MOTH_BEGIN_INSTR(Push)
TRACE(property name, "%s, args=%u, argc=%u, this=%s", qPrintable(instr.name->toQString()), instr.args, instr.argc, (VALUE(instr.base)).toString(context)->toQString().toUtf8().constData());
Q_ASSERT(instr.args + instr.argc <= stackSize);
QV4::Value *args = stack + instr.args;
- __qmljs_call_property(context, VALUEPTR(instr.result), VALUE(instr.base), instr.name, args, instr.argc);
+ __qmljs_call_property(context, VALUEPTR(instr.result), VALUE(instr.base), runtimeStrings[instr.name], args, instr.argc);
MOTH_END_INSTR(CallProperty)
MOTH_BEGIN_INSTR(CallElement)
Q_ASSERT(instr.args + instr.argc <= stackSize);
TRACE(args, "starting at %d, length %d", instr.args, instr.argc);
QV4::Value *args = stack + instr.args;
- __qmljs_call_activation_property(context, VALUEPTR(instr.result), instr.name, args, instr.argc);
+ __qmljs_call_activation_property(context, VALUEPTR(instr.result), runtimeStrings[instr.name], args, instr.argc);
MOTH_END_INSTR(CallActivationProperty)
MOTH_BEGIN_INSTR(CallBuiltinThrow)
ex.accept(context);
VALUE(instr.exceptionVar) = ex.value();
try {
- QV4::ExecutionContext *catchContext = __qmljs_builtin_push_catch_scope(instr.exceptionVarName, ex.value(), context);
+ QV4::ExecutionContext *catchContext = __qmljs_builtin_push_catch_scope(runtimeStrings[instr.exceptionVarName], ex.value(), context);
const uchar *catchCode = ((uchar *)&instr.catchOffset) + instr.catchOffset;
run(catchContext, catchCode, stack, stackSize);
code = catchCode;
MOTH_END_INSTR(CallBuiltinForeachNextPropertyName)
MOTH_BEGIN_INSTR(CallBuiltinDeleteMember)
- __qmljs_delete_member(context, VALUEPTR(instr.result), VALUE(instr.base), instr.member);
+ __qmljs_delete_member(context, VALUEPTR(instr.result), VALUE(instr.base), runtimeStrings[instr.member]);
MOTH_END_INSTR(CallBuiltinDeleteMember)
MOTH_BEGIN_INSTR(CallBuiltinDeleteSubscript)
MOTH_END_INSTR(CallBuiltinDeleteSubscript)
MOTH_BEGIN_INSTR(CallBuiltinDeleteName)
- __qmljs_delete_name(context, VALUEPTR(instr.result), instr.name);
+ __qmljs_delete_name(context, VALUEPTR(instr.result), runtimeStrings[instr.name]);
MOTH_END_INSTR(CallBuiltinDeleteName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofMember)
- __qmljs_builtin_typeof_member(context, VALUEPTR(instr.result), VALUE(instr.base), instr.member);
+ __qmljs_builtin_typeof_member(context, VALUEPTR(instr.result), VALUE(instr.base), runtimeStrings[instr.member]);
MOTH_END_INSTR(CallBuiltinTypeofMember)
MOTH_BEGIN_INSTR(CallBuiltinTypeofSubscript)
MOTH_END_INSTR(CallBuiltinTypeofSubscript)
MOTH_BEGIN_INSTR(CallBuiltinTypeofName)
- __qmljs_builtin_typeof_name(context, VALUEPTR(instr.result), instr.name);
+ __qmljs_builtin_typeof_name(context, VALUEPTR(instr.result), runtimeStrings[instr.name]);
MOTH_END_INSTR(CallBuiltinTypeofName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofValue)
MOTH_END_INSTR(CallBuiltinTypeofValue)
MOTH_BEGIN_INSTR(CallBuiltinPostIncMember)
- __qmljs_builtin_post_increment_member(context, VALUEPTR(instr.result), VALUE(instr.base), instr.member);
+ __qmljs_builtin_post_increment_member(context, VALUEPTR(instr.result), VALUE(instr.base), runtimeStrings[instr.member]);
MOTH_END_INSTR(CallBuiltinTypeofMember)
MOTH_BEGIN_INSTR(CallBuiltinPostIncSubscript)
MOTH_END_INSTR(CallBuiltinTypeofSubscript)
MOTH_BEGIN_INSTR(CallBuiltinPostIncName)
- __qmljs_builtin_post_increment_name(context, VALUEPTR(instr.result), instr.name);
+ __qmljs_builtin_post_increment_name(context, VALUEPTR(instr.result), runtimeStrings[instr.name]);
MOTH_END_INSTR(CallBuiltinTypeofName)
MOTH_BEGIN_INSTR(CallBuiltinPostIncValue)
MOTH_END_INSTR(CallBuiltinTypeofValue)
MOTH_BEGIN_INSTR(CallBuiltinPostDecMember)
- __qmljs_builtin_post_decrement_member(context, VALUEPTR(instr.result), VALUE(instr.base), instr.member);
+ __qmljs_builtin_post_decrement_member(context, VALUEPTR(instr.result), VALUE(instr.base), runtimeStrings[instr.member]);
MOTH_END_INSTR(CallBuiltinTypeofMember)
MOTH_BEGIN_INSTR(CallBuiltinPostDecSubscript)
MOTH_END_INSTR(CallBuiltinTypeofSubscript)
MOTH_BEGIN_INSTR(CallBuiltinPostDecName)
- __qmljs_builtin_post_decrement_name(context, VALUEPTR(instr.result), instr.name);
+ __qmljs_builtin_post_decrement_name(context, VALUEPTR(instr.result), runtimeStrings[instr.name]);
MOTH_END_INSTR(CallBuiltinTypeofName)
MOTH_BEGIN_INSTR(CallBuiltinPostDecValue)
MOTH_END_INSTR(CallBuiltinTypeofValue)
MOTH_BEGIN_INSTR(CallBuiltinDeclareVar)
- __qmljs_builtin_declare_var(context, instr.isDeletable, instr.varName);
+ __qmljs_builtin_declare_var(context, instr.isDeletable, runtimeStrings[instr.varName]);
MOTH_END_INSTR(CallBuiltinDeclareVar)
MOTH_BEGIN_INSTR(CallBuiltinDefineGetterSetter)
- __qmljs_builtin_define_getter_setter(context, VALUE(instr.object), instr.name, VALUEPTR(instr.getter), VALUEPTR(instr.setter));
+ __qmljs_builtin_define_getter_setter(context, VALUE(instr.object), runtimeStrings[instr.name], VALUEPTR(instr.getter), VALUEPTR(instr.setter));
MOTH_END_INSTR(CallBuiltinDefineGetterSetter)
MOTH_BEGIN_INSTR(CallBuiltinDefineProperty)
- __qmljs_builtin_define_property(context, VALUE(instr.object), instr.name, VALUEPTR(instr.value));
+ __qmljs_builtin_define_property(context, VALUE(instr.object), runtimeStrings[instr.name], VALUEPTR(instr.value));
MOTH_END_INSTR(CallBuiltinDefineProperty)
MOTH_BEGIN_INSTR(CallBuiltinDefineArray)
MOTH_BEGIN_INSTR(CreateProperty)
Q_ASSERT(instr.args + instr.argc <= stackSize);
QV4::Value *args = stack + instr.args;
- __qmljs_construct_property(context, VALUEPTR(instr.result), VALUE(instr.base), instr.name, args, instr.argc);
+ __qmljs_construct_property(context, VALUEPTR(instr.result), VALUE(instr.base), runtimeStrings[instr.name], args, instr.argc);
MOTH_END_INSTR(CreateProperty)
MOTH_BEGIN_INSTR(CreateActivationProperty)
TRACE(inline, "property name = %s, args = %d, argc = %d", instr.name->toQString().toUtf8().constData(), instr.args, instr.argc);
Q_ASSERT(instr.args + instr.argc <= stackSize);
QV4::Value *args = stack + instr.args;
- __qmljs_construct_activation_property(context, VALUEPTR(instr.result), instr.name, args, instr.argc);
+ __qmljs_construct_activation_property(context, VALUEPTR(instr.result), runtimeStrings[instr.name], args, instr.argc);
MOTH_END_INSTR(CreateActivationProperty)
MOTH_BEGIN_INSTR(Jump)
MOTH_BEGIN_INSTR(InplaceMemberOp)
instr.alu(context,
VALUE(instr.base),
- instr.member,
+ runtimeStrings[instr.member],
VALUE(instr.source));
MOTH_END_INSTR(InplaceMemberOp)
MOTH_BEGIN_INSTR(InplaceNameOp)
TRACE(name, "%s", instr.name->toQString().toUtf8().constData());
- instr.alu(context, instr.name, VALUE(instr.source));
+ instr.alu(context, runtimeStrings[instr.name], VALUE(instr.source));
MOTH_END_INSTR(InplaceNameOp)
#ifdef MOTH_THREADED_INTERPRETER