Ignore:
Timestamp:
Mar 5, 2012, 5:18:42 PM (13 years ago)
Author:
[email protected]
Message:

putByIndex should throw in strict mode
https://bugs.webkit.org/show_bug.cgi?id=80335

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

We'll need to pass an additional parameter.

Part 1 - rename JSValue::put() for integer indices to JSValue::putByIndex()
to match the method in the MethodTable, make this take a parameter indicating
whether the put should throw. This fixes the cases where the base of the put
is a primitive.

  • dfg/DFGOperations.cpp:

(DFG):
(JSC::DFG::putByVal):
(JSC::DFG::operationPutByValInternal):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):
(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/JSObject.h:

(JSC::JSValue::putByIndex):

  • runtime/JSValue.cpp:

(JSC):

  • runtime/JSValue.h:

(JSValue):

LayoutTests:

  • fast/js/primitive-property-access-edge-cases-expected.txt:
  • fast/js/script-tests/primitive-property-access-edge-cases.js:

(checkNumericGet.Object.defineProperty):
(checkNumericSet.Object.defineProperty):
(checkNumericGetStrict.Object.defineProperty):
(checkNumericSetStrict.Object.defineProperty):
(checkNumericRead):
(checkNumericWrite):
(checkNumericReadStrict):
(checkNumericWriteStrict):

  • Added test cases.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r109172 r109824  
    147147namespace JSC { namespace DFG {
    148148
     149template<bool strict>
    149150static inline void putByVal(ExecState* exec, JSValue baseValue, uint32_t index, JSValue value)
    150151{
     
    176177    }
    177178
    178     baseValue.put(exec, index, value);
     179    baseValue.putByIndex(exec, index, value, strict);
    179180}
    180181
     
    190191
    191192    if (LIKELY(property.isUInt32())) {
    192         putByVal(exec, baseValue, property.asUInt32(), value);
     193        putByVal<strict>(exec, baseValue, property.asUInt32(), value);
    193194        return;
    194195    }
     
    198199        uint32_t propertyAsUInt32 = static_cast<uint32_t>(propertyAsDouble);
    199200        if (propertyAsDouble == propertyAsUInt32) {
    200             putByVal(exec, baseValue, propertyAsUInt32, value);
     201            putByVal<strict>(exec, baseValue, propertyAsUInt32, value);
    201202            return;
    202203        }
Note: See TracChangeset for help on using the changeset viewer.