Changeset 47404 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Aug 17, 2009, 6:00:12 PM (16 years ago)
Author:
[email protected]
Message:

REGRESSION (r47292): Prototype.js is broken by ES5 Arguments changes
https://bugs.webkit.org/show_bug.cgi?id=28341
<rdar://problem/7145615>

RS=Mark Rowe

Reverting r47292. Alas Prototype.js breaks with Arguments inheriting
from Array as ES5 attempted. Prototype.js defines $A in terms of a
function it places on (among other global objects) the Array prototype,
thus breaking $A for arrays.

Location:
trunk/JavaScriptCore/runtime
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Arguments.h

    r47330 r47404  
    101101
    102102        void init(CallFrame*);
    103         void initializeStandardProperties(CallFrame*);
    104103
    105104        OwnPtr<ArgumentsData> d;
     
    135134        , d(new ArgumentsData)
    136135    {
    137         initializeStandardProperties(callFrame);
    138136        JSFunction* callee;
    139137        ptrdiff_t firstParameterIndex;
     
    174172    {
    175173        ASSERT(!callFrame->callee()->body()->parameterCount());
    176        
    177         initializeStandardProperties(callFrame);
     174
    178175        unsigned numArguments = callFrame->argumentCount() - 1;
    179176
     
    243240    }
    244241   
    245    
    246     inline void Arguments::initializeStandardProperties(CallFrame* callFrame)
    247     {
    248         putDirectFunction(callFrame->propertyNames().constructor, callFrame->lexicalGlobalObject()->objectConstructor(), DontEnum);
    249         putDirectFunction(callFrame->propertyNames().toString, callFrame->lexicalGlobalObject()->objectToStringFunction(), DontEnum);
    250         putDirectFunction(callFrame->propertyNames().toLocaleString, callFrame->lexicalGlobalObject()->objectToLocaleStringFunction(), DontEnum);
    251     }
    252242
    253243} // namespace JSC
  • trunk/JavaScriptCore/runtime/JSGlobalObject.cpp

    r47304 r47404  
    211211    d()->callFunction = callFunction;
    212212    d()->applyFunction = applyFunction;
    213     NativeFunctionWrapper* objectToStringFunction = 0;
    214     NativeFunctionWrapper* objectToLocaleStringFunction = 0;
    215     d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get(), &objectToStringFunction, &objectToLocaleStringFunction);
    216     d()->objectToStringFunction = objectToStringFunction;
    217     d()->objectToLocaleStringFunction = objectToLocaleStringFunction;
     213    d()->objectPrototype = new (exec) ObjectPrototype(exec, ObjectPrototype::createStructure(jsNull()), d()->prototypeFunctionStructure.get());
    218214    d()->functionPrototype->structure()->setPrototypeWithoutTransition(d()->objectPrototype);
    219215
     
    222218    d()->functionStructure = JSFunction::createStructure(d()->functionPrototype);
    223219    d()->callbackFunctionStructure = JSCallbackFunction::createStructure(d()->functionPrototype);
     220    d()->argumentsStructure = Arguments::createStructure(d()->objectPrototype);
    224221    d()->callbackConstructorStructure = JSCallbackConstructor::createStructure(d()->objectPrototype);
    225222    d()->callbackObjectStructure = JSCallbackObject<JSObject>::createStructure(d()->objectPrototype);
    226223
    227224    d()->arrayPrototype = new (exec) ArrayPrototype(ArrayPrototype::createStructure(d()->objectPrototype));
    228     d()->argumentsStructure = Arguments::createStructure(d()->arrayPrototype);
    229225    d()->arrayStructure = JSArray::createStructure(d()->arrayPrototype);
    230226    d()->regExpMatchesArrayStructure = RegExpMatchesArray::createStructure(d()->arrayPrototype);
     
    261257    // Constructors
    262258
    263     ObjectConstructor* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());
     259    JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get());
    264260    JSCell* functionConstructor = new (exec) FunctionConstructor(exec, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype);
    265261    JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get());
     
    275271    RefPtr<Structure> nativeErrorStructure = NativeErrorConstructor::createStructure(d()->functionPrototype);
    276272
    277     d()->objectConstructor = objectConstructor;
    278273    d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, evalErrorPrototype);
    279274    d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, nativeErrorStructure, rangeErrorPrototype);
     
    374369    if (registerFile.globalObject() == this)
    375370        registerFile.markGlobals(markStack, &globalData()->heap);
    376    
    377     markIfNeeded(markStack, d()->objectConstructor);
     371
    378372    markIfNeeded(markStack, d()->regExpConstructor);
    379373    markIfNeeded(markStack, d()->errorConstructor);
     
    388382    markIfNeeded(markStack, d()->callFunction);
    389383    markIfNeeded(markStack, d()->applyFunction);
    390     markIfNeeded(markStack, d()->objectToStringFunction);
    391     markIfNeeded(markStack, d()->objectToLocaleStringFunction);
    392384
    393385    markIfNeeded(markStack, d()->objectPrototype);
  • trunk/JavaScriptCore/runtime/JSGlobalObject.h

    r47304 r47404  
    3939    class ErrorConstructor;
    4040    class FunctionPrototype;
     41    class GlobalCodeBlock;
    4142    class GlobalEvalFunction;
    4243    class NativeErrorConstructor;
    43     class GlobalCodeBlock;
    44     class ObjectConstructor;
     44    class ProgramCodeBlock;
    4545    class PrototypeFunction;
    4646    class RegExpConstructor;
     
    6262                , registerArraySize(0)
    6363                , globalScopeChain(NoScopeChain())
    64                 , objectConstructor(0)
    6564                , regExpConstructor(0)
    6665                , errorConstructor(0)
     
    7473                , callFunction(0)
    7574                , applyFunction(0)
    76                 , objectToStringFunction(0)
    77                 , objectToLocaleStringFunction(0)
    7875                , objectPrototype(0)
    7976                , functionPrototype(0)
     
    104101            int recursion;
    105102
    106             ObjectConstructor* objectConstructor;
    107103            RegExpConstructor* regExpConstructor;
    108104            ErrorConstructor* errorConstructor;
     
    117113            NativeFunctionWrapper* callFunction;
    118114            NativeFunctionWrapper* applyFunction;
    119             NativeFunctionWrapper* objectToStringFunction;
    120             NativeFunctionWrapper* objectToLocaleStringFunction;
    121115
    122116            ObjectPrototype* objectPrototype;
     
    191185        // replaces the global object's associated property.
    192186
    193         ObjectConstructor* objectConstructor() const { return d()->objectConstructor; }
    194187        RegExpConstructor* regExpConstructor() const { return d()->regExpConstructor; }
    195188
     
    212205        DatePrototype* datePrototype() const { return d()->datePrototype; }
    213206        RegExpPrototype* regExpPrototype() const { return d()->regExpPrototype; }
    214 
    215         NativeFunctionWrapper* objectToStringFunction() const { return d()->objectToStringFunction; }
    216         NativeFunctionWrapper* objectToLocaleStringFunction() const { return d()->objectToLocaleStringFunction; }
    217207
    218208        JSObject* methodCallDummy() const { return d()->methodCallDummy; }
  • trunk/JavaScriptCore/runtime/ObjectPrototype.cpp

    r47292 r47404  
    4141static JSValue JSC_HOST_CALL objectProtoFuncToLocaleString(ExecState*, JSObject*, JSValue, const ArgList&);
    4242
    43 ObjectPrototype::ObjectPrototype(ExecState* exec, PassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure, NativeFunctionWrapper** toStringFunction, NativeFunctionWrapper** toLocaleStringFunction)
     43ObjectPrototype::ObjectPrototype(ExecState* exec, PassRefPtr<Structure> stucture, Structure* prototypeFunctionStructure)
    4444    : JSObject(stucture)
    4545{
    46     NativeFunctionWrapper* toString = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString);
    47     NativeFunctionWrapper* toLocaleString = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString);
    48     *toStringFunction = toString;
    49     *toLocaleStringFunction = toLocaleString;
    50     putDirectFunctionWithoutTransition(exec, toString, DontEnum);
    51     putDirectFunctionWithoutTransition(exec, toLocaleString, DontEnum);
     46    putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);
     47    putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);
    5248    putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);
    5349    putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);
  • trunk/JavaScriptCore/runtime/ObjectPrototype.h

    r47292 r47404  
    2828    class ObjectPrototype : public JSObject {
    2929    public:
    30         ObjectPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure, NativeFunctionWrapper** toStringFunction, NativeFunctionWrapper** toLocaleStringFunction);
     30        ObjectPrototype(ExecState*, PassRefPtr<Structure>, Structure* prototypeFunctionStructure);
    3131    };
    3232
Note: See TracChangeset for help on using the changeset viewer.