Changeset 80179 in webkit


Ignore:
Timestamp:
Mar 2, 2011 4:00:17 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-03-02 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

Remove "register slot" concept from PropertySlot
https://bugs.webkit.org/show_bug.cgi?id=55621

PropertySlot had already stopped storing Register "slots"
so this patch is simply removing that api entirely.
This exposed a problem in the ProgramNode constructor for
BytecodeGenerator where it reads from the registerfile
before it has initialised it.

This bug wasn't a problem before as we were merely testing
for property existence rather than the actual value, and
used to work because setRegisterSlot didn't check that the
provided slot contained an initialised value.

To get around this issue we now use symbolTableHasProperty
to do the symbol table check without trying to read the
RegisterFile.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator):
  • runtime/Arguments.cpp: (JSC::Arguments::getOwnPropertySlot):
  • runtime/JSActivation.cpp: (JSC::JSActivation::symbolTableGet):
  • runtime/JSGlobalObject.h: (JSC::JSGlobalObject::symbolTableHasProperty):
  • runtime/JSVariableObject.h: (JSC::JSVariableObject::symbolTableGet):
  • runtime/PropertySlot.h:
Location:
trunk/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r80166 r80179  
     12011-03-02  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Remove "register slot" concept from PropertySlot
     6        https://bugs.webkit.org/show_bug.cgi?id=55621
     7
     8        PropertySlot had already stopped storing Register "slots"
     9        so this patch is simply removing that api entirely.
     10        This exposed a problem in the ProgramNode constructor for
     11        BytecodeGenerator where it reads from the registerfile
     12        before it has initialised it.
     13
     14        This bug wasn't a problem before as we were merely testing
     15        for property existence rather than the actual value, and
     16        used to work because setRegisterSlot didn't check that the
     17        provided slot contained an initialised value.
     18
     19        To get around this issue we now use symbolTableHasProperty
     20        to do the symbol table check without trying to read the
     21        RegisterFile.
     22
     23        * JavaScriptCore.xcodeproj/project.pbxproj:
     24        * bytecompiler/BytecodeGenerator.cpp:
     25        (JSC::BytecodeGenerator::BytecodeGenerator):
     26        * runtime/Arguments.cpp:
     27        (JSC::Arguments::getOwnPropertySlot):
     28        * runtime/JSActivation.cpp:
     29        (JSC::JSActivation::symbolTableGet):
     30        * runtime/JSGlobalObject.h:
     31        (JSC::JSGlobalObject::symbolTableHasProperty):
     32        * runtime/JSVariableObject.h:
     33        (JSC::JSVariableObject::symbolTableGet):
     34        * runtime/PropertySlot.h:
     35
    1362011-03-02  Daniel Cheng  <dcheng@chromium.org>
    237
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r80052 r80179  
    25402540                        buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
    25412541                        compatibilityVersion = "Xcode 3.1";
     2542                        developmentRegion = English;
    25422543                        hasScannedForEncodings = 1;
    25432544                        knownRegions = (
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r79904 r80179  
    271271        Vector<RegisterID*, 32> newVars;
    272272        for (size_t i = 0; i < varStack.size(); ++i) {
    273             if (!globalObject->hasProperty(exec, *varStack[i].first))
    274                 newVars.append(addGlobalVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant));
     273            if (globalObject->symbolTableHasProperty(*varStack[i].first) || globalObject->hasProperty(exec, *varStack[i].first))
     274                continue;
     275            newVars.append(addGlobalVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant));
    275276        }
    276277
     
    287288        }
    288289        for (size_t i = 0; i < varStack.size(); ++i) {
    289             if (globalObject->hasProperty(exec, *varStack[i].first))
     290            if (globalObject->symbolTableHasProperty(*varStack[i].first) || globalObject->hasProperty(exec, *varStack[i].first))
    290291                continue;
    291292            int attributes = DontDelete;
  • trunk/Source/JavaScriptCore/runtime/Arguments.cpp

    r79132 r80179  
    146146    if (i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
    147147        if (i < d->numParameters) {
    148             slot.setRegisterSlot(&d->registers[d->firstParameterIndex + i]);
     148            slot.setValue(d->registers[d->firstParameterIndex + i].jsValue());
    149149        } else
    150150            slot.setValue(d->extraArguments[i - d->numParameters].jsValue());
     
    185185    if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
    186186        if (i < d->numParameters) {
    187             slot.setRegisterSlot(&d->registers[d->firstParameterIndex + i]);
     187            slot.setValue(d->registers[d->firstParameterIndex + i].jsValue());
    188188        } else
    189189            slot.setValue(d->extraArguments[i - d->numParameters].jsValue());
  • trunk/Source/JavaScriptCore/runtime/JSActivation.cpp

    r79240 r80179  
    7676    if (!entry.isNull()) {
    7777        ASSERT(entry.getIndex() < static_cast<int>(d()->functionExecutable->capturedVariableCount()));
    78         slot.setRegisterSlot(&registerAt(entry.getIndex()));
     78        slot.setValue(registerAt(entry.getIndex()).jsValue());
    7979        return true;
    8080    }
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r79904 r80179  
    178178        virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes);
    179179
     180        // We use this in the code generator as we perform symbol table
     181        // lookups prior to initializing the properties
     182        bool symbolTableHasProperty(const Identifier& propertyName);
     183
    180184        // The following accessors return pristine values, even if a script
    181185        // replaces the global object's associated property.
     
    352356    }
    353357
     358    inline bool JSGlobalObject::symbolTableHasProperty(const Identifier& propertyName)
     359    {
     360        SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
     361        return !entry.isNull();
     362    }
     363
    354364    inline JSValue Structure::prototypeForLookup(ExecState* exec) const
    355365    {
  • trunk/Source/JavaScriptCore/runtime/JSVariableObject.h

    r79132 r80179  
    106106        SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
    107107        if (!entry.isNull()) {
    108             slot.setRegisterSlot(&registerAt(entry.getIndex()));
     108            slot.setValue(registerAt(entry.getIndex()).jsValue());
    109109            return true;
    110110        }
     
    116116        SymbolTableEntry entry = symbolTable().inlineGet(propertyName.impl());
    117117        if (!entry.isNull()) {
    118             slot.setRegisterSlot(&registerAt(entry.getIndex()));
     118            slot.setValue(registerAt(entry.getIndex()).jsValue());
    119119            slotIsWriteable = !entry.isReadOnly();
    120120            return true;
  • trunk/Source/JavaScriptCore/runtime/PropertySlot.h

    r77269 r80179  
    124124        }
    125125
    126         void setRegisterSlot(Register* registerSlot)
    127         {
    128             ASSERT(registerSlot);
    129             clearBase();
    130             clearOffset();
    131             m_getValue = JSC_VALUE_MARKER;
    132             m_value = registerSlot->jsValue();
    133         }
    134 
    135126        void setCustom(JSValue slotBase, GetValueFunc getValue)
    136127        {
Note: See TracChangeset for help on using the changeset viewer.