Author: Stephan <[email protected]>
Branch:
Changeset: r135:2cde4c06fb6d
Date: 2011-10-06 15:20 +0200
http://bitbucket.org/pypy/lang-js/changeset/2cde4c06fb6d/
Log: optimized property access in W_Object
diff --git a/js/jsobj.py b/js/jsobj.py
--- a/js/jsobj.py
+++ b/js/jsobj.py
@@ -213,21 +213,22 @@
return self.Prototype.Get(ctx, P) # go down the prototype chain
def CanPut(self, P):
- if P in self.propdict:
- if self.propdict[P].flags & RO: return False
+ property = self.propdict.get(P, None)
+ if property is not None:
+ if property.flags & RO: return False
return True
if self.Prototype is None: return True
return self.Prototype.CanPut(P)
def Put(self, ctx, P, V, flags = 0):
+ property = self.propdict.get(P, None)
+ if property is not None:
+ property.value = V
+ property.flags |= flags
+ return
if not self.CanPut(P): return
- if P in self.propdict:
- prop = self.propdict[P]
- prop.value = V
- prop.flags |= flags
- else:
- self.propdict[P] = Property(P, V, flags = flags)
+ self.propdict[P] = Property(P, V, flags = flags)
def HasProperty(self, P):
if P in self.propdict: return True
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit