[pypy-commit] lang-js default: 11.7.1

stepahn noreply at buildbot.pypy.org
Fri Dec 28 11:33:33 CET 2012


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r193:5ce3e8e4b569
Date: 2012-05-21 13:20 +0200
http://bitbucket.org/pypy/lang-js/changeset/5ce3e8e4b569/

Log:	11.7.1

diff --git a/js/builtins_string.py b/js/builtins_string.py
--- a/js/builtins_string.py
+++ b/js/builtins_string.py
@@ -229,6 +229,8 @@
     tmp2 = min(max(end, 0), size)
     start = min(tmp1, tmp2)
     end = max(tmp1, tmp2)
+    start = int(start)
+    end = int(end)
     return string[start:end]
 
 # 15.5.4.16
diff --git a/js/opcodes.py b/js/opcodes.py
--- a/js/opcodes.py
+++ b/js/opcodes.py
@@ -280,9 +280,17 @@
 
 class LSH(BaseBinaryBitwiseOp):
     def eval(self, ctx):
-        op2 = ctx.stack_pop().ToUInt32()
-        op1 = ctx.stack_pop().ToInt32()
-        ctx.stack_append(W_IntNumber(op1 << intmask(op2 & 0x1F)))
+        from js.jsobj import r_int32
+        rval = ctx.stack_pop()
+        lval = ctx.stack_pop()
+
+        lnum = lval.ToInt32()
+        rnum = rval.ToUInt32()
+
+        shift_count = intmask(rnum & 0x1F)
+        res = r_int32(lnum << shift_count)
+
+        ctx.stack_append(_w(res))
 
 class MUL(BaseBinaryOperation):
     def operation(self, ctx, op1, op2):


More information about the pypy-commit mailing list