Ignore:
Timestamp:
Jan 12, 2012, 5:40:22 PM (13 years ago)
Author:
[email protected]
Message:

Clean up putDirect (part 1)
https://bugs.webkit.org/show_bug.cgi?id=76232

Reviewed by Sam Weinig.

putDirect has ambiguous semantics, clean these up a bit.

putDirect generally behaves a bit like a fast defineOwnProperty, but one that
always creates the property, with no checking to validate the put it permitted.

It also encompasses two slightly different behaviors.
(1) a fast form of put for JSActivation, which doesn't have to handle searching

the prototype chain, getter/setter properties, or the magic proto value.
Break this out as a new method, 'putOwnDataProperty'.

(2) the version of putDirect on JSValue will also check for overwriting ReadOnly

values, in strict mode. This is, however, not so smart on a few level, since
it is only called from op_put_by_id with direct set, which is only used with
an object as the base, and is only used to put new properties onto objects.

  • dfg/DFGOperations.cpp:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/JSActivation.cpp:

(JSC::JSActivation::put):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::getOwnPropertySlot):

  • runtime/JSObject.h:

(JSC::JSObject::putOwnDataProperty):

  • runtime/JSValue.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r104630 r104886  
    33093309
    33103310        JSValue baseValue = callFrame->r(base).jsValue();
     3311        ASSERT(baseValue.isObject());
     3312        JSObject* baseObject = asObject(baseValue);
    33113313        Identifier& ident = codeBlock->identifier(property);
    33123314        PutPropertySlot slot(codeBlock->isStrictMode());
    33133315        if (direct)
    3314             baseValue.putDirect(callFrame, ident, callFrame->r(value).jsValue(), slot);
     3316            baseObject->putDirect(*globalData, ident, callFrame->r(value).jsValue(), slot);
    33153317        else
    33163318            baseValue.put(callFrame, ident, callFrame->r(value).jsValue(), slot);
     
    34273429
    34283430        JSValue baseValue = callFrame->r(base).jsValue();
     3431        ASSERT(baseValue.isObject());
     3432        JSObject* baseObject = asObject(baseValue);
    34293433        Identifier& ident = codeBlock->identifier(property);
    34303434        PutPropertySlot slot(codeBlock->isStrictMode());
    34313435        if (direct)
    3432             baseValue.putDirect(callFrame, ident, callFrame->r(value).jsValue(), slot);
     3436            baseObject->putDirect(*globalData, ident, callFrame->r(value).jsValue(), slot);
    34333437        else
    34343438            baseValue.put(callFrame, ident, callFrame->r(value).jsValue(), slot);
Note: See TracChangeset for help on using the changeset viewer.