Changeset 252256 in webkit


Ignore:
Timestamp:
Nov 8, 2019 1:11:25 PM (5 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Use LinkTimeConstants and make some properties lazy
https://bugs.webkit.org/show_bug.cgi?id=203795

Reviewed by Keith Miller.

This patch makes Map and Set lazily initialized in JSGlobalObject by leveraging link-time-constant. @Set was accessed from
builtin-JS. So we cannot make it lazily-allocated. But now we have link-time-constant mechanism that makes such accesses
lazily-initialized. We use this to make Set lazily-allocated.

And, instead of JSGlobalObject's last sequence of initialization, we initialize watchpoint in MapPrototype::finishCreation
and SetPrototype::finishCreation. This allows us to make Map and Set lazily-allocated. We also refactor NumberPrototype to
align to this model.

  • runtime/ArrayPrototype.cpp:

(JSC::speciesWatchpointIsValid):

  • runtime/JSGlobalObject.cpp:

(JSC::setupAdaptiveWatchpoint):
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
(JSC::JSGlobalObject::tryInstallArraySpeciesWatchpoint):
(JSC::JSGlobalObject::installNumberPrototypeWatchpoint):
(JSC::JSGlobalObject::installMapPrototypeWatchpoint):
(JSC::JSGlobalObject::installSetPrototypeWatchpoint):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::numberProtoToStringFunction const):
(JSC::JSGlobalObject::mapPrototype const):
(JSC::JSGlobalObject::jsSetPrototype const):
(JSC::JSGlobalObject::numberObjectStructure const):
(JSC::JSGlobalObject::mapStructure const): Deleted.

  • runtime/MapPrototype.cpp:

(JSC::MapPrototype::finishCreation):

  • runtime/NumberPrototype.cpp:

(JSC::NumberPrototype::finishCreation):

  • runtime/NumberPrototype.h:
  • runtime/SetPrototype.cpp:

(JSC::SetPrototype::finishCreation):

Location:
trunk/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r252247 r252256  
     12019-11-08  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Use LinkTimeConstants and make some properties lazy
     4        https://bugs.webkit.org/show_bug.cgi?id=203795
     5
     6        Reviewed by Keith Miller.
     7
     8        This patch makes Map and Set lazily initialized in JSGlobalObject by leveraging link-time-constant. @Set was accessed from
     9        builtin-JS. So we cannot make it lazily-allocated. But now we have link-time-constant mechanism that makes such accesses
     10        lazily-initialized. We use this to make Set lazily-allocated.
     11
     12        And, instead of JSGlobalObject's last sequence of initialization, we initialize watchpoint in MapPrototype::finishCreation
     13        and SetPrototype::finishCreation. This allows us to make Map and Set lazily-allocated. We also refactor NumberPrototype to
     14        align to this model.
     15
     16        * runtime/ArrayPrototype.cpp:
     17        (JSC::speciesWatchpointIsValid):
     18        * runtime/JSGlobalObject.cpp:
     19        (JSC::setupAdaptiveWatchpoint):
     20        (JSC::JSGlobalObject::init):
     21        (JSC::JSGlobalObject::visitChildren):
     22        (JSC::JSGlobalObject::tryInstallArraySpeciesWatchpoint):
     23        (JSC::JSGlobalObject::installNumberPrototypeWatchpoint):
     24        (JSC::JSGlobalObject::installMapPrototypeWatchpoint):
     25        (JSC::JSGlobalObject::installSetPrototypeWatchpoint):
     26        * runtime/JSGlobalObject.h:
     27        (JSC::JSGlobalObject::numberProtoToStringFunction const):
     28        (JSC::JSGlobalObject::mapPrototype const):
     29        (JSC::JSGlobalObject::jsSetPrototype const):
     30        (JSC::JSGlobalObject::numberObjectStructure const):
     31        (JSC::JSGlobalObject::mapStructure const): Deleted.
     32        * runtime/MapPrototype.cpp:
     33        (JSC::MapPrototype::finishCreation):
     34        * runtime/NumberPrototype.cpp:
     35        (JSC::NumberPrototype::finishCreation):
     36        * runtime/NumberPrototype.h:
     37        * runtime/SetPrototype.cpp:
     38        (JSC::SetPrototype::finishCreation):
     39
    1402019-11-08  Mark Lam  <mark.lam@apple.com>
    241
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r252024 r252256  
    200200    if (globalObject->arraySpeciesWatchpointSet().stateOnJSThread() == ClearWatchpoint) {
    201201        dataLogLnIf(ArrayPrototypeInternal::verbose, "Initializing Array species watchpoints for Array.prototype: ", pointerDump(arrayPrototype), " with structure: ", pointerDump(arrayPrototype->structure(vm)), "\nand Array: ", pointerDump(globalObject->arrayConstructor()), " with structure: ", pointerDump(globalObject->arrayConstructor()->structure(vm)));
    202         globalObject->tryInstallArraySpeciesWatchpoint(globalObject);
     202        globalObject->tryInstallArraySpeciesWatchpoint();
    203203        ASSERT(globalObject->arraySpeciesWatchpointSet().stateOnJSThread() != ClearWatchpoint);
    204204    }
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r252160 r252256  
    389389  Error                 JSGlobalObject::m_errorStructure             DontEnum|ClassStructure
    390390  Boolean               JSGlobalObject::m_booleanObjectStructure     DontEnum|ClassStructure
     391  Map                   JSGlobalObject::m_mapStructure               DontEnum|ClassStructure
    391392  Number                JSGlobalObject::m_numberObjectStructure      DontEnum|ClassStructure
     393  Set                   JSGlobalObject::m_setStructure               DontEnum|ClassStructure
    392394  Symbol                JSGlobalObject::m_symbolObjectStructure      DontEnum|ClassStructure
    393395  WeakMap               JSGlobalObject::m_weakMapStructure           DontEnum|ClassStructure
     
    461463}
    462464
     465static ObjectPropertyCondition setupAdaptiveWatchpoint(JSGlobalObject* globalObject, JSObject* base, const Identifier& ident)
     466{
     467    // Performing these gets should not throw.
     468    VM& vm = globalObject->vm();
     469    auto catchScope = DECLARE_CATCH_SCOPE(vm);
     470    PropertySlot slot(base, PropertySlot::InternalMethodType::Get);
     471    bool result = base->getOwnPropertySlot(base, globalObject, ident, slot);
     472    ASSERT_UNUSED(result, result);
     473    catchScope.assertNoException();
     474    RELEASE_ASSERT(slot.isCacheableValue());
     475    JSValue functionValue = slot.getValue(globalObject, ident);
     476    catchScope.assertNoException();
     477    ASSERT(jsDynamicCast<JSFunction*>(vm, functionValue));
     478
     479    ObjectPropertyCondition condition = generateConditionForSelfEquivalence(vm, nullptr, base, ident.impl());
     480    RELEASE_ASSERT(condition.requiredValue() == functionValue);
     481
     482    bool isWatchable = condition.isWatchable(PropertyCondition::EnsureWatchability);
     483    RELEASE_ASSERT(isWatchable); // We allow this to install the necessary watchpoints.
     484
     485    return condition;
     486}
     487
    463488template<ErrorType errorType>
    464489void JSGlobalObject::initializeErrorConstructor(LazyClassStructure::Initializer& init)
     
    542567        [] (const Initializer<JSFunction>& init) {
    543568            init.set(JSFunction::create(init.vm, promiseConstructorResolveCodeGenerator(init.vm), init.owner));
     569        });
     570
     571    m_numberProtoToStringFunction.initLater(
     572        [] (const Initializer<JSFunction>& init) {
     573            init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, init.vm.propertyNames->toString.string(), numberProtoFuncToString, NumberPrototypeToStringIntrinsic));
    544574        });
    545575
     
    947977    m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpPrototypeSymbolReplace)].set(vm, this, m_regExpPrototype->getDirect(vm, vm.propertyNames->replaceSymbol).asCell());
    948978
    949     m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::Set)].set(vm, this, setConstructor);
    950979    m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::isArray)].set(vm, this, arrayConstructor->getDirect(vm, vm.propertyNames->isArray).asCell());
    951980    m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::callFunction)].set(vm, this, callFunction);
     
    9781007
    9791008    // Map and Set helpers.
     1009    m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::Set)].initLater([] (const Initializer<JSCell>& init) {
     1010            init.set(jsCast<JSGlobalObject*>(init.owner)->setConstructor());
     1011        });
    9801012    m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::mapBucketHead)].initLater([] (const Initializer<JSCell>& init) {
    9811013            init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mapPrivateFuncMapBucketHead, JSMapBucketHeadIntrinsic));
     
    11871219#undef CREATE_PROTOTYPE_FOR_LAZY_TYPE
    11881220
    1189     auto setupAdaptiveWatchpoint = [&] (JSObject* base, const Identifier& ident) -> ObjectPropertyCondition {
    1190         // Performing these gets should not throw.
    1191         PropertySlot slot(base, PropertySlot::InternalMethodType::Get);
    1192         bool result = base->getOwnPropertySlot(base, this, ident, slot);
    1193         ASSERT_UNUSED(result, result);
    1194         catchScope.assertNoException();
    1195         RELEASE_ASSERT(slot.isCacheableValue());
    1196         JSValue functionValue = slot.getValue(this, ident);
    1197         catchScope.assertNoException();
    1198         ASSERT(jsDynamicCast<JSFunction*>(vm, functionValue));
    1199 
    1200         ObjectPropertyCondition condition = generateConditionForSelfEquivalence(vm, nullptr, base, ident.impl());
    1201         RELEASE_ASSERT(condition.requiredValue() == functionValue);
    1202 
    1203         bool isWatchable = condition.isWatchable(PropertyCondition::EnsureWatchability);
    1204         RELEASE_ASSERT(isWatchable); // We allow this to install the necessary watchpoints.
    1205 
    1206         return condition;
    1207     };
    1208 
    12091221    {
    1210         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(arrayIteratorPrototype, vm.propertyNames->next);
     1222        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, arrayIteratorPrototype, vm.propertyNames->next);
    12111223        m_arrayIteratorPrototypeNext = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_arrayIteratorProtocolWatchpointSet);
    12121224        m_arrayIteratorPrototypeNext->install(vm);
    12131225    }
    12141226    {
    1215         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this->arrayPrototype(), vm.propertyNames->iteratorSymbol);
     1227        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, this->arrayPrototype(), vm.propertyNames->iteratorSymbol);
    12161228        m_arrayPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_arrayIteratorProtocolWatchpointSet);
    12171229        m_arrayPrototypeSymbolIteratorWatchpoint->install(vm);
    12181230    }
    12191231    {
    1220         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this->arrayPrototype(), vm.propertyNames->join);
     1232        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, this->arrayPrototype(), vm.propertyNames->join);
    12211233        m_arrayPrototypeJoinWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_arrayJoinWatchpointSet);
    12221234        m_arrayPrototypeJoinWatchpoint->install(vm);
     
    12241236
    12251237    {
    1226         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(mapIteratorPrototype, vm.propertyNames->next);
     1238        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, mapIteratorPrototype, vm.propertyNames->next);
    12271239        m_mapIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapIteratorProtocolWatchpointSet);
    12281240        m_mapIteratorPrototypeNextWatchpoint->install(vm);
    12291241    }
    12301242    {
    1231         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_mapPrototype.get(), vm.propertyNames->iteratorSymbol);
    1232         m_mapPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapIteratorProtocolWatchpointSet);
    1233         m_mapPrototypeSymbolIteratorWatchpoint->install(vm);
    1234     }
    1235 
    1236     {
    1237         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(setIteratorPrototype, vm.propertyNames->next);
     1243        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, setIteratorPrototype, vm.propertyNames->next);
    12381244        m_setIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setIteratorProtocolWatchpointSet);
    12391245        m_setIteratorPrototypeNextWatchpoint->install(vm);
    12401246    }
    12411247    {
    1242         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_setPrototype.get(), vm.propertyNames->iteratorSymbol);
    1243         m_setPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setIteratorProtocolWatchpointSet);
    1244         m_setPrototypeSymbolIteratorWatchpoint->install(vm);
    1245     }
    1246 
    1247     {
    1248         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_stringIteratorPrototype.get(), vm.propertyNames->next);
     1248        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, m_stringIteratorPrototype.get(), vm.propertyNames->next);
    12491249        m_stringIteratorPrototypeNextWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_stringIteratorProtocolWatchpointSet);
    12501250        m_stringIteratorPrototypeNextWatchpoint->install(vm);
    12511251    }
    12521252    {
    1253         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_stringPrototype.get(), vm.propertyNames->iteratorSymbol);
     1253        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, m_stringPrototype.get(), vm.propertyNames->iteratorSymbol);
    12541254        m_stringPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_stringIteratorProtocolWatchpointSet);
    12551255        m_stringPrototypeSymbolIteratorWatchpoint->install(vm);
    1256     }
    1257 
    1258     {
    1259         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_mapPrototype.get(), vm.propertyNames->set);
    1260         m_mapPrototypeSetWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapSetWatchpointSet);
    1261         m_mapPrototypeSetWatchpoint->install(vm);
    1262     }
    1263 
    1264     {
    1265         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_setPrototype.get(), vm.propertyNames->add);
    1266         m_setPrototypeAddWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setAddWatchpointSet);
    1267         m_setPrototypeAddWatchpoint->install(vm);
    12681256    }
    12691257
     
    12711259    if (VM::canUseJIT()) {
    12721260        this->booleanPrototype();
    1273         auto* numberPrototype = this->numberPrototype();
     1261        this->numberPrototype();
    12741262        this->symbolPrototype();
    1275 
    1276         ObjectPropertyCondition condition = setupAdaptiveWatchpoint(numberPrototype, vm.propertyNames->toString);
    1277         m_numberPrototypeToStringWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_numberToStringWatchpointSet);
    1278         m_numberPrototypeToStringWatchpoint->install(vm);
    1279         m_numberProtoToStringFunction.set(vm, this, jsCast<JSFunction*>(numberPrototype->getDirect(vm, vm.propertyNames->toString)));
    12801263    }
    12811264
     
    17711754    thisObject->m_promiseResolveFunction.visit(visitor);
    17721755    visitor.append(thisObject->m_objectProtoValueOfFunction);
    1773     visitor.append(thisObject->m_numberProtoToStringFunction);
     1756    thisObject->m_numberProtoToStringFunction.visit(visitor);
    17741757    visitor.append(thisObject->m_functionProtoHasInstanceSymbolFunction);
    17751758    thisObject->m_throwTypeErrorGetterSetter.visit(visitor);
     
    19461929}
    19471930
    1948 void JSGlobalObject::tryInstallArraySpeciesWatchpoint(JSGlobalObject* globalObject)
     1931void JSGlobalObject::tryInstallArraySpeciesWatchpoint()
    19491932{
    19501933    RELEASE_ASSERT(!m_arrayPrototypeConstructorWatchpoint);
    19511934    RELEASE_ASSERT(!m_arrayConstructorSpeciesWatchpoint);
    19521935
    1953     VM& vm = globalObject->vm();
     1936    VM& vm = this->vm();
    19541937    auto scope = DECLARE_THROW_SCOPE(vm);
    19551938
     
    19711954
    19721955    PropertySlot constructorSlot(arrayPrototype, PropertySlot::InternalMethodType::VMInquiry);
    1973     arrayPrototype->getOwnPropertySlot(arrayPrototype, globalObject, vm.propertyNames->constructor, constructorSlot);
     1956    arrayPrototype->getOwnPropertySlot(arrayPrototype, this, vm.propertyNames->constructor, constructorSlot);
    19741957    scope.assertNoException();
    19751958    if (constructorSlot.slotBase() != arrayPrototype
    19761959        || !constructorSlot.isCacheableValue()
    1977         || constructorSlot.getValue(globalObject, vm.propertyNames->constructor) != arrayConstructor) {
     1960        || constructorSlot.getValue(this, vm.propertyNames->constructor) != arrayConstructor) {
    19781961        invalidateWatchpoint();
    19791962        return;
     
    19851968
    19861969    PropertySlot speciesSlot(arrayConstructor, PropertySlot::InternalMethodType::VMInquiry);
    1987     arrayConstructor->getOwnPropertySlot(arrayConstructor, globalObject, vm.propertyNames->speciesSymbol, speciesSlot);
     1970    arrayConstructor->getOwnPropertySlot(arrayConstructor, this, vm.propertyNames->speciesSymbol, speciesSlot);
    19881971    scope.assertNoException();
    19891972    if (speciesSlot.slotBase() != arrayConstructor
     
    20151998    m_arrayConstructorSpeciesWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, speciesCondition, m_arraySpeciesWatchpointSet);
    20161999    m_arrayConstructorSpeciesWatchpoint->install(vm);
     2000}
     2001
     2002void JSGlobalObject::installNumberPrototypeWatchpoint(NumberPrototype* numberPrototype)
     2003{
     2004    VM& vm = this->vm();
     2005    ASSERT(m_numberToStringWatchpointSet.isStillValid());
     2006    ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, numberPrototype, vm.propertyNames->toString);
     2007    m_numberPrototypeToStringWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_numberToStringWatchpointSet);
     2008    m_numberPrototypeToStringWatchpoint->install(vm);
     2009}
     2010
     2011void JSGlobalObject::installMapPrototypeWatchpoint(MapPrototype* mapPrototype)
     2012{
     2013    VM& vm = this->vm();
     2014    if (m_mapIteratorProtocolWatchpointSet.isStillValid()) {
     2015        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, mapPrototype, vm.propertyNames->iteratorSymbol);
     2016        m_mapPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapIteratorProtocolWatchpointSet);
     2017        m_mapPrototypeSymbolIteratorWatchpoint->install(vm);
     2018    }
     2019    ASSERT(m_mapSetWatchpointSet.isStillValid());
     2020    ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, mapPrototype, vm.propertyNames->set);
     2021    m_mapPrototypeSetWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_mapSetWatchpointSet);
     2022    m_mapPrototypeSetWatchpoint->install(vm);
     2023}
     2024
     2025void JSGlobalObject::installSetPrototypeWatchpoint(SetPrototype* setPrototype)
     2026{
     2027    VM& vm = this->vm();
     2028    if (m_setIteratorProtocolWatchpointSet.isStillValid()) {
     2029        ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, setPrototype, vm.propertyNames->iteratorSymbol);
     2030        m_setPrototypeSymbolIteratorWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setIteratorProtocolWatchpointSet);
     2031        m_setPrototypeSymbolIteratorWatchpoint->install(vm);
     2032    }
     2033    ASSERT(m_setAddWatchpointSet.isStillValid());
     2034    ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this, setPrototype, vm.propertyNames->add);
     2035    m_setPrototypeAddWatchpoint = makeUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(this, condition, m_setAddWatchpointSet);
     2036    m_setPrototypeAddWatchpoint->install(vm);
    20172037}
    20182038
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r252032 r252256  
    133133#define FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \
    134134    macro(String, string, stringObject, StringObject, String, object, typeExposedByDefault) \
    135     macro(Map, map, map, JSMap, Map, object, typeExposedByDefault) \
    136     macro(Set, set, set, JSSet, Set, object, typeExposedByDefault) \
    137135    macro(JSPromise, promise, promise, JSPromise, Promise, object, typeExposedByDefault) \
    138136    macro(BigInt, bigInt, bigIntObject, BigIntObject, BigInt, object, Options::useBigInt()) \
     
    150148    macro(Date, date, date, DateInstance, Date, object, typeExposedByDefault) \
    151149    macro(Error, error, error, ErrorInstance, Error, object, typeExposedByDefault) \
     150    macro(Map, map, map, JSMap, Map, object, typeExposedByDefault) \
    152151    macro(Number, number, numberObject, NumberObject, Number, object, typeExposedByDefault) \
     152    macro(Set, set, set, JSSet, Set, object, typeExposedByDefault) \
    153153    macro(Symbol, symbol, symbolObject, SymbolObject, Symbol, object, typeExposedByDefault) \
    154154    DEFINE_STANDARD_BUILTIN(macro, WeakMap, weakMap) \
     
    303303    LazyProperty<JSGlobalObject, JSFunction> m_iteratorProtocolFunction;
    304304    LazyProperty<JSGlobalObject, JSFunction> m_promiseResolveFunction;
     305    LazyProperty<JSGlobalObject, JSFunction> m_numberProtoToStringFunction;
    305306    WriteBarrier<JSFunction> m_objectProtoValueOfFunction;
    306     WriteBarrier<JSFunction> m_numberProtoToStringFunction;
    307307    WriteBarrier<JSFunction> m_functionProtoHasInstanceSymbolFunction;
    308308    LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorGetterSetter;
     
    616616    JSFunction* promiseProtoThenFunction() const;
    617617    JSFunction* objectProtoValueOfFunction() const { return m_objectProtoValueOfFunction.get(); }
    618     JSFunction* numberProtoToStringFunction() const { return m_numberProtoToStringFunction.get(); }
     618    JSFunction* numberProtoToStringFunction() const { return m_numberProtoToStringFunction.getInitializedOnMainThread(this); }
    619619    JSFunction* functionProtoHasInstanceSymbolFunction() const { return m_functionProtoHasInstanceSymbolFunction.get(); }
    620620    JSFunction* regExpProtoExecFunction() const;
     
    645645    GeneratorPrototype* generatorPrototype() const { return m_generatorPrototype.get(); }
    646646    AsyncFunctionPrototype* asyncFunctionPrototype() const { return m_asyncFunctionPrototype.get(); }
    647     MapPrototype* mapPrototype() const { return m_mapPrototype.get(); }
     647    JSObject* mapPrototype() const { return m_mapStructure.prototype(this); }
    648648    // Workaround for the name conflict between JSCell::setPrototype.
    649     SetPrototype* jsSetPrototype() const { return m_setPrototype.get(); }
     649    JSObject* jsSetPrototype() const { return m_setStructure.prototype(this); }
    650650    JSPromisePrototype* promisePrototype() const { return m_promisePrototype.get(); }
    651651    AsyncGeneratorPrototype* asyncGeneratorPrototype() const { return m_asyncGeneratorPrototype.get(); }
     
    746746    PropertyOffset functionNameOffset() const { return m_functionNameOffset; }
    747747    Structure* numberObjectStructure() const { return m_numberObjectStructure.get(this); }
    748     Structure* mapStructure() const { return m_mapStructure.get(); }
    749748    Structure* regExpStructure() const { return m_regExpStructure.get(); }
    750749    Structure* generatorStructure() const { return m_generatorStructure.get(); }
     
    10131012#endif
    10141013
    1015     void tryInstallArraySpeciesWatchpoint(JSGlobalObject*);
     1014    void tryInstallArraySpeciesWatchpoint();
     1015    void installNumberPrototypeWatchpoint(NumberPrototype*);
     1016    void installMapPrototypeWatchpoint(MapPrototype*);
     1017    void installSetPrototypeWatchpoint(SetPrototype*);
    10161018
    10171019protected:
  • trunk/Source/JavaScriptCore/runtime/MapPrototype.cpp

    r251425 r252256  
    7777
    7878    JSC_NATIVE_GETTER_WITHOUT_TRANSITION(vm.propertyNames->size, mapProtoFuncSize, PropertyAttribute::DontEnum | PropertyAttribute::Accessor);
     79
     80    globalObject->installMapPrototypeWatchpoint(this);
    7981}
    8082
  • trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp

    r251425 r252256  
    4545namespace JSC {
    4646
    47 static EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(JSGlobalObject*, CallFrame*);
    4847static EncodedJSValue JSC_HOST_CALL numberProtoFuncToLocaleString(JSGlobalObject*, CallFrame*);
    4948static EncodedJSValue JSC_HOST_CALL numberProtoFuncToFixed(JSGlobalObject*, CallFrame*);
     
    8079    Base::finishCreation(vm);
    8180    setInternalValue(vm, jsNumber(0));
    82 
    83     JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->toString, numberProtoFuncToString, static_cast<unsigned>(PropertyAttribute::DontEnum), 1, NumberPrototypeToStringIntrinsic);
     81    putDirectWithoutTransition(vm, vm.propertyNames->toString, globalObject->numberProtoToStringFunction(), static_cast<unsigned>(PropertyAttribute::DontEnum));
    8482    ASSERT(inherits(vm, info()));
     83    globalObject->installNumberPrototypeWatchpoint(this);
    8584}
    8685
  • trunk/Source/JavaScriptCore/runtime/NumberPrototype.h

    r251425 r252256  
    5252
    5353EncodedJSValue JSC_HOST_CALL numberProtoFuncValueOf(JSGlobalObject*, CallFrame*);
     54EncodedJSValue JSC_HOST_CALL numberProtoFuncToString(JSGlobalObject*, CallFrame*);
    5455JSString* int32ToString(VM&, int32_t value, int32_t radix);
    5556JSString* int52ToString(VM&, int64_t value, int32_t radix);
  • trunk/Source/JavaScriptCore/runtime/SetPrototype.cpp

    r251425 r252256  
    7575
    7676    JSC_NATIVE_GETTER_WITHOUT_TRANSITION(vm.propertyNames->size, setProtoFuncSize, PropertyAttribute::DontEnum | PropertyAttribute::Accessor);
     77
     78    globalObject->installSetPrototypeWatchpoint(this);
    7779}
    7880
Note: See TracChangeset for help on using the changeset viewer.