Author: Stephan <step...@stzal.com>
Branch: 
Changeset: r348:83da05a4775d
Date: 2013-02-03 17:37 +0100
http://bitbucket.org/pypy/lang-js/changeset/83da05a4775d/

Log:    jit tuning

diff --git a/js/jscode.py b/js/jscode.py
--- a/js/jscode.py
+++ b/js/jscode.py
@@ -1,6 +1,5 @@
 #from pypy.rlib.jit import hint
 #from pypy.rlib.objectmodel import we_are_translated
-from pypy.rlib.jit import JitDriver
 from pypy.rlib import jit
 
 from js.exception import JsThrowException
@@ -16,7 +15,7 @@
     else:
         return '%d: %s' % (pc, 'end of opcodes')
 
-jitdriver = JitDriver(greens=['pc', 'debug', 'self'], reds=['result', 'ctx'], 
get_printable_location=get_printable_location, virtualizables=['ctx'])
+jitdriver = jit.JitDriver(greens=['pc', 'debug', 'self'], reds=['result', 
'ctx'], get_printable_location=get_printable_location, virtualizables=['ctx'])
 
 
 def ast_to_bytecode(ast, symbol_map):
@@ -66,9 +65,8 @@
     def params(self):
         return [p for p in self.parameters]
 
-    #@jit.elidable
+    @jit.elidable
     def estimated_stack_size(self):
-        # TODO: compute only once
         if self._estimated_stack_size == -1:
             max_size = 0
             moving_size = 0
@@ -78,7 +76,7 @@
             assert max_size >= 0
             self._estimated_stack_size = max_size
 
-        return self._estimated_stack_size
+        return jit.promote(self._estimated_stack_size)
 
     def symbol_size(self):
         return self._symbols.len()
@@ -171,6 +169,7 @@
     def compile(self):
         self.unlabel()
         self.compiled_opcodes = [o for o in self.opcodes]
+        self.estimated_stack_size()
 
     def remove_labels(self):
         """ Basic optimization to remove all labels and change
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to