Ignore:
Timestamp:
Aug 16, 2013, 12:15:31 PM (12 years ago)
Author:
[email protected]
Message:

Object properties added using dot syntax (o.f = ...) from code that isn't in eval should be less likely to cause an object to become a dictionary
https://bugs.webkit.org/show_bug.cgi?id=119897

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

6-10x speed-up on microbenchmarks that create large static objects. 40-65% speed-up
on Octane/gbemu. 3% overall speed-up on Octane. No slow-downs anywhere; our ability
to turn objects into dictionaries when you're storing using bracket syntax or using
eval is still in place.

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::putByIdContext):

  • dfg/DFGOperations.cpp:
  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/JSObject.h:

(JSC::JSObject::putDirectInternal):

  • runtime/PutPropertySlot.h:

(JSC::PutPropertySlot::PutPropertySlot):
(JSC::PutPropertySlot::context):

  • runtime/Structure.cpp:

(JSC::Structure::addPropertyTransition):

  • runtime/Structure.h:

LayoutTests:

Reviewed by Oliver Hunt.

  • fast/js/regress/lots-of-fields-expected.txt: Added.
  • fast/js/regress/lots-of-fields.html: Added.
  • fast/js/regress/script-tests/lots-of-fields.js: Added.

(foo):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r154038 r154199  
    381381}
    382382
    383 Structure* Structure::addPropertyTransition(VM& vm, Structure* structure, PropertyName propertyName, unsigned attributes, JSCell* specificValue, PropertyOffset& offset)
     383Structure* Structure::addPropertyTransition(VM& vm, Structure* structure, PropertyName propertyName, unsigned attributes, JSCell* specificValue, PropertyOffset& offset, PutPropertySlot::Context context)
    384384{
    385385    // If we have a specific function, we may have got to this point if there is
     
    400400        specificValue = 0;
    401401
    402     if (structure->transitionCount() > s_maxTransitionLength) {
     402    int maxTransitionLength;
     403    if (context == PutPropertySlot::PutById)
     404        maxTransitionLength = s_maxTransitionLengthForNonEvalPutById;
     405    else
     406        maxTransitionLength = s_maxTransitionLength;
     407    if (structure->transitionCount() > maxTransitionLength) {
    403408        Structure* transition = toCacheableDictionaryTransition(vm, structure);
    404409        ASSERT(structure != transition);
Note: See TracChangeset for help on using the changeset viewer.