- Source/JavaScriptCore/ChangeLog +19 lines
Lines 1-3 Source/JavaScriptCore/ChangeLog_sec1
1
2015-09-10  Filip Pizlo  <fpizlo@apple.com>
2
3
        Structure should be able to tell you if it had ever been a dictionary
4
        https://bugs.webkit.org/show_bug.cgi?id=149047
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Introduces the hasBeenDictionary flag to Structure, which tells you if this structure or
9
        any of its ancestors is a dictionary. We already implicitly tracked this for DFG
10
        watchpoint optimizations, so this is mainly just decoupling that existing logic from
11
        watchpoints. Having Structure::hasBeenDictionary() enables some of the heuristics in the
12
        property type inference work (https://bugs.webkit.org/show_bug.cgi?id=148610).
13
14
        * runtime/Structure.cpp:
15
        (JSC::Structure::Structure):
16
        (JSC::Structure::toDictionaryTransition):
17
        (JSC::Structure::dump):
18
        * runtime/Structure.h:
19
1
2015-09-10  Yusuke Suzuki  <utatane.tea@gmail.com>
20
2015-09-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2
21
3
        Unreviewed, fix Windows file loading in JSC shell after r189583
22
        Unreviewed, fix Windows file loading in JSC shell after r189583
- Source/JavaScriptCore/runtime/Structure.cpp -1 / +11 lines
Lines 208-213 Structure::Structure(VM& vm, JSGlobalObj Source/JavaScriptCore/runtime/Structure.cpp_sec1
208
    setStaticFunctionsReified(false);
208
    setStaticFunctionsReified(false);
209
    setHasRareData(false);
209
    setHasRareData(false);
210
    setTransitionWatchpointIsLikelyToBeFired(false);
210
    setTransitionWatchpointIsLikelyToBeFired(false);
211
    setHasBeenDictionary(false);
211
 
212
 
212
    ASSERT(inlineCapacity <= JSFinalObject::maxInlineCapacity());
213
    ASSERT(inlineCapacity <= JSFinalObject::maxInlineCapacity());
213
    ASSERT(static_cast<PropertyOffset>(inlineCapacity) < firstOutOfLineOffset);
214
    ASSERT(static_cast<PropertyOffset>(inlineCapacity) < firstOutOfLineOffset);
Lines 239-244 Structure::Structure(VM& vm) Source/JavaScriptCore/runtime/Structure.cpp_sec2
239
    setStaticFunctionsReified(false);
240
    setStaticFunctionsReified(false);
240
    setHasRareData(false);
241
    setHasRareData(false);
241
    setTransitionWatchpointIsLikelyToBeFired(false);
242
    setTransitionWatchpointIsLikelyToBeFired(false);
243
    setHasBeenDictionary(false);
242
 
244
 
243
    TypeInfo typeInfo = TypeInfo(CellType, StructureFlags);
245
    TypeInfo typeInfo = TypeInfo(CellType, StructureFlags);
244
    m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), 0, typeInfo);
246
    m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), 0, typeInfo);
Lines 268-273 Structure::Structure(VM& vm, Structure* Source/JavaScriptCore/runtime/Structure.cpp_sec3
268
    setDidTransition(true);
270
    setDidTransition(true);
269
    setStaticFunctionsReified(previous->staticFunctionsReified());
271
    setStaticFunctionsReified(previous->staticFunctionsReified());
270
    setHasRareData(false);
272
    setHasRareData(false);
273
    setHasBeenDictionary(previous->hasBeenDictionary());
271
 
274
 
272
    TypeInfo typeInfo = previous->typeInfo();
275
    TypeInfo typeInfo = previous->typeInfo();
273
    m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), previous->indexingTypeIncludingHistory(), typeInfo);
276
    m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), previous->indexingTypeIncludingHistory(), typeInfo);
Lines 537-543 Structure* Structure::toDictionaryTransi Source/JavaScriptCore/runtime/Structure.cpp_sec4
537
    transition->m_offset = structure->m_offset;
540
    transition->m_offset = structure->m_offset;
538
    transition->setDictionaryKind(kind);
541
    transition->setDictionaryKind(kind);
539
    transition->pin();
542
    transition->pin();
540
    transition->setTransitionWatchpointIsLikelyToBeFired(true);
543
    transition->setHasBeenDictionary(true);
541
544
542
    transition->checkOffsetConsistency();
545
    transition->checkOffsetConsistency();
543
    return transition;
546
    return transition;
Lines 1156-1161 void Structure::dump(PrintStream& out) c Source/JavaScriptCore/runtime/Structure.cpp_sec5
1156
1159
1157
    switch (dictionaryKind()) {
1160
    switch (dictionaryKind()) {
1158
    case NoneDictionaryKind:
1161
    case NoneDictionaryKind:
1162
        if (hasBeenDictionary())
1163
            out.print(", Has been dictionary");
1159
        break;
1164
        break;
1160
    case CachedDictionaryKind:
1165
    case CachedDictionaryKind:
1161
        out.print(", Dictionary");
1166
        out.print(", Dictionary");
Lines 1164-1169 void Structure::dump(PrintStream& out) c Source/JavaScriptCore/runtime/Structure.cpp_sec6
1164
        out.print(", UncacheableDictionary");
1169
        out.print(", UncacheableDictionary");
1165
        break;
1170
        break;
1166
    }
1171
    }
1172
1173
    if (transitionWatchpointSetIsStillValid())
1174
        out.print(", Leaf");
1175
    else if (transitionWatchpointIsLikelyToBeFired())
1176
        out.print(", Shady leaf");
1167
    
1177
    
1168
    out.print("]");
1178
    out.print("]");
1169
}
1179
}
- Source/JavaScriptCore/runtime/Structure.h -1 / +6 lines
Lines 429-437 public: Source/JavaScriptCore/runtime/Structure.h_sec1
429
        
429
        
430
        // - We don't watch Structures that either decided not to be watched, or whose predecessors
430
        // - We don't watch Structures that either decided not to be watched, or whose predecessors
431
        //   decided not to be watched. This happens either when a transition is fired while being
431
        //   decided not to be watched. This happens either when a transition is fired while being
432
        //   watched, or if a dictionary transition occurs.
432
        //   watched.
433
        if (transitionWatchpointIsLikelyToBeFired())
433
        if (transitionWatchpointIsLikelyToBeFired())
434
            return false;
434
            return false;
435
436
        // - Don't watch Structures that had been dictionaries.
437
        if (hasBeenDictionary())
438
            return false;
435
        
439
        
436
        return true;
440
        return true;
437
    }
441
    }
Lines 523-528 public: Source/JavaScriptCore/runtime/Structure.h_sec2
523
    DEFINE_BITFIELD(bool, hasCustomGetterSetterProperties, HasCustomGetterSetterProperties, 1, 25);
527
    DEFINE_BITFIELD(bool, hasCustomGetterSetterProperties, HasCustomGetterSetterProperties, 1, 25);
524
    DEFINE_BITFIELD(bool, didWatchInternalProperties, DidWatchInternalProperties, 1, 26);
528
    DEFINE_BITFIELD(bool, didWatchInternalProperties, DidWatchInternalProperties, 1, 26);
525
    DEFINE_BITFIELD(bool, transitionWatchpointIsLikelyToBeFired, TransitionWatchpointIsLikelyToBeFired, 1, 27);
529
    DEFINE_BITFIELD(bool, transitionWatchpointIsLikelyToBeFired, TransitionWatchpointIsLikelyToBeFired, 1, 27);
530
    DEFINE_BITFIELD(bool, hasBeenDictionary, HasBeenDictionary, 1, 28);
526
531
527
private:
532
private:
528
    friend class LLIntOffsetsExtractor;
533
    friend class LLIntOffsetsExtractor;

Return to Bug 149047