[Webkit-unassigned] [Bug 38644] New: Optimize access to the global object from a function that uses eval

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 6 07:10:32 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=38644

           Summary: Optimize access to the global object from a function
                    that uses eval
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: kent.hansen at nokia.com


The insertion of eval in the following script causes a slowdown of ~4x:

a = 123;
(function() {
  var i;
  eval("1");
  for (i = 0; i < 100000; ++i) {
    a; a; a; a; a; a;
  }
})();

Similarly for the following script:

a = 123;
(function() {
  eval("1");
  (function() {
    for (var i = 0; i < 100000; ++i) {
      a; a; a; a; a; a; a; a;
    }
  })();
})();

It would be nice if the eval didn't hurt performance so much.
The optimization should of course not break scripts like the following:

a = 2;
(function(code) {
  eval(code);
  return a + a;
})("var a = 4"); // must return 8, not 4

Or like the following:

a = 2;
print((function() {
  eval("var a = 4");
  return function() {
    return a + a;
  }();
})()); // must return 8, not 4

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list