Mercurial > pub > Jint1
diff Jint.Runtime/VM/OpCodes/BinaryOp.cs @ 3:aced2ae9957f
temp commit, new virtual machine concept (strongly typed version of VM2).
author | cin |
---|---|
date | Sun, 27 Oct 2013 17:23:25 +0400 |
parents | e113095f1de0 |
children | a6329b092499 |
line wrap: on
line diff
--- a/Jint.Runtime/VM/OpCodes/BinaryOp.cs Fri Oct 25 15:52:16 2013 +0400 +++ b/Jint.Runtime/VM/OpCodes/BinaryOp.cs Sun Oct 27 17:23:25 2013 +0400 @@ -1,19 +1,36 @@ -using System; - -namespace Jint.Runtime.VM.OpCodes -{ - public abstract class BinaryOp: IOpCode - { - #region IOpCode implementation - - public void Invoke (Frame frame) - { - - } - - #endregion - - - } -} - +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Jint.Runtime.VM.OpCodes { + delegate void BinaryInstructionImpl(int arg1, int arg2, int dest, Frame frame); + + class BinaryOp: IInstruction { + + int m_dest; + int m_arg1; + int m_arg2; + Codes m_code; + IInstruction m_next; + + public BinaryOp(Codes code, int arg1, int arg2, int dest) { + m_code = code; + m_arg1 = arg1; + m_arg2 = arg2; + m_dest = dest; + } + + public IInstruction Chain(IInstruction next) { + m_next = next; + return next; + } + + public IInstruction Invoke(Frame frame) { + //frame[m_arg1].GetBinaryImpl(m_code)(m_arg1, m_arg2, m_dest, frame); + frame[m_arg1].InvokeBinaryOperation(m_code, m_arg2, m_dest, frame); + + return m_next; + } + } +}