Ignore:
Timestamp:
May 7, 2010, 8:19:14 PM (15 years ago)
Author:
[email protected]
Message:

Optimize access to the global object from a function that uses eval
https://bugs.webkit.org/show_bug.cgi?id=38644

Reviewed by Gavin Barraclough.

JavaScriptCore:

Fix bug where cross scope access to a global var (vs. property) would
be allowed without checking for intervening dynamic scopes.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitResolve):

LayoutTests:

Add test case to ensure we don't incorrectly allow dynamic scopes
to be skipped when doing direct var access.

  • fast/js/global-resolve-through-eval-expected.txt: Added.
  • fast/js/global-resolve-through-eval.html: Added.
  • fast/js/script-tests/global-resolve-through-eval.js: Added.

(accessGlobal):
(accessLocal):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r58986 r58993  
    10831083        }
    10841084
    1085         if (index != missingSymbolMarker() && !forceGlobalResolve) {
     1085        if (index != missingSymbolMarker() && !forceGlobalResolve && !requiresDynamicChecks) {
    10861086            // Directly index the property lookup across multiple scopes.
    10871087            return emitGetScopedVar(dst, depth, index, globalObject);
Note: See TracChangeset for help on using the changeset viewer.