Ignore:
Timestamp:
Aug 30, 2013, 3:55:25 PM (12 years ago)
Author:
[email protected]
Message:

Implement ES6 Set class
https://bugs.webkit.org/show_bug.cgi?id=120549

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

We simply reuse the MapData type from JSMap making the
it much simpler.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • runtime/CommonIdentifiers.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::reset):
(JSC::JSGlobalObject::visitChildren):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::setStructure):

  • runtime/JSSet.cpp: Added.

(JSC::JSSet::visitChildren):
(JSC::JSSet::finishCreation):

  • runtime/JSSet.h: Added.

(JSC::JSSet::createStructure):
(JSC::JSSet::create):
(JSC::JSSet::mapData):
(JSC::JSSet::JSSet):

  • runtime/SetConstructor.cpp: Added.

(JSC::SetConstructor::finishCreation):
(JSC::callSet):
(JSC::constructSet):
(JSC::SetConstructor::getConstructData):
(JSC::SetConstructor::getCallData):

  • runtime/SetConstructor.h: Added.

(JSC::SetConstructor::create):
(JSC::SetConstructor::createStructure):
(JSC::SetConstructor::SetConstructor):

  • runtime/SetPrototype.cpp: Added.

(JSC::SetPrototype::finishCreation):
(JSC::getMapData):
(JSC::setProtoFuncAdd):
(JSC::setProtoFuncClear):
(JSC::setProtoFuncDelete):
(JSC::setProtoFuncForEach):
(JSC::setProtoFuncHas):
(JSC::setProtoFuncSize):

  • runtime/SetPrototype.h: Added.

(JSC::SetPrototype::create):
(JSC::SetPrototype::createStructure):
(JSC::SetPrototype::SetPrototype):

LayoutTests:

Add tests

  • fast/js/basic-set-expected.txt: Added.
  • fast/js/basic-set.html: Added.
  • fast/js/script-tests/basic-set.js: Added.

(set new):
(otherString.string_appeared_here.set add):
(try.set forEach):
(set forEach):
(set gc):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r154861 r154916  
    7070class RegExpConstructor;
    7171class RegExpPrototype;
     72class SetPrototype;
    7273class SourceCode;
    7374struct ActivationStackNode;
     
    153154    WriteBarrier<JSPromiseResolverPrototype> m_promiseResolverPrototype;
    154155    WriteBarrier<MapPrototype> m_mapPrototype;
     156    WriteBarrier<SetPrototype> m_setPrototype;
    155157
    156158    WriteBarrier<Structure> m_withScopeStructure;
     
    196198    WriteBarrier<Structure> m_mapDataStructure;
    197199    WriteBarrier<Structure> m_mapStructure;
     200    WriteBarrier<Structure> m_setStructure;
    198201   
    199202    WriteBarrier<JSArrayBufferPrototype> m_arrayBufferPrototype;
     
    391394    Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); }
    392395    Structure* regExpStructure() const { return m_regExpStructure.get(); }
     396    Structure* setStructure() const { return m_setStructure.get(); }
    393397    Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); }
    394398
Note: See TracChangeset for help on using the changeset viewer.