Ignore:
Timestamp:
Jul 25, 2008, 8:52:24 PM (17 years ago)
Author:
[email protected]
Message:

Bug 19718: Named anonymous functions are slow accessing global variables
<https://bugs.webkit.org/show_bug.cgi?id=19718>

Reviewed by Cameron Zwarich.

To fix this we switch over to an activation-like scope object for
on which we attach the function name property, and add logic to
prevent cross scope assignment to read only properties.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeGenerator.cpp

    r35309 r35368  
    623623}
    624624
    625 bool CodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth)
     625bool CodeGenerator::findScopedProperty(const Identifier& property, int& index, size_t& stackDepth, bool forWriting)
    626626{
    627627    // Cases where we cannot optimise the lookup
     
    645645        // Found the property
    646646        if (!entry.isNull()) {
     647            if (entry.isReadOnly() && forWriting) {
     648                stackDepth = 0;
     649                index = missingSymbolMarker();
     650                return false;
     651            }
    647652            stackDepth = depth;
    648653            index = entry.getIndex();
     
    663668    size_t depth = 0;
    664669    int index = 0;
    665     if (!findScopedProperty(property, index, depth)) {
     670    if (!findScopedProperty(property, index, depth, false)) {
    666671        // We can't optimise at all :-(
    667672        emitOpcode(op_resolve);
Note: See TracChangeset for help on using the changeset viewer.