[pypy-svn] r50309 - in pypy/dist/pypy: interpreter objspace/std
arigo at codespeak.net
arigo at codespeak.net
Fri Jan 4 14:34:13 CET 2008
Author: arigo
Date: Fri Jan 4 14:34:11 2008
New Revision: 50309
Modified:
pypy/dist/pypy/interpreter/baseobjspace.py
pypy/dist/pypy/objspace/std/objspace.py
Log:
Move the shortcut for getindex_w(<intobject>) to a place
where it can be more efficient.
Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py (original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py Fri Jan 4 14:34:11 2008
@@ -836,10 +836,6 @@
If w_exception is None, silently clamp in case of overflow;
else raise w_exception.
"""
- # shortcut for int objects
- if self.is_w(self.type(w_obj), self.w_int):
- return self.int_w(w_obj)
-
try:
w_index = self.index(w_obj)
except OperationError, err:
Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py (original)
+++ pypy/dist/pypy/objspace/std/objspace.py Fri Jan 4 14:34:11 2008
@@ -621,6 +621,14 @@
else:
self.setitem(w_obj, w_key, w_value)
+ def getindex_w(self, w_obj, w_exception, objdescr=None):
+ # performance shortcut for W_IntObject
+ # XXX we should also have one for W_SmallIntObject, I guess
+ if type(w_obj) is W_IntObject:
+ return w_obj.intval
+ else:
+ return ObjSpace.getindex_w(self, w_obj, w_exception, objdescr)
+
def call_method(self, w_obj, methname, *arg_w):
if self.config.objspace.opcodes.CALL_METHOD:
from pypy.objspace.std.callmethod import call_method_opt
More information about the pypy-svn
mailing list