Status: New
Owner: ----

New issue 3866 by [email protected]: Odd Object.keys results from JIT-compiled functions
https://code.google.com/p/v8/issues/detail?id=3866

Hi - I'm seeing some weird results when combining es5-shim.js with highcharts.js, which I narrowed down to the following :

function optionsToObject (options) {
        var ret = {};
    ret.x = options[0];
    ret.y = options[1];
        return ret;
}

for(var i=0; i<10000; i++) {
    console.log("running...");

    var point=optionsToObject([11978120,9871238970]);

    // loop over the properties in the point and check that
    // it has a property 'x'
    var foundX=Object.keys(point).some(function (v) { return v === 'x'; });

    if (!foundX){
       console.log(point, "only has keys:", Object.keys(point))
      throw("'x' doesn't appear in the return value");
    }
}

(Also available via jsfiddle: http://jsfiddle.net/ukv6rdj4/3/)


Calling optionsToObject() returns a point value along the lines of {x:1,y:2}, which has keys of ['x','y'] according to Object.keys. However, after a certain number of iterations, it will start returning a very similar looking object, where point.x is still valid, yet Object.keys(point) returns just ['y']. The number of iterations varies, but is usually around 130 for me.

I can only reproduce the problem if I include es5-shim.js (https://github.com/es-shims/es5-shim). I haven't tried narrowing it down to a specific part of es5-shim.js, but have also filed an issue there - https://github.com/es-shims/es5-shim/issues/291#issuecomment-72907299.

I see this in Chrome 40.0.2214.94, but not in Canary (42.0.2294.0). Possibly that means it's fixed, but I couldn't find a existing bug report so thought I should file one. Any guesses what might cause this?

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to