added newObject(), saveName() and setProperty().

This commit is contained in:
beard%netscape.com 2000-04-07 02:41:08 +00:00
Родитель 219208b7ee
Коммит 9c646bbafc
2 изменённых файлов: 44 добавлений и 2 удалений

Просмотреть файл

@ -77,6 +77,14 @@ namespace JavaScript {
return dest;
}
Register ICodeGenerator::newObject()
{
Register dest = getRegister();
NewObject *instr = new NewObject(dest);
iCode->push_back(instr);
return dest;
}
Register ICodeGenerator::loadName(StringAtom &name)
{
Register dest = getRegister();
@ -84,6 +92,12 @@ namespace JavaScript {
iCode->push_back(instr);
return dest;
}
void ICodeGenerator::saveName(StringAtom &name, Register value)
{
SaveName *instr = new SaveName(SAVE_NAME, &name, value);
iCode->push_back(instr);
}
Register ICodeGenerator::getProperty(StringAtom &name, Register base)
{
@ -93,6 +107,12 @@ namespace JavaScript {
return dest;
}
void ICodeGenerator::setProperty(StringAtom &name, Register base, Register value)
{
SetProp *instr = new SetProp(SET_PROP, &name, base, value);
iCode->push_back(instr);
}
void ICodeGenerator::saveVariable(uint32 frameIndex, Register value)
{
SaveVar *instr = new SaveVar(SAVE_VAR, frameIndex, value);
@ -525,7 +545,7 @@ namespace JavaScript {
void ICodeGenerator::returnStatement(Register result)
{
Return *instr = new Return(RETURN, result);
Return *instr = new Return(result);
iCode->push_back(instr);
}
@ -540,6 +560,7 @@ namespace JavaScript {
"load_imm",
"load_name",
"save_name",
"new_object",
"get_prop",
"set_prop",
"add",

Просмотреть файл

@ -77,6 +77,14 @@ namespace JavaScript {
return dest;
}
Register ICodeGenerator::newObject()
{
Register dest = getRegister();
NewObject *instr = new NewObject(dest);
iCode->push_back(instr);
return dest;
}
Register ICodeGenerator::loadName(StringAtom &name)
{
Register dest = getRegister();
@ -84,6 +92,12 @@ namespace JavaScript {
iCode->push_back(instr);
return dest;
}
void ICodeGenerator::saveName(StringAtom &name, Register value)
{
SaveName *instr = new SaveName(SAVE_NAME, &name, value);
iCode->push_back(instr);
}
Register ICodeGenerator::getProperty(StringAtom &name, Register base)
{
@ -93,6 +107,12 @@ namespace JavaScript {
return dest;
}
void ICodeGenerator::setProperty(StringAtom &name, Register base, Register value)
{
SetProp *instr = new SetProp(SET_PROP, &name, base, value);
iCode->push_back(instr);
}
void ICodeGenerator::saveVariable(uint32 frameIndex, Register value)
{
SaveVar *instr = new SaveVar(SAVE_VAR, frameIndex, value);
@ -525,7 +545,7 @@ namespace JavaScript {
void ICodeGenerator::returnStatement(Register result)
{
Return *instr = new Return(RETURN, result);
Return *instr = new Return(result);
iCode->push_back(instr);
}
@ -540,6 +560,7 @@ namespace JavaScript {
"load_imm",
"load_name",
"save_name",
"new_object",
"get_prop",
"set_prop",
"add",