[pypy-commit] lang-js default: updated jit test

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


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r283:91ecfa517a48
Date: 2012-08-24 10:44 +0200
http://bitbucket.org/pypy/lang-js/changeset/91ecfa517a48/

Log:	updated jit test

diff --git a/js/test/jit.py b/js/test/jit.py
--- a/js/test/jit.py
+++ b/js/test/jit.py
@@ -8,27 +8,32 @@
 from pypy.jit.metainterp.test.support import LLJitMixin
 
 from js import interpreter
-from js.jscode import JsCode, jitdriver
+from js.jscode import jitdriver
 
 class TestLLtype(LLJitMixin):
     def test_append(self):
+        #code = """
+          #var x = {i:0};
+          #function f() {
+            #while(x.i < 100) {
+              #x = {i:x.i + 1};
+            #}
+          #}
+          #f();
+        #"""
         code = """
-          var x = {i:0};
-          function f() {
-            while(x.i < 100) {
-              x = {i:x.i + 1};
+            var i = 0;
+            while(i < 100) {
+                i += 1;
             }
-          }
-          f();
+            return i;
         """
         jsint = interpreter.Interpreter()
-        bytecode = JsCode()
-        interpreter.load_source(code, '').emit(bytecode)
-        func = bytecode.make_js_function()
 
-        def interp_w(c):
-            jitdriver.set_param("inlining", True)
-            code_val = func.run(jsint.global_context)
-        interp_w(1)
-        self.meta_interp(interp_w, [6], listcomp=True, backendopt=True, listops=True)
+        def interp_w():
+            #jitdriver.set_param("inlining", True)
+            code_val = jsint.run_src(code)
+            return code_val.ToNumber()
+        #assert interp_w() == 100
+        assert self.meta_interp(interp_w, [], listcomp=True, backendopt=True, listops=True) == 100
 


More information about the pypy-commit mailing list