Ignore:
Timestamp:
Aug 31, 2012, 6:50:13 PM (13 years ago)
Author:
[email protected]
Message:

JSArray::putDirectIndex should by default behave like JSObject::putDirect
https://bugs.webkit.org/show_bug.cgi?id=95630

Reviewed by Gavin Barraclough.

Source/JavaScriptCore:

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jsc.cpp:

(GlobalObject::finishCreation):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/JSArray.cpp:

(JSC::SparseArrayValueMap::putDirect):
(JSC::JSArray::defineOwnNumericProperty):
(JSC::JSArray::putDirectIndexBeyondVectorLength):

  • runtime/JSArray.h:

(SparseArrayValueMap):
(JSArray):
(JSC::JSArray::putDirectIndex):

  • runtime/JSONObject.cpp:

(JSC::Walker::walk):

  • runtime/RegExpMatchesArray.cpp:

(JSC::RegExpMatchesArray::reifyAllProperties):
(JSC::RegExpMatchesArray::reifyMatchProperty):

  • runtime/StringPrototype.cpp:

(JSC::splitStringByOneCharacterImpl):
(JSC::stringProtoFuncSplit):

Source/WebCore:

No new tests because no change in behavior.

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneDeserializer::putProperty):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSArray.h

    r127210 r127349  
    3131    class LLIntOffsetsExtractor;
    3232
     33    enum PutDirectIndexMode { PutDirectIndexLikePutDirect, PutDirectIndexShouldNotThrow, PutDirectIndexShouldThrow };
     34
    3335    struct SparseArrayEntry : public WriteBarrier<Unknown> {
    3436        typedef WriteBarrier<Unknown> Base;
     
    8890        // These methods may mutate the contents of the map
    8991        void put(ExecState*, JSArray*, unsigned, JSValue, bool shouldThrow);
    90         bool putDirect(ExecState*, JSArray*, unsigned, JSValue, bool shouldThrow);
     92        bool putDirect(ExecState*, JSArray*, unsigned, JSValue, PutDirectIndexMode);
    9193        AddResult add(JSArray*, unsigned);
    9294        iterator find(unsigned i) { return m_map.find(i); }
     
    174176        //  - the prototype chain is not consulted
    175177        //  - accessors are not called.
     178        //  - it will ignore extensibility and read-only properties if PutDirectIndexLikePutDirect is passed as the mode (the default).
    176179        // This method creates a property with attributes writable, enumerable and configurable all set to true.
    177         bool putDirectIndex(ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow = true)
     180        bool putDirectIndex(ExecState* exec, unsigned propertyName, JSValue value, PutDirectIndexMode mode = PutDirectIndexLikePutDirect)
    178181        {
    179182            if (canSetIndex(propertyName)) {
     
    181184                return true;
    182185            }
    183             return putDirectIndexBeyondVectorLength(exec, propertyName, value, shouldThrow);
     186            return putDirectIndexBeyondVectorLength(exec, propertyName, value, mode);
    184187        }
    185188
     
    303306
    304307        void putByIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
    305         JS_EXPORT_PRIVATE bool putDirectIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
     308        JS_EXPORT_PRIVATE bool putDirectIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, PutDirectIndexMode);
    306309
    307310        unsigned getNewVectorLength(unsigned desiredLength);
Note: See TracChangeset for help on using the changeset viewer.