[Laszlo-dev] For Review: Change 20090421-ptw-R Summary: Improve swf8 non-existent property detection

André Bargull andre.bargull at udo.edu
Wed Apr 22 08:26:47 PDT 2009


Approved


On 4/21/2009 7:43 PM, P T Withington wrote:
> Change 20090421-ptw-R by ptw at dueling-banjos.home on 2009-04-21 
> 12:44:13 EDT
>     in /Users/ptw/OpenLaszlo/trunk-3
>     for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: Improve swf8 non-existent property detection
>
> Bugs Fixed: LPP-8058  Constraints should short-circuit if the value 
> would not change (prerequisite)
>
> Technical Reviewer: a.bargull at intensis.de (pending)
>
> Details:
>     Reorganize the code generated to check for a non-existent property
>     in the swf8 back-end:  We still make the initial fast check for
>     returning any value other than `void 0`, but if the value is
>     `void 0` then we use `hasOwnProperty` to see if the property
>     exists locally.  This is not perfect, but it is an improvement
>     over the current mechanism, and will allow __LzApplyArgs to
>     initialize constrained slots to `undefined` without triggering
>     warnings.
>
>     While I was there, I cleaned up the code generation for `in` to be
>     slightly more efficient, and replaced `typof x == 'undefined'`
>     with `x === void 0`, which is more efficient, in a few places.
>
>     I did _not_ improve the `in` emulation to use hasOwnProperty,
>     since it seems to be working and I thought that would be too much
>     additional overhead.
>
> Tests:
>     lzx> bar
>     ERROR @interactive-eval-2#-1: reference to undefined variable 'bar'
>     lzx> global.bar
>     WARNING @interactive-eval-3: reference to undefined property 'bar'
>     lzx> global.bar = void 0
>     lzx> global.bar
>     lzx> global.bar=42
>     42
>     lzx> global.bar
>     42
>     lzx>
>
> Files:
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
>
>
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/20090421-ptw-R.tar
>


More information about the Laszlo-dev mailing list