[pypy-commit] lang-js default: implemented STORE_MEMBER_BITXOR

stepahn noreply at buildbot.pypy.org
Wed May 18 19:27:44 CEST 2011


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r69:92db5ca19b10
Date: 2011-05-18 12:02 +0200
http://bitbucket.org/pypy/lang-js/changeset/92db5ca19b10/

Log:	implemented STORE_MEMBER_BITXOR

diff --git a/js/jscode.py b/js/jscode.py
--- a/js/jscode.py
+++ b/js/jscode.py
@@ -584,6 +584,12 @@
     def decision(self, ctx, value, prev):
         return plus(ctx, value, prev)
 
+class STORE_MEMBER_BITXOR(BaseStoreMemberAssign):
+    def decision(self, ctx, value, prev):
+        op0 = value.ToInt32(ctx)
+        op1 = prev.ToInt32(ctx)
+        return W_IntNumber(op0 ^ op1)
+
 class BaseStoreMemberPost(Opcode):
     def eval(self, ctx, stack):
         left = stack.pop()
diff --git a/js/test/test_interp.py b/js/test/test_interp.py
--- a/js/test/test_interp.py
+++ b/js/test/test_interp.py
@@ -713,3 +713,9 @@
 def test_switch_no_default():
     yield assertv, switch_no_default_test_code(0), 42
     yield assertv, switch_no_default_test_code(1), 2
+
+def test_member_bitxor():
+    yield assertv, 'var i = {x:0}; i.x^=0;', 0
+    yield assertv, 'var i = {x:0}; i.x^=1;', 1
+    yield assertv, 'var i = {x:1}; i.x^=0;', 1
+    yield assertv, 'var i = {x:1}; i.x^=1;', 0


More information about the pypy-commit mailing list