diff --git a/js/js2/icodegenerator.cpp b/js/js2/icodegenerator.cpp index b14e8ba1534..267cc8323d1 100644 --- a/js/js2/icodegenerator.cpp +++ b/js/js2/icodegenerator.cpp @@ -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", diff --git a/js2/src/icodegenerator.cpp b/js2/src/icodegenerator.cpp index b14e8ba1534..267cc8323d1 100644 --- a/js2/src/icodegenerator.cpp +++ b/js2/src/icodegenerator.cpp @@ -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",