Ignore:
Timestamp:
Sep 12, 2017, 6:31:07 PM (8 years ago)
Author:
[email protected]
Message:

Do unified source builds for JSC
https://bugs.webkit.org/show_bug.cgi?id=176076

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

This patch switches the CMake JavaScriptCore build to use unified sources.
The Xcode build will be upgraded in a follow up patch.

Most of the source changes in this patch are fixing static
variable/functions name collisions. The most common collisions
were from our use of "static const bool verbose" and "using
namespace ...". I fixed all the verbose cases and fixed the "using
namespace" issues that occurred under the current bundling
strategy. It's likely that more of the "using namespace" issues
will need to be resolved in the future, particularly in the FTL.

I don't expect either of these problems will apply to other parts
of the project nearly as much as in JSC. Using a verbose variable
is a JSC idiom and JSC tends use the same, canonical, class name
in multiple parts of the engine.

  • CMakeLists.txt:
  • b3/B3CheckSpecial.cpp:

(JSC::B3::CheckSpecial::forEachArg):
(JSC::B3::CheckSpecial::generate):
(JSC::B3::Air::numB3Args): Deleted.

  • b3/B3DuplicateTails.cpp:
  • b3/B3EliminateCommonSubexpressions.cpp:
  • b3/B3FixSSA.cpp:

(JSC::B3::demoteValues):

  • b3/B3FoldPathConstants.cpp:
  • b3/B3InferSwitches.cpp:
  • b3/B3LowerMacrosAfterOptimizations.cpp:

(): Deleted.

  • b3/B3LowerToAir.cpp:

(JSC::B3::Air::LowerToAir::LowerToAir): Deleted.
(JSC::B3::Air::LowerToAir::run): Deleted.
(JSC::B3::Air::LowerToAir::shouldCopyPropagate): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::ArgPromise): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::swap): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::operator=): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::~ArgPromise): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::setTraps): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::tmp): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::operator bool const): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::kind const): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::peek const): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::consume): Deleted.
(JSC::B3::Air::LowerToAir::ArgPromise::inst): Deleted.
(JSC::B3::Air::LowerToAir::tmp): Deleted.
(JSC::B3::Air::LowerToAir::tmpPromise): Deleted.
(JSC::B3::Air::LowerToAir::canBeInternal): Deleted.
(JSC::B3::Air::LowerToAir::commitInternal): Deleted.
(JSC::B3::Air::LowerToAir::crossesInterference): Deleted.
(JSC::B3::Air::LowerToAir::scaleForShl): Deleted.
(JSC::B3::Air::LowerToAir::effectiveAddr): Deleted.
(JSC::B3::Air::LowerToAir::addr): Deleted.
(JSC::B3::Air::LowerToAir::trappingInst): Deleted.
(JSC::B3::Air::LowerToAir::loadPromiseAnyOpcode): Deleted.
(JSC::B3::Air::LowerToAir::loadPromise): Deleted.
(JSC::B3::Air::LowerToAir::imm): Deleted.
(JSC::B3::Air::LowerToAir::bitImm): Deleted.
(JSC::B3::Air::LowerToAir::bitImm64): Deleted.
(JSC::B3::Air::LowerToAir::immOrTmp): Deleted.
(JSC::B3::Air::LowerToAir::tryOpcodeForType): Deleted.
(JSC::B3::Air::LowerToAir::opcodeForType): Deleted.
(JSC::B3::Air::LowerToAir::appendUnOp): Deleted.
(JSC::B3::Air::LowerToAir::preferRightForResult): Deleted.
(JSC::B3::Air::LowerToAir::appendBinOp): Deleted.
(JSC::B3::Air::LowerToAir::appendShift): Deleted.
(JSC::B3::Air::LowerToAir::tryAppendStoreUnOp): Deleted.
(JSC::B3::Air::LowerToAir::tryAppendStoreBinOp): Deleted.
(JSC::B3::Air::LowerToAir::createStore): Deleted.
(JSC::B3::Air::LowerToAir::storeOpcode): Deleted.
(JSC::B3::Air::LowerToAir::appendStore): Deleted.
(JSC::B3::Air::LowerToAir::moveForType): Deleted.
(JSC::B3::Air::LowerToAir::relaxedMoveForType): Deleted.
(JSC::B3::Air::LowerToAir::print): Deleted.
(JSC::B3::Air::LowerToAir::append): Deleted.
(JSC::B3::Air::LowerToAir::appendTrapping): Deleted.
(JSC::B3::Air::LowerToAir::finishAppendingInstructions): Deleted.
(JSC::B3::Air::LowerToAir::newBlock): Deleted.
(JSC::B3::Air::LowerToAir::splitBlock): Deleted.
(JSC::B3::Air::LowerToAir::ensureSpecial): Deleted.
(JSC::B3::Air::LowerToAir::ensureCheckSpecial): Deleted.
(JSC::B3::Air::LowerToAir::fillStackmap): Deleted.
(JSC::B3::Air::LowerToAir::createGenericCompare): Deleted.
(JSC::B3::Air::LowerToAir::createBranch): Deleted.
(JSC::B3::Air::LowerToAir::createCompare): Deleted.
(JSC::B3::Air::LowerToAir::createSelect): Deleted.
(JSC::B3::Air::LowerToAir::tryAppendLea): Deleted.
(JSC::B3::Air::LowerToAir::appendX86Div): Deleted.
(JSC::B3::Air::LowerToAir::appendX86UDiv): Deleted.
(JSC::B3::Air::LowerToAir::loadLinkOpcode): Deleted.
(JSC::B3::Air::LowerToAir::storeCondOpcode): Deleted.
(JSC::B3::Air::LowerToAir::appendCAS): Deleted.
(JSC::B3::Air::LowerToAir::appendVoidAtomic): Deleted.
(JSC::B3::Air::LowerToAir::appendGeneralAtomic): Deleted.
(JSC::B3::Air::LowerToAir::lower): Deleted.

  • b3/B3PatchpointSpecial.cpp:

(JSC::B3::PatchpointSpecial::generate):

  • b3/B3ReduceDoubleToFloat.cpp:

(JSC::B3::reduceDoubleToFloat):

  • b3/B3ReduceStrength.cpp:
  • b3/B3StackmapGenerationParams.cpp:
  • b3/B3StackmapSpecial.cpp:

(JSC::B3::StackmapSpecial::repsImpl):
(JSC::B3::StackmapSpecial::repForArg):

  • b3/air/AirAllocateStackByGraphColoring.cpp:

(JSC::B3::Air::allocateStackByGraphColoring):

  • b3/air/AirEmitShuffle.cpp:

(JSC::B3::Air::emitShuffle):

  • b3/air/AirFixObviousSpills.cpp:
  • b3/air/AirLowerAfterRegAlloc.cpp:

(JSC::B3::Air::lowerAfterRegAlloc):

  • b3/air/AirStackAllocation.cpp:

(JSC::B3::Air::attemptAssignment):
(JSC::B3::Air::assign):

  • bytecode/AccessCase.cpp:

(JSC::AccessCase::generateImpl):

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeDFGStatuses):

  • bytecode/GetterSetterAccessCase.cpp:

(JSC::GetterSetterAccessCase::emitDOMJITGetter):

  • bytecode/ObjectPropertyConditionSet.cpp:
  • bytecode/PolymorphicAccess.cpp:

(JSC::PolymorphicAccess::addCases):
(JSC::PolymorphicAccess::regenerate):

  • bytecode/PropertyCondition.cpp:

(JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint const):

  • bytecode/StructureStubInfo.cpp:

(JSC::StructureStubInfo::addAccessCase):

  • dfg/DFGArgumentsEliminationPhase.cpp:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::DelayedSetLocal::DelayedSetLocal):
(JSC::DFG::ByteCodeParser::inliningCost):
(JSC::DFG::ByteCodeParser::inlineCall):
(JSC::DFG::ByteCodeParser::attemptToInlineCall):
(JSC::DFG::ByteCodeParser::handleInlining):
(JSC::DFG::ByteCodeParser::planLoad):
(JSC::DFG::ByteCodeParser::store):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::linkBlock):
(JSC::DFG::ByteCodeParser::linkBlocks):

  • dfg/DFGCSEPhase.cpp:
  • dfg/DFGInPlaceAbstractState.cpp:

(JSC::DFG::InPlaceAbstractState::merge):

  • dfg/DFGIntegerCheckCombiningPhase.cpp:

(JSC::DFG::IntegerCheckCombiningPhase::handleBlock):

  • dfg/DFGIntegerRangeOptimizationPhase.cpp:
  • dfg/DFGMovHintRemovalPhase.cpp:
  • dfg/DFGObjectAllocationSinkingPhase.cpp:
  • dfg/DFGPhantomInsertionPhase.cpp:
  • dfg/DFGPutStackSinkingPhase.cpp:
  • dfg/DFGStoreBarrierInsertionPhase.cpp:
  • dfg/DFGVarargsForwardingPhase.cpp:
  • ftl/FTLAbstractHeap.cpp:

(JSC::FTL::AbstractHeap::compute):

  • ftl/FTLAbstractHeapRepository.cpp:

(JSC::FTL::AbstractHeapRepository::decorateMemory):
(JSC::FTL::AbstractHeapRepository::decorateCCallRead):
(JSC::FTL::AbstractHeapRepository::decorateCCallWrite):
(JSC::FTL::AbstractHeapRepository::decoratePatchpointRead):
(JSC::FTL::AbstractHeapRepository::decoratePatchpointWrite):
(JSC::FTL::AbstractHeapRepository::decorateFenceRead):
(JSC::FTL::AbstractHeapRepository::decorateFenceWrite):
(JSC::FTL::AbstractHeapRepository::decorateFencedAccess):
(JSC::FTL::AbstractHeapRepository::computeRangesAndDecorateInstructions):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • heap/MarkingConstraintSet.cpp:

(JSC::MarkingConstraintSet::add):

  • interpreter/ShadowChicken.cpp:

(JSC::ShadowChicken::update):

  • jit/BinarySwitch.cpp:

(JSC::BinarySwitch::BinarySwitch):
(JSC::BinarySwitch::build):

  • llint/LLIntData.cpp:

(JSC::LLInt::Data::loadStats):
(JSC::LLInt::Data::saveStats):

  • runtime/ArrayPrototype.cpp:

(JSC::ArrayPrototype::tryInitializeSpeciesWatchpoint):
(JSC::ArrayPrototypeAdaptiveInferredPropertyWatchpoint::handleFire):

  • runtime/ErrorInstance.cpp:

(JSC::FindFirstCallerFrameWithCodeblockFunctor::FindFirstCallerFrameWithCodeblockFunctor): Deleted.
(JSC::FindFirstCallerFrameWithCodeblockFunctor::operator()): Deleted.
(JSC::FindFirstCallerFrameWithCodeblockFunctor::foundCallFrame const): Deleted.
(JSC::FindFirstCallerFrameWithCodeblockFunctor::index const): Deleted.

  • runtime/IntlDateTimeFormat.cpp:

(JSC::IntlDateTimeFormat::initializeDateTimeFormat):

  • runtime/PromiseDeferredTimer.cpp:

(JSC::PromiseDeferredTimer::doWork):
(JSC::PromiseDeferredTimer::addPendingPromise):
(JSC::PromiseDeferredTimer::cancelPendingPromise):

  • runtime/TypeProfiler.cpp:

(JSC::TypeProfiler::insertNewLocation):

  • runtime/TypeProfilerLog.cpp:

(JSC::TypeProfilerLog::processLogEntries):

  • runtime/WeakMapPrototype.cpp:

(JSC::protoFuncWeakMapDelete):
(JSC::protoFuncWeakMapGet):
(JSC::protoFuncWeakMapHas):
(JSC::protoFuncWeakMapSet):
(JSC::getWeakMapData): Deleted.

  • runtime/WeakSetPrototype.cpp:

(JSC::protoFuncWeakSetDelete):
(JSC::protoFuncWeakSetHas):
(JSC::protoFuncWeakSetAdd):
(JSC::getWeakMapData): Deleted.

  • testRegExp.cpp:

(testOneRegExp):
(runFromFiles):

  • wasm/WasmB3IRGenerator.cpp:

(JSC::Wasm::parseAndCompile):

  • wasm/WasmBBQPlan.cpp:

(JSC::Wasm::BBQPlan::moveToState):
(JSC::Wasm::BBQPlan::parseAndValidateModule):
(JSC::Wasm::BBQPlan::prepare):
(JSC::Wasm::BBQPlan::compileFunctions):
(JSC::Wasm::BBQPlan::complete):

  • wasm/WasmFaultSignalHandler.cpp:

(JSC::Wasm::trapHandler):

  • wasm/WasmOMGPlan.cpp:

(JSC::Wasm::OMGPlan::OMGPlan):
(JSC::Wasm::OMGPlan::work):

  • wasm/WasmPlan.cpp:

(JSC::Wasm::Plan::fail):

  • wasm/WasmSignature.cpp:

(JSC::Wasm::SignatureInformation::adopt):

  • wasm/WasmWorklist.cpp:

(JSC::Wasm::Worklist::enqueue):

Source/WTF:

This patch adds a script that will automatically bundle source
files, which is currently only used by the CMake build. It's
important that we use the same script to generate the bundles
for the CMake build as the Xcode build. If we didn't do this then
it's likely that there would be build errors that occur in only
one build system. On the same note, we also need to be careful to
not bundle platform specific source files with platform
independent ones. There are a couple of things the script does not
currently handle but are not essential for the CMake build. First,
it does not handle the max bundle size restrictions that the Xcode
build will require. It also does not handle C files.

The unified source generator script works by collecting groups of
up to 8 files from the same directory. We don't bundle files from
across directories since I didn't see a speedup from doing
so. Additionally, splitting at the directory boundary means that
it is less likely that adding a new file will force a "clean"
build. This would happen because the new file will shift every
subsequent file into the next unified source bundle.

Using unified sources appears to be a roughly 3.5x build time
speed up for clean builds on my MBP and appears to have a
negligible effect in incremental builds.

  • generate-unified-source-bundles.rb: Added.
  • wtf/Assertions.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp

    r220823 r221954  
    7070namespace JSC { namespace B3 {
    7171
    72 using namespace Air;
    73 
    7472namespace {
    7573
    76 const bool verbose = false;
     74namespace B3LowerToAirInternal {
     75static const bool verbose = false;
     76}
     77
     78using Arg = Air::Arg;
     79using Inst = Air::Inst;
     80using Code = Air::Code;
     81using Tmp = Air::Tmp;
    7782
    7883// FIXME: We wouldn't need this if Air supported Width modifiers in Air::Kind.
    7984// https://bugs.webkit.org/show_bug.cgi?id=169247
    8085#define OPCODE_FOR_WIDTH(opcode, width) ( \
    81     (width) == Width8 ? opcode ## 8 : \
    82     (width) == Width16 ? opcode ## 16 : \
    83     (width) == Width32 ? opcode ## 32 : \
    84     opcode ## 64)
     86    (width) == Width8 ? Air::opcode ## 8 : \
     87    (width) == Width16 ? Air::opcode ## 16 :    \
     88    (width) == Width32 ? Air::opcode ## 32 :    \
     89    Air::opcode ## 64)
    8590#define OPCODE_FOR_CANONICAL_WIDTH(opcode, width) ( \
    86     (width) == Width64 ? opcode ## 64 : opcode ## 32)
     91    (width) == Width64 ? Air::opcode ## 64 : Air::opcode ## 32)
    8792
    8893class LowerToAir {
     
    108113    void run()
    109114    {
     115        using namespace Air;
    110116        for (B3::BasicBlock* block : m_procedure)
    111117            m_blockToBlock[block] = m_code.addBlock(block->frequency());
     
    115121            case Phi: {
    116122                m_phiToTmp[value] = m_code.newTmp(value->resultBank());
    117                 if (verbose)
     123                if (B3LowerToAirInternal::verbose)
    118124                    dataLog("Phi tmp for ", *value, ": ", m_phiToTmp[value], "\n");
    119125                break;
     
    147153            m_isRare = !m_fastWorklist.saw(block);
    148154
    149             if (verbose)
     155            if (B3LowerToAirInternal::verbose)
    150156                dataLog("Lowering Block ", *block, ":\n");
    151157           
     
    164170                    continue;
    165171                m_insts.append(Vector<Inst>());
    166                 if (verbose)
     172                if (B3LowerToAirInternal::verbose)
    167173                    dataLog("Lowering ", deepDump(m_procedure, m_value), ":\n");
    168174                lower();
    169                 if (verbose) {
     175                if (B3LowerToAirInternal::verbose) {
    170176                    for (Inst& inst : m_insts.last())
    171177                        dataLog("    ", inst, "\n");
     
    380386                if (m_procedure.isFastConstant(value->key()))
    381387                    m_code.addFastTmp(realTmp);
    382                 if (verbose)
     388                if (B3LowerToAirInternal::verbose)
    383389                    dataLog("Tmp for ", *value, ": ", realTmp, "\n");
    384390            }
     
    907913    void appendShift(Value* value, Value* amount)
    908914    {
     915        using namespace Air;
    909916        Air::Opcode opcode = opcodeForType(opcode32, opcode64, value->type());
    910917       
     
    10201027    Inst createStore(Air::Kind move, Value* value, const Arg& dest)
    10211028    {
     1029        using namespace Air;
    10221030        if (auto imm_value = imm(value)) {
    10231031            if (isARM64() && imm_value.value() == 0) {
     
    10441052    Air::Opcode storeOpcode(Width width, Bank bank)
    10451053    {
     1054        using namespace Air;
    10461055        switch (width) {
    10471056        case Width8:
     
    10741083    void appendStore(Value* value, const Arg& dest)
    10751084    {
     1085        using namespace Air;
    10761086        MemoryValue* memory = value->as<MemoryValue>();
    10771087        RELEASE_ASSERT(memory->isStore());
     
    11011111    Air::Opcode moveForType(Type type)
    11021112    {
     1113        using namespace Air;
    11031114        switch (type) {
    11041115        case Int32:
     
    11201131    Air::Opcode relaxedMoveForType(Type type)
    11211132    {
     1133        using namespace Air;
    11221134        switch (type) {
    11231135        case Int32:
     
    11631175    {
    11641176        auto printList = Printer::makePrintRecordList(arguments...);
    1165         auto printSpecial = static_cast<PrintSpecial*>(m_code.addSpecial(std::make_unique<PrintSpecial>(printList)));
    1166         Inst inst(Patch, origin, Arg::special(printSpecial));
     1177        auto printSpecial = static_cast<Air::PrintSpecial*>(m_code.addSpecial(std::make_unique<Air::PrintSpecial>(printList)));
     1178        Inst inst(Air::Patch, origin, Arg::special(printSpecial));
    11671179        Printer::appendAirArgs(inst, std::forward<Arguments>(arguments)...);
    11681180        append(WTFMove(inst));
     
    17631775    Inst createBranch(Value* value, bool inverted = false)
    17641776    {
     1777        using namespace Air;
    17651778        return createGenericCompare(
    17661779            value,
     
    18461859    Inst createCompare(Value* value, bool inverted = false)
    18471860    {
     1861        using namespace Air;
    18481862        return createGenericCompare(
    18491863            value,
     
    19251939    Inst createSelect(const MoveConditionallyConfig& config)
    19261940    {
     1941        using namespace Air;
    19271942        auto createSelectInstruction = [&] (Air::Opcode opcode, const Arg& condition, ArgPromise& left, ArgPromise& right) -> Inst {
    19281943            if (isValidForm(opcode, condition.kind(), left.kind(), right.kind(), Arg::Tmp, Arg::Tmp, Arg::Tmp)) {
     
    19882003    bool tryAppendLea()
    19892004    {
     2005        using namespace Air;
    19902006        Air::Opcode leaOpcode = tryOpcodeForType(Lea32, Lea64, m_value->type());
    19912007        if (!isValidForm(leaOpcode, Arg::Index, Arg::Tmp))
     
    21172133    void appendX86Div(B3::Opcode op)
    21182134    {
     2135        using namespace Air;
    21192136        Air::Opcode convertToDoubleWord;
    21202137        Air::Opcode div;
     
    21442161    void appendX86UDiv(B3::Opcode op)
    21452162    {
     2163        using namespace Air;
    21462164        Air::Opcode div = m_value->type() == Int32 ? X86UDiv32 : X86UDiv64;
    21472165
     
    21792197    void appendCAS(Value* atomicValue, bool invert)
    21802198    {
     2199        using namespace Air;
    21812200        AtomicValue* atomic = atomicValue->as<AtomicValue>();
    21822201        RELEASE_ASSERT(atomic);
     
    23412360    void appendGeneralAtomic(Air::Opcode opcode, Commutativity commutativity = NotCommutative)
    23422361    {
     2362        using namespace Air;
    23432363        AtomicValue* atomic = m_value->as<AtomicValue>();
    23442364       
     
    24252445    void lower()
    24262446    {
     2447        using namespace Air;
    24272448        switch (m_value->opcode()) {
    24282449        case B3::Nop: {
Note: See TracChangeset for help on using the changeset viewer.