Commits

stepahn committed 83da05a

jit tuning

Comments (0)

Files changed (1)

 #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
     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):
     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
             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()
     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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.