diff --git a/CMakeLists.txt b/CMakeLists.txt index d47fd32b0..c38c485fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,8 @@ elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390") elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "s390x") set(WTF_CPU_S390X 1) else () - message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'") + # message(FATAL_ERROR "Unknown CPU '${LOWERCASE_CMAKE_SYSTEM_PROCESSOR}'") + set(WTF_CPU_X86_64 1) endif () # ----------------------------------------------------------------------------- diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt index b4e1c307d..7818a3c4e 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt @@ -242,7 +242,19 @@ list(APPEND JavaScriptCore_HEADERS ) if (WIN32) - set(OFFLINE_ASM_BACKEND "X86_WIN, X86_64_WIN, C_LOOP_WIN") + if (MSVC) + if (ENABLE_C_LOOP) + set(OFFLINE_ASM_BACKEND "X86_64_WIN, C_LOOP_WIN") + else () + set(OFFLINE_ASM_BACKEND "X86_64_WIN") + endif () + else () + if (ENABLE_C_LOOP) + set(OFFLINE_ASM_BACKEND "X86_64, C_LOOP") + else () + set(OFFLINE_ASM_BACKEND "X86_64") + endif () + endif () else () if (WTF_CPU_X86) set(OFFLINE_ASM_BACKEND "X86") @@ -1349,7 +1361,7 @@ if (USE_VERSION_STAMPER) VERBATIM) endif () -if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) +if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND NOT WIN32) set_target_properties(JavaScriptCore PROPERTIES INTERPROCEDURAL_OPTIMIZATION 0 LINK_FLAGS "-Wl,-dead_strip" diff --git a/Source/JavaScriptCore/assembler/AssemblerBuffer.h b/Source/JavaScriptCore/assembler/AssemblerBuffer.h index 59131326a..3c125365e 100644 --- a/Source/JavaScriptCore/assembler/AssemblerBuffer.h +++ b/Source/JavaScriptCore/assembler/AssemblerBuffer.h @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once @@ -253,8 +253,10 @@ namespace JSC { ~LocalWriter() { +#if !defined(NDEBUG) ASSERT(m_index - m_initialIndex <= m_requiredSpace); ASSERT(m_buffer.m_index == m_initialIndex); +#endif ASSERT(m_storageBuffer == m_buffer.m_storage.buffer()); m_buffer.m_index = m_index; } diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp index 8c752c0d0..cd165128b 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp +++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -31,7 +31,7 @@ #include "ProbeContext.h" #include -#if COMPILER(MSVC) +#if OS(WINDOWS) //COMPILER(MSVC) #include #endif @@ -340,7 +340,7 @@ asm ( ); #endif -#if COMPILER(MSVC) +#if COMPILER(MSVC) && !defined(__GNUC__) extern "C" __declspec(naked) void ctiMasmProbeTrampoline() { __asm { @@ -745,7 +745,7 @@ asm ( // // Specifically, the saved stack pointer register will point to the stack // position before we push the Probe::State frame. The saved rip will point to -// the address of the instruction immediately following the probe. +// the address of the instruction immediately following the probe. void MacroAssembler::probe(Probe::Function function, void* arg) { @@ -769,7 +769,7 @@ MacroAssemblerX86Common::CPUID MacroAssemblerX86Common::getCPUID(unsigned level) MacroAssemblerX86Common::CPUID MacroAssemblerX86Common::getCPUIDEx(unsigned level, unsigned count) { CPUID result { }; -#if COMPILER(MSVC) +#if OS(WINDOWS) //COMPILER(MSVC) __cpuidex(bitwise_cast(result.data()), level, count); #else __asm__ ( diff --git a/Source/JavaScriptCore/b3/air/opcode_generator.rb b/Source/JavaScriptCore/b3/air/opcode_generator.rb index d70ca63a9..3f5532f62 100644 --- a/Source/JavaScriptCore/b3/air/opcode_generator.rb +++ b/Source/JavaScriptCore/b3/air/opcode_generator.rb @@ -51,7 +51,7 @@ def initialize(role, bank, width) @bank = bank @width = width end - + def self.widthCode(width) if width == "Ptr" "POINTER_WIDTH" @@ -63,7 +63,7 @@ def self.widthCode(width) def widthCode Arg.widthCode(width) end - + def self.roleCode(role) case role when "U" @@ -90,11 +90,11 @@ def self.roleCode(role) raise end end - + def roleCode Arg.roleCode(role) end - + def to_s "#{role}:#{bank}:#{width}" end @@ -151,12 +151,12 @@ def initialize(kinds, altName, archs) class Origin attr_reader :fileName, :lineNumber - + def initialize(fileName, lineNumber) @fileName = fileName @lineNumber = lineNumber end - + def to_s "#{fileName}:#{lineNumber}" end @@ -164,12 +164,12 @@ def to_s class Token attr_reader :origin, :string - + def initialize(origin, string) @origin = origin @string = string end - + def ==(other) if other.is_a? Token @string == other.string @@ -177,15 +177,15 @@ def ==(other) @string == other end end - + def =~(other) @string =~ other end - + def to_s "#{@string.inspect} at #{origin}" end - + def parseError(*comment) if comment.empty? raise "Parse error: #{to_s}" @@ -377,7 +377,7 @@ def intersectArchs(left, right) def parse result = {} - + loop { break if @idx >= @tokens.length @@ -403,7 +403,7 @@ def parse signature = [] forms = [] - + if isRole(token) loop { role = consumeRole @@ -411,9 +411,9 @@ def parse bank = consumeBank consume(":") width = consumeWidth - + signature << Arg.new(role, bank, width) - + break unless token == "," consume(",") } @@ -502,14 +502,14 @@ def parse def writeH(filename) File.open("Air#{filename}.h", "w") { | outp | - + outp.puts "// Generated by opcode_generator.rb from #{$fileName} -- do not edit!" - + outp.puts "#ifndef Air#{filename}_h" outp.puts "#define Air#{filename}_h" yield outp - + outp.puts "#endif // Air#{filename}_h" } end @@ -526,7 +526,7 @@ def writeH(filename) outp.puts "static const unsigned numOpcodes = #{$opcodes.keys.size};" outp.puts "} } } // namespace JSC::B3::Air" - + outp.puts "namespace WTF {" outp.puts "class PrintStream;" outp.puts "JS_EXPORT_PRIVATE void printInternal(PrintStream&, JSC::B3::Air::Opcode);" @@ -549,7 +549,7 @@ def matchForms(outp, speed, forms, columnIndex, columnGetter, filter, callback) outp.puts "break;" return end - + groups = {} forms.each { | form | @@ -611,7 +611,7 @@ def matchInstOverload(outp, speed, inst) outp.puts "break;" outp.puts "}" end - + def matchInstOverloadForm(outp, speed, inst) matchInstOverload(outp, speed, inst) { | opcode, overload | @@ -667,10 +667,10 @@ def endArchs(outp, archs) outp.puts "#include \"AirInst.h\"" outp.puts "#include \"AirFormTable.h\"" outp.puts "namespace JSC { namespace B3 { namespace Air {" - - outp.puts "inline bool opgenHiddenTruth() { return true; }" + + outp.puts "ALWAYS_INLINE bool opgenHiddenTruth() { return true; }" outp.puts "template" - outp.puts "inline T* opgenHiddenPtrIdentity(T* pointer) { return pointer; }" + outp.puts "ALWAYS_INLINE T* opgenHiddenPtrIdentity(T* pointer) { return pointer; }" outp.puts "#define OPGEN_RETURN(value) do {\\" outp.puts " if (opgenHiddenTruth())\\" outp.puts " return value;\\" @@ -693,7 +693,7 @@ def endArchs(outp, archs) outp.puts "return;" outp.puts "}" outp.puts "}" - + outp.puts "template" outp.puts "ALWAYS_INLINE void Inst::forEachArgSimple(const Func& func)" outp.puts "{" @@ -737,7 +737,7 @@ def endArchs(outp, archs) outp.puts " return false;" end } - + notCustom = (not form.kinds.detect { | kind | kind.custom }) if notCustom beginArchs(outp, form.archs) @@ -760,7 +760,7 @@ def endArchs(outp, archs) outp.puts "return false; " outp.puts "}" - outp.puts "inline bool isDefinitelyTerminal(Opcode opcode)" + outp.puts "ALWAYS_INLINE bool isDefinitelyTerminal(Opcode opcode)" outp.puts "{" outp.puts "switch (opcode) {" didFindTerminals = false @@ -779,7 +779,7 @@ def endArchs(outp, archs) outp.puts "}" outp.puts "}" - outp.puts "inline bool isReturn(Opcode opcode)" + outp.puts "ALWAYS_INLINE bool isReturn(Opcode opcode)" outp.puts "{" outp.puts "switch (opcode) {" didFindReturns = false @@ -797,7 +797,7 @@ def endArchs(outp, archs) outp.puts "return false;" outp.puts "}" outp.puts "}" - + outp.puts "} } } // namespace JSC::B3::Air" } @@ -821,7 +821,7 @@ def endArchs(outp, archs) outp.puts "}" outp.puts "} // namespace WTF" outp.puts "namespace JSC { namespace B3 { namespace Air {" - + outp.puts "const uint8_t g_formTable[#{$opcodes.size * formTableWidth}] = {" $opcodes.values.each { | opcode | @@ -832,7 +832,7 @@ def endArchs(outp, archs) overloads[overload.signature.length] = overload } end - + (0..maxNumOperands).each { | numOperands | overload = overloads[numOperands] @@ -853,7 +853,7 @@ def endArchs(outp, archs) } } outp.puts "};" - + outp.puts "void Inst::forEachArgCustom(ScopedLambda lambda)" outp.puts "{" outp.puts "switch (kind.opcode) {" @@ -870,7 +870,7 @@ def endArchs(outp, archs) outp.puts "RELEASE_ASSERT_NOT_REACHED();" outp.puts "}" outp.puts "}" - + outp.puts "bool Inst::isValidForm()" outp.puts "{" matchInstOverloadForm(outp, :safe, "this") { @@ -955,7 +955,7 @@ def endArchs(outp, archs) | overload | overload.signature.length }.max - + numArgs.times { | argIndex | outp.puts "case #{argIndex}:" @@ -995,7 +995,7 @@ def endArchs(outp, archs) useAddr = (overload.signature[argIndex] and overload.signature[argIndex].role == "UA") - + # Again, check if all of them do what we want. numYes = 0 numNo = 0 @@ -1063,15 +1063,15 @@ def endArchs(outp, archs) outp.puts "}" end end - + outp.puts "break;" } - + outp.puts "default:" outp.puts "break;" outp.puts "}" end - + outp.puts "break;" } outp.puts "default:"; @@ -1123,7 +1123,7 @@ def endArchs(outp, archs) outp.puts "return false;" outp.puts "}" outp.puts "}" - + outp.puts "bool Inst::hasNonArgNonControlEffects()" outp.puts "{" outp.puts "if (kind.effects)" @@ -1151,7 +1151,7 @@ def endArchs(outp, archs) outp.puts "return false;" outp.puts "}" outp.puts "}" - + outp.puts "bool Inst::hasNonArgEffects()" outp.puts "{" outp.puts "if (kind.effects)" @@ -1179,7 +1179,7 @@ def endArchs(outp, archs) outp.puts "return false;" outp.puts "}" outp.puts "}" - + outp.puts "CCallHelpers::Jump Inst::generate(CCallHelpers& jit, GenerationContext& context)" outp.puts "{" outp.puts "UNUSED_PARAM(jit);" diff --git a/Source/JavaScriptCore/bytecompiler/RegisterID.h b/Source/JavaScriptCore/bytecompiler/RegisterID.h index d9adffce4..55e2974be 100644 --- a/Source/JavaScriptCore/bytecompiler/RegisterID.h +++ b/Source/JavaScriptCore/bytecompiler/RegisterID.h @@ -58,7 +58,7 @@ namespace JSC { #endif { } - + explicit RegisterID(int index) : m_refCount(0) , m_virtualRegister(VirtualRegister(index)) @@ -84,7 +84,9 @@ namespace JSC { int index() const { +#ifndef NDEBUG ASSERT(m_didSetIndex); +#endif return m_virtualRegister.offset(); } diff --git a/Source/JavaScriptCore/dfg/DFGOSRExit.cpp b/Source/JavaScriptCore/dfg/DFGOSRExit.cpp index 63a52b6b8..568a261b0 100644 --- a/Source/JavaScriptCore/dfg/DFGOSRExit.cpp +++ b/Source/JavaScriptCore/dfg/DFGOSRExit.cpp @@ -20,10 +20,11 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" +#include "BytecodeStructs.h" #include "DFGOSRExit.h" #if ENABLE(DFG_JIT) @@ -1049,7 +1050,7 @@ void JIT_OPERATION OSRExit::compileOSRExit(ExecState* exec) ASSERT(!vm->callFrameForCatch || exit.m_kind == GenericUnwind); EXCEPTION_ASSERT_UNUSED(scope, !!scope.exception() || !exit.isExceptionHandler()); - + prepareCodeOriginForOSRExit(exec, exit.m_codeOrigin); // Compute the value recoveries. @@ -1278,10 +1279,10 @@ void OSRExit::compileExit(CCallHelpers& jit, VM& vm, const OSRExit& exit, const jit.pushToSave(scratchTag); JSValueRegs scratch(scratchTag, scratchPayload); - + jit.loadValue(exit.m_jsValueSource.asAddress(), scratch); profile.emitReportValue(jit, scratch); - + jit.popToRestore(scratchTag); jit.popToRestore(scratchPayload); } else if (exit.m_jsValueSource.hasKnownTag()) { @@ -1356,7 +1357,7 @@ void OSRExit::compileExit(CCallHelpers& jit, VM& vm, const OSRExit& exit, const recovery.gpr(), &bitwise_cast(scratch + index)->asBits.payload); break; - + case InPair: jit.store32( recovery.tagGPR(), diff --git a/Source/JavaScriptCore/disassembler/X86Disassembler.cpp b/Source/JavaScriptCore/disassembler/X86Disassembler.cpp index ef6ca821e..e6ff3956d 100644 --- a/Source/JavaScriptCore/disassembler/X86Disassembler.cpp +++ b/Source/JavaScriptCore/disassembler/X86Disassembler.cpp @@ -20,13 +20,13 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "Disassembler.h" -#if USE(UDIS86) +#if USE(UDIS86) && ENABLE(DISASSEMBLER) #include "MacroAssemblerCodeRef.h" #include "Options.h" diff --git a/Source/JavaScriptCore/heap/AlignedMemoryAllocator.cpp b/Source/JavaScriptCore/heap/AlignedMemoryAllocator.cpp index e7c93c263..98ea5a794 100644 --- a/Source/JavaScriptCore/heap/AlignedMemoryAllocator.cpp +++ b/Source/JavaScriptCore/heap/AlignedMemoryAllocator.cpp @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -30,7 +30,9 @@ #include "Heap.h" #include "Subspace.h" -namespace JSC { +#include "HeapInlines.h" + +namespace JSC { AlignedMemoryAllocator::AlignedMemoryAllocator() { @@ -43,13 +45,13 @@ AlignedMemoryAllocator::~AlignedMemoryAllocator() void AlignedMemoryAllocator::registerDirectory(BlockDirectory* directory) { RELEASE_ASSERT(!directory->nextDirectoryInAlignedMemoryAllocator()); - + if (m_directories.isEmpty()) { ASSERT(!Thread::mayBeGCThread() || directory->heap()->worldIsStopped()); for (Subspace* subspace = m_subspaces.first(); subspace; subspace = subspace->nextSubspaceInAlignedMemoryAllocator()) subspace->didCreateFirstDirectory(directory); } - + m_directories.append(std::mem_fn(&BlockDirectory::setNextDirectoryInAlignedMemoryAllocator), directory); } diff --git a/Source/JavaScriptCore/heap/SlotVisitor.cpp b/Source/JavaScriptCore/heap/SlotVisitor.cpp index 0a41b7621..bd39d14ce 100644 --- a/Source/JavaScriptCore/heap/SlotVisitor.cpp +++ b/Source/JavaScriptCore/heap/SlotVisitor.cpp @@ -28,8 +28,6 @@ #include "CPU.h" #include "ConservativeRoots.h" -#include "GCSegmentedArrayInlines.h" -#include "HeapCellInlines.h" #include "HeapProfiler.h" #include "HeapSnapshotBuilder.h" #include "JSArray.h" @@ -37,9 +35,7 @@ #include "JSObject.h" #include "JSString.h" #include "JSCInlines.h" -#include "MarkedBlockInlines.h" #include "MarkingConstraintSolver.h" -#include "SlotVisitorInlines.h" #include "StopIfNecessaryTimer.h" #include "SuperSampler.h" #include "VM.h" @@ -47,6 +43,13 @@ #include #include +#include "GCSegmentedArrayInlines.h" +#include "HeapInlines.h" +#include "HeapCellInlines.h" +#include "BlockDirectoryInlines.h" +#include "MarkedBlockInlines.h" +#include "SlotVisitorInlines.h" + namespace JSC { #if ENABLE(GC_VALIDATION) @@ -115,7 +118,7 @@ void SlotVisitor::didStartMarking() if (HeapProfiler* heapProfiler = vm().heapProfiler()) m_heapSnapshotBuilder = heapProfiler->activeSnapshotBuilder(); - + m_markingVersion = heap()->objectSpace().markingVersion(); } @@ -148,12 +151,12 @@ void SlotVisitor::appendJSCellOrAuxiliary(HeapCell* heapCell) { if (!heapCell) return; - + ASSERT(!m_isCheckingForDefaultMarkViolation); - + auto validateCell = [&] (JSCell* jsCell) { StructureID structureID = jsCell->structureID(); - + auto die = [&] (const char* text) { WTF::dataFile().atomically( [&] (PrintStream& out) { @@ -188,45 +191,45 @@ void SlotVisitor::appendJSCellOrAuxiliary(HeapCell* heapCell) UNREACHABLE_FOR_PLATFORM(); }); }; - + // It's not OK for the structure to be null at any GC scan point. We must not GC while // an object is not fully initialized. if (!structureID) die("GC scan found corrupt object: structureID is zero!\n"); - + // It's not OK for the structure to be nuked at any GC scan point. if (isNuked(structureID)) die("GC scan found object in bad state: structureID is nuked!\n"); - + #if USE(JSVALUE64) // This detects the worst of the badness. if (!heap()->structureIDTable().isValid(structureID)) die("GC scan found corrupt object: structureID is invalid!\n"); #endif }; - + // In debug mode, we validate before marking since this makes it clearer what the problem // was. It's also slower, so we don't do it normally. if (!ASSERT_DISABLED && isJSCellKind(heapCell->cellKind())) validateCell(static_cast(heapCell)); - + if (Heap::testAndSetMarked(m_markingVersion, heapCell)) return; - + switch (heapCell->cellKind()) { case HeapCell::JSCell: case HeapCell::JSCellWithInteriorPointers: { // We have ample budget to perform validation here. - + JSCell* jsCell = static_cast(heapCell); validateCell(jsCell); - + jsCell->setCellState(CellState::PossiblyGrey); appendToMarkStack(jsCell); return; } - + case HeapCell::Auxiliary: { noteLiveAuxiliaryCell(heapCell); return; @@ -237,7 +240,7 @@ void SlotVisitor::appendSlow(JSCell* cell, Dependency dependency) { if (UNLIKELY(m_heapSnapshotBuilder)) m_heapSnapshotBuilder->appendEdge(m_currentCell, cell, m_rootMarkReason); - + appendHiddenSlowImpl(cell, dependency); } @@ -253,7 +256,7 @@ ALWAYS_INLINE void SlotVisitor::appendHiddenSlowImpl(JSCell* cell, Dependency de #if ENABLE(GC_VALIDATION) validate(cell); #endif - + if (cell->isLargeAllocation()) setMarkedAndAppendToMarkStack(cell->largeAllocation(), cell, dependency); else @@ -265,14 +268,14 @@ ALWAYS_INLINE void SlotVisitor::setMarkedAndAppendToMarkStack(ContainerType& con { if (container.testAndSetMarked(cell, dependency)) return; - + ASSERT(cell->structure()); - + // Indicate that the object is grey and that: // In case of concurrent GC: it's the first time it is grey in this GC cycle. // In case of eden collection: it's a new object that became grey rather than an old remembered object. cell->setCellState(CellState::PossiblyGrey); - + appendToMarkStack(container, cell); } @@ -297,7 +300,7 @@ ALWAYS_INLINE void SlotVisitor::appendToMarkStack(ContainerType& container, JSCe ASSERT(!cell->isZapped()); container.noteMarked(); - + m_visitCount++; m_bytesVisited += container.cellSize(); @@ -312,12 +315,12 @@ void SlotVisitor::appendToMutatorMarkStack(const JSCell* cell) void SlotVisitor::markAuxiliary(const void* base) { HeapCell* cell = bitwise_cast(base); - + ASSERT(cell->heap() == heap()); - + if (Heap::testAndSetMarked(m_markingVersion, cell)) return; - + noteLiveAuxiliaryCell(cell); } @@ -328,12 +331,12 @@ void SlotVisitor::noteLiveAuxiliaryCell(HeapCell* cell) // Eden collection: if the cell was allocated since the last collection and is live somehow. // // Full collection: if the cell is live somehow. - + CellContainer container = cell->cellContainer(); - + container.assertValidCell(vm(), cell); container.noteMarked(); - + m_visitCount++; size_t cellSize = container.cellSize(); @@ -363,30 +366,30 @@ class SetCurrentCellScope { ALWAYS_INLINE void SlotVisitor::visitChildren(const JSCell* cell) { ASSERT(m_heap.isMarked(cell)); - + SetCurrentCellScope currentCellScope(*this, cell); - + if (false) { dataLog("Visiting ", RawPointer(cell)); if (!m_isFirstVisit) dataLog(" (subsequent)"); dataLog("\n"); } - + // Funny story: it's possible for the object to be black already, if we barrier the object at // about the same time that it's marked. That's fine. It's a gnarly and super-rare race. It's // not clear to me that it would be correct or profitable to bail here if the object is already // black. - + cell->setCellState(CellState::PossiblyBlack); - + WTF::storeLoadFence(); - + switch (cell->type()) { case StringType: JSString::visitChildren(const_cast(cell), *this); break; - + case FinalObjectType: JSFinalObject::visitChildren(const_cast(cell), *this); break; @@ -394,7 +397,7 @@ ALWAYS_INLINE void SlotVisitor::visitChildren(const JSCell* cell) case ArrayType: JSArray::visitChildren(const_cast(cell), *this); break; - + default: // FIXME: This could be so much better. // https://bugs.webkit.org/show_bug.cgi?id=162462 @@ -412,7 +415,7 @@ ALWAYS_INLINE void SlotVisitor::visitChildren(const JSCell* cell) cell->methodTable(vm())->visitChildren(const_cast(cell), *this); break; } - + if (UNLIKELY(m_heapSnapshotBuilder)) { if (m_isFirstVisit) m_heapSnapshotBuilder->appendNode(const_cast(cell)); @@ -504,9 +507,9 @@ NEVER_INLINE void SlotVisitor::drain(MonotonicTime timeout) dataLog("FATAL: attempting to drain when not in parallel mode.\n"); RELEASE_ASSERT_NOT_REACHED(); } - + auto locker = holdLock(m_rightToRun); - + while (!hasElapsed(timeout)) { updateMutatorIsStopped(locker); IterationStatus status = forEachMarkStack( @@ -515,7 +518,7 @@ NEVER_INLINE void SlotVisitor::drain(MonotonicTime timeout) return IterationStatus::Continue; stack.refill(); - + m_isFirstVisit = (&stack == &m_collectorStack); for (unsigned countdown = Options::minimumNumberOfScansBetweenRebalance(); stack.canRemoveLast() && countdown--;) @@ -525,7 +528,7 @@ NEVER_INLINE void SlotVisitor::drain(MonotonicTime timeout) propagateExternalMemoryVisitedIfNecessary(); if (status == IterationStatus::Continue) break; - + m_rightToRun.safepoint(); donateKnownParallel(); } @@ -555,10 +558,10 @@ size_t SlotVisitor::performIncrementOfDraining(size_t bytesRequested) auto isDone = [&] () -> bool { return bytesVisited() >= bytesRequested; }; - + { auto locker = holdLock(m_rightToRun); - + while (!isDone()) { updateMutatorIsStopped(locker); IterationStatus status = forEachMarkStack( @@ -567,7 +570,7 @@ size_t SlotVisitor::performIncrementOfDraining(size_t bytesRequested) return IterationStatus::Continue; stack.refill(); - + m_isFirstVisit = (&stack == &m_collectorStack); unsigned countdown = Options::minimumNumberOfScansBetweenRebalance(); @@ -614,19 +617,19 @@ bool SlotVisitor::hasWork(const AbstractLocker&) NEVER_INLINE SlotVisitor::SharedDrainResult SlotVisitor::drainFromShared(SharedDrainMode sharedDrainMode, MonotonicTime timeout) { ASSERT(m_isInParallelMode); - + ASSERT(Options::numberOfGCMarkers()); bool isActive = false; while (true) { RefPtr> bonusTask; - + { auto locker = holdLock(m_heap.m_markingMutex); if (isActive) m_heap.m_numberOfActiveParallelMarkers--; m_heap.m_numberOfWaitingParallelMarkers++; - + if (sharedDrainMode == MasterDrain) { while (true) { if (hasElapsed(timeout)) @@ -636,7 +639,7 @@ NEVER_INLINE SlotVisitor::SharedDrainResult SlotVisitor::drainFromShared(SharedD m_heap.m_markingConditionVariable.notifyAll(); return SharedDrainResult::Done; } - + if (hasWork(locker)) break; @@ -647,10 +650,10 @@ NEVER_INLINE SlotVisitor::SharedDrainResult SlotVisitor::drainFromShared(SharedD if (hasElapsed(timeout)) return SharedDrainResult::TimedOut; - + if (didReachTermination(locker)) { m_heap.m_markingConditionVariable.notifyAll(); - + // If we're in concurrent mode, then we know that the mutator will eventually do // the right thing because: // - It's possible that the collector has the conn. In that case, the collector will @@ -672,15 +675,15 @@ NEVER_INLINE SlotVisitor::SharedDrainResult SlotVisitor::drainFromShared(SharedD }; m_heap.m_markingConditionVariable.waitUntil(m_heap.m_markingMutex, timeout, isReady); - + if (!hasWork(locker) && m_heap.m_bonusVisitorTask) bonusTask = m_heap.m_bonusVisitorTask; - + if (m_heap.m_parallelMarkersShouldExit) return SharedDrainResult::Done; } - + if (!bonusTask && isEmpty()) { forEachMarkStack( [&] (MarkStackArray& stack) -> IterationStatus { @@ -694,10 +697,10 @@ NEVER_INLINE SlotVisitor::SharedDrainResult SlotVisitor::drainFromShared(SharedD m_heap.m_numberOfActiveParallelMarkers++; m_heap.m_numberOfWaitingParallelMarkers--; } - + if (bonusTask) { bonusTask->run(*this); - + // The main thread could still be running, and may run for a while. Unless we clear the task // ourselves, we will keep looping around trying to run the task. { @@ -711,7 +714,7 @@ NEVER_INLINE SlotVisitor::SharedDrainResult SlotVisitor::drainFromShared(SharedD RELEASE_ASSERT(!isEmpty()); drain(timeout); } - + isActive = true; } } @@ -725,9 +728,9 @@ SlotVisitor::SharedDrainResult SlotVisitor::drainInParallel(MonotonicTime timeou SlotVisitor::SharedDrainResult SlotVisitor::drainInParallelPassively(MonotonicTime timeout) { ASSERT(m_isInParallelMode); - + ASSERT(Options::numberOfGCMarkers()); - + if (Options::numberOfGCMarkers() == 1 || (m_heap.m_worldState.load() & Heap::mutatorWaitingBit) || !m_heap.hasHeapAccess() @@ -747,12 +750,12 @@ SlotVisitor::SharedDrainResult SlotVisitor::waitForTermination(MonotonicTime tim for (;;) { if (hasElapsed(timeout)) return SharedDrainResult::TimedOut; - + if (didReachTermination(locker)) { m_heap.m_markingConditionVariable.notifyAll(); return SharedDrainResult::Done; } - + m_heap.m_markingConditionVariable.waitUntil(m_heap.m_markingMutex, timeout); } } @@ -761,7 +764,7 @@ void SlotVisitor::donateAll() { if (isEmpty()) return; - + donateAll(holdLock(m_heap.m_markingMutex)); } @@ -782,10 +785,10 @@ void SlotVisitor::donate() dataLog("FATAL: Attempting to donate when not in parallel mode.\n"); RELEASE_ASSERT_NOT_REACHED(); } - + if (Options::numberOfGCMarkers() == 1) return; - + donateKnownParallel(); } @@ -799,7 +802,7 @@ void SlotVisitor::didRace(const VisitRaceKey& race) { if (Options::verboseVisitRace()) dataLog(toCString("GC visit race: ", race, "\n")); - + auto locker = holdLock(heap()->m_raceMarkStackLock); JSCell* cell = race.cell(); cell->setCellState(CellState::PossiblyGrey); @@ -824,7 +827,7 @@ void SlotVisitor::addParallelConstraintTask(RefPtraddParallelTask(task, *m_currentConstraint); } diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp b/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp index b061ff485..a52d2ede9 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -544,7 +544,7 @@ JSValue CLoop::execute(OpcodeID entryOpcodeID, void* executableAddress, VM* vm, #define OFFLINE_ASM_LOCAL_LABEL(label) LOCAL_LABEL_STRING(label) ":\n" -#if OS(LINUX) +#if !OS(DARWIN) #define OFFLINE_ASM_OPCODE_DEBUG_LABEL(label) #label ":\n" #else #define OFFLINE_ASM_OPCODE_DEBUG_LABEL(label) diff --git a/Source/JavaScriptCore/offlineasm/asm.rb b/Source/JavaScriptCore/offlineasm/asm.rb index f96defc2d..590207fc5 100644 --- a/Source/JavaScriptCore/offlineasm/asm.rb +++ b/Source/JavaScriptCore/offlineasm/asm.rb @@ -70,7 +70,7 @@ def enterAsm @state = :asm SourceFile.outputDotFileList(@outp) if $enableDebugAnnotations end - + def leaveAsm putsProcEndIfNeeded if $emitWinAsm if !$emitWinAsm @@ -87,7 +87,7 @@ def leaveAsm @outp.puts "OFFLINE_ASM_END" if !$emitWinAsm @state = :cpp end - + def deferAction(&proc) @deferredActions << proc end @@ -95,19 +95,19 @@ def deferAction(&proc) def deferNextLabelAction(&proc) @deferredNextLabelActions << proc end - + def newUID @count += 1 @count end - + def inAsm resetAsm enterAsm yield leaveAsm end - + # Concatenates all the various components of the comment to dump. def lastComment separator = " " @@ -137,13 +137,13 @@ def lastComment @internalComment = nil result end - + # Puts a C Statement in the output stream. def putc(*line) raise unless @state == :asm @outp.puts(formatDump(" " + line.join(''), lastComment)) end - + def formatDump(dumpStr, comment, commentColumns=$preferredCommentStartColumn) if comment.length > 0 "%-#{commentColumns}s %s" % [dumpStr, comment] @@ -176,7 +176,7 @@ def putsLastComment @outp.puts comment end end - + def puts(*line) raise unless @state == :asm if !$emitWinAsm @@ -185,12 +185,12 @@ def puts(*line) @outp.puts(formatDump(" " + line.join(''), lastComment)) end end - + def print(line) raise unless @state == :asm @outp.print("\"" + line + "\"") end - + def putsNewlineSpacerIfAppropriate(state) if @newlineSpacerState != state @outp.puts("\n") @@ -228,14 +228,14 @@ def putsLabel(labelName, isGlobal) @outp.puts(formatDump("OFFLINE_ASM_GLOBAL_LABEL(#{labelName})", lastComment)) else putsProc(labelName, lastComment) - end + end elsif /\Allint_op_/.match(labelName) if !$emitWinAsm @outp.puts(formatDump("OFFLINE_ASM_OPCODE_LABEL(op_#{$~.post_match})", lastComment)) else label = "llint_" + "op_#{$~.post_match}" @outp.puts(formatDump(" _#{label}:", lastComment)) - end + end else if !$emitWinAsm @outp.puts(formatDump("OFFLINE_ASM_GLUE_LABEL(#{labelName})", lastComment)) @@ -245,7 +245,7 @@ def putsLabel(labelName, isGlobal) end @newlineSpacerState = :none # After a global label, we can use another spacer. end - + def putsLocalLabel(labelName) raise unless @state == :asm @numLocalLabels += 1 @@ -273,7 +273,7 @@ def self.labelReference(labelName) "_#{labelName}" end end - + def self.localLabelReference(labelName) if !$emitWinAsm "\" LOCAL_LABEL_STRING(#{labelName}) \"" @@ -281,7 +281,7 @@ def self.localLabelReference(labelName) "#{labelName}" end end - + def self.cLabelReference(labelName) if /\Allint_op_/.match(labelName) "op_#{$~.post_match}" # strip opcodes of their llint_ prefix. @@ -289,11 +289,11 @@ def self.cLabelReference(labelName) "#{labelName}" end end - + def self.cLocalLabelReference(labelName) "#{labelName}" end - + def codeOrigin(text) case @commentState when :none @@ -332,6 +332,13 @@ def debugAnnotation(text) offsetsFile = ARGV.shift outputFlnm = ARGV.shift +print "ASM: " +puts asmFile +print "Offsets: " +puts offsetsFile +print "Output: " +puts outputFlnm + $options = {} OptionParser.new do |opts| opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=]" @@ -379,7 +386,7 @@ def debugAnnotation(text) $output.puts inputHash $asm = Assembler.new($output) - + ast = parse(asmFile) settingsCombinations = computeSettingsCombinations(ast) diff --git a/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb b/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb index 2d975354c..ef5c4de81 100644 --- a/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb +++ b/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb @@ -40,9 +40,19 @@ settingsFlnm = ARGV.shift outputFlnm = ARGV.shift +print "Input: " +puts inputFlnm +print "Settings: " +puts settingsFlnm +print "Output: " +puts outputFlnm + validBackends = canonicalizeBackendNames(ARGV.shift.split(/[,\s]+/)) includeOnlyBackends(validBackends) +print "Backends: " +puts validBackends + begin configurationList = configurationIndices(settingsFlnm) rescue MissingMagicValuesException diff --git a/Source/JavaScriptCore/offlineasm/generate_settings_extractor.rb b/Source/JavaScriptCore/offlineasm/generate_settings_extractor.rb index 7f4cd120e..8c609f244 100644 --- a/Source/JavaScriptCore/offlineasm/generate_settings_extractor.rb +++ b/Source/JavaScriptCore/offlineasm/generate_settings_extractor.rb @@ -39,9 +39,17 @@ inputFlnm = ARGV.shift outputFlnm = ARGV.shift +print "Input: " +puts inputFlnm +print "Output: " +puts outputFlnm + validBackends = canonicalizeBackendNames(ARGV.shift.split(/[,\s]+/)) includeOnlyBackends(validBackends) +print "Backends: " +puts validBackends + inputHash = "// SettingsExtractor input hash: #{parseHash(inputFlnm)} #{selfHash}" if FileTest.exist? outputFlnm diff --git a/Source/JavaScriptCore/offlineasm/parser.rb b/Source/JavaScriptCore/offlineasm/parser.rb index 632cafc0a..94eb67e8c 100644 --- a/Source/JavaScriptCore/offlineasm/parser.rb +++ b/Source/JavaScriptCore/offlineasm/parser.rb @@ -30,7 +30,7 @@ class SourceFile @@fileNames = [] - + attr_reader :name, :fileNumber def SourceFile.outputDotFileList(outp) @@ -56,7 +56,7 @@ def initialize(fileName) class CodeOrigin attr_reader :lineNumber - + def initialize(sourceFile, lineNumber) @sourceFile = sourceFile @lineNumber = lineNumber @@ -100,6 +100,8 @@ def self.processIncludeOptions() if not path path = ARGV.shift end + print "Include: " + puts path @@includeDirs << (path + "/") end end @@ -107,12 +109,12 @@ def self.processIncludeOptions() class Token attr_reader :codeOrigin, :string - + def initialize(codeOrigin, string) @codeOrigin = codeOrigin @string = string end - + def ==(other) if other.is_a? Token @string == other.string @@ -120,15 +122,15 @@ def ==(other) @string == other end end - + def =~(other) @string =~ other end - + def to_s "#{@string.inspect} at #{codeOrigin}" end - + def parseError(*comment) if comment.empty? raise "Parse error: #{to_s}" @@ -262,7 +264,7 @@ def initialize(data, fileName) @idx = 0 @annotation = nil end - + def parseError(*comment) if @tokens[@idx] @tokens[@idx].parseError(*comment) @@ -274,7 +276,7 @@ def parseError(*comment) end end end - + def consume(regexp) if regexp parseError unless @tokens[@idx] =~ regexp @@ -283,13 +285,13 @@ def consume(regexp) end @idx += 1 end - + def skipNewLine while @tokens[@idx] == "\n" @idx += 1 end end - + def parsePredicateAtom if @tokens[@idx] == "not" codeOrigin = @tokens[@idx].codeOrigin @@ -318,7 +320,7 @@ def parsePredicateAtom parseError end end - + def parsePredicateAnd result = parsePredicateAtom while @tokens[@idx] == "and" @@ -330,13 +332,13 @@ def parsePredicateAnd end result end - + def parsePredicate # some examples of precedence: # not a and b -> (not a) and b # a and b or c -> (a and b) or c # a or b and c -> a or (b and c) - + result = parsePredicateAnd while @tokens[@idx] == "or" codeOrigin = @tokens[@idx].codeOrigin @@ -347,7 +349,7 @@ def parsePredicate end result end - + def parseVariable if isRegister(@tokens[@idx]) if @tokens[@idx] =~ FPR_PATTERN @@ -380,17 +382,17 @@ def parseConstExpr parseError end end - + def parseAddress(offset) parseError unless @tokens[@idx] == "[" codeOrigin = @tokens[@idx].codeOrigin - + # Three possibilities: # [] -> AbsoluteAddress # [a] -> Address # [a,b] -> BaseIndex with scale = 1 # [a,b,c] -> BaseIndex - + @idx += 1 if @tokens[@idx] == "]" @idx += 1 @@ -423,7 +425,7 @@ def parseAddress(offset) @idx += 1 result end - + def parseColonColon skipNewLine codeOrigin = @tokens[@idx].codeOrigin @@ -463,7 +465,7 @@ def parseTextInParens return [codeOrigin, text] end - + def parseExpressionAtom skipNewLine if @tokens[@idx] == "-" @@ -513,7 +515,7 @@ def parseExpressionAtom parseError end end - + def parseExpressionMul skipNewLine result = parseExpressionAtom @@ -527,11 +529,11 @@ def parseExpressionMul end result end - + def couldBeExpression @tokens[@idx] == "-" or @tokens[@idx] == "~" or @tokens[@idx] == "sizeof" or @tokens[@idx] == "constexpr" or isInteger(@tokens[@idx]) or isString(@tokens[@idx]) or isVariable(@tokens[@idx]) or isLabel(@tokens[@idx]) or @tokens[@idx] == "(" end - + def parseExpressionAdd skipNewLine result = parseExpressionMul @@ -548,7 +550,7 @@ def parseExpressionAdd end result end - + def parseExpressionAnd skipNewLine result = parseExpressionAdd @@ -558,7 +560,7 @@ def parseExpressionAnd end result end - + def parseExpression skipNewLine result = parseExpressionAnd @@ -575,7 +577,7 @@ def parseExpression end result end - + def parseOperand(comment) skipNewLine if couldBeExpression @@ -595,7 +597,7 @@ def parseOperand(comment) parseError(comment) end end - + def parseMacroVariables skipNewLine consume(/\A\(\Z/) @@ -623,7 +625,7 @@ def parseMacroVariables } variables end - + def parseSequence(final, comment) firstCodeOrigin = @tokens[@idx].codeOrigin list = [] @@ -842,7 +844,7 @@ def parseIncludes(final, comment) moduleName = @tokens[@idx].string fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName @idx += 1 - + fileList << fileName else @idx += 1 diff --git a/Source/JavaScriptCore/runtime/JSExportMacros.h b/Source/JavaScriptCore/runtime/JSExportMacros.h index 756d72ab5..3d6f3c45f 100644 --- a/Source/JavaScriptCore/runtime/JSExportMacros.h +++ b/Source/JavaScriptCore/runtime/JSExportMacros.h @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This file handles shared library symbol export decorations. It is recommended * that all WebKit projects use these definitions so that symbol exports work diff --git a/Source/JavaScriptCore/runtime/JSPromiseDeferred.cpp b/Source/JavaScriptCore/runtime/JSPromiseDeferred.cpp index d4cad0b0f..45fed397f 100644 --- a/Source/JavaScriptCore/runtime/JSPromiseDeferred.cpp +++ b/Source/JavaScriptCore/runtime/JSPromiseDeferred.cpp @@ -110,14 +110,18 @@ void JSPromiseDeferred::resolve(ExecState* exec, JSValue value) { callFunction(exec, m_resolve.get(), value); bool wasPending = exec->vm().promiseDeferredTimer->cancelPendingPromise(this); +#ifndef NDEBUG ASSERT_UNUSED(wasPending, wasPending == m_promiseIsAsyncPending); +#endif } void JSPromiseDeferred::reject(ExecState* exec, JSValue reason) { callFunction(exec, m_reject.get(), reason); bool wasPending = exec->vm().promiseDeferredTimer->cancelPendingPromise(this); +#ifndef NDEBUG ASSERT_UNUSED(wasPending, wasPending == m_promiseIsAsyncPending); +#endif } void JSPromiseDeferred::reject(ExecState* exec, Exception* reason) diff --git a/Source/JavaScriptCore/wasm/WasmMemory.h b/Source/JavaScriptCore/wasm/WasmMemory.h index 9670838f1..5197e8f12 100644 --- a/Source/JavaScriptCore/wasm/WasmMemory.h +++ b/Source/JavaScriptCore/wasm/WasmMemory.h @@ -55,7 +55,7 @@ class Memory : public RefCounted { void dump(WTF::PrintStream&) const; explicit operator bool() const { return !!m_memory; } - + enum NotifyPressure { NotifyPressureTag }; enum SyncTryToReclaim { SyncTryToReclaimTag }; enum GrowSuccess { GrowSuccessTag }; @@ -87,7 +87,11 @@ class Memory : public RefCounted { Expected grow(PageCount); void registerInstance(Instance*); - void check() { ASSERT(!deletionHasBegun()); } + inline void check() { +#if CHECK_REF_COUNTED_LIFECYCLE + ASSERT(!deletionHasBegun()); +#endif + } static ptrdiff_t offsetOfMemory() { return OBJECT_OFFSETOF(Memory, m_memory); } static ptrdiff_t offsetOfSize() { return OBJECT_OFFSETOF(Memory, m_size); } diff --git a/Source/WTF/wtf/ASCIICType.cpp b/Source/WTF/wtf/ASCIICType.cpp index 6f40a70be..46adf9257 100644 --- a/Source/WTF/wtf/ASCIICType.cpp +++ b/Source/WTF/wtf/ASCIICType.cpp @@ -27,7 +27,7 @@ namespace WTF { -WTF_EXPORT_PRIVATE const unsigned char asciiCaseFoldTable[256] = { +extern WTF_EXPORT_PRIVATE const unsigned char asciiCaseFoldTable[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, diff --git a/Source/WTF/wtf/Assertions.h b/Source/WTF/wtf/Assertions.h index 2c93d4f91..7f4bf83a3 100644 --- a/Source/WTF/wtf/Assertions.h +++ b/Source/WTF/wtf/Assertions.h @@ -20,7 +20,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once @@ -71,32 +71,38 @@ extern "C" void _ReadWriteBarrier(void); #define ASSERTIONS_DISABLED_DEFAULT 0 #endif +#if ENABLE(RELEASE_ASSERTIONS) +#define ASSERTIONS_DISABLED 0 +#else +#define ASSERTIONS_DISABLED ASSERTIONS_DISABLED_DEFAULT +#endif + #ifndef BACKTRACE_DISABLED -#define BACKTRACE_DISABLED ASSERTIONS_DISABLED_DEFAULT +#define BACKTRACE_DISABLED ASSERTIONS_DISABLED #endif #ifndef ASSERT_DISABLED -#define ASSERT_DISABLED ASSERTIONS_DISABLED_DEFAULT +#define ASSERT_DISABLED ASSERTIONS_DISABLED #endif #ifndef ASSERT_MSG_DISABLED -#define ASSERT_MSG_DISABLED ASSERTIONS_DISABLED_DEFAULT +#define ASSERT_MSG_DISABLED ASSERTIONS_DISABLED #endif #ifndef ASSERT_ARG_DISABLED -#define ASSERT_ARG_DISABLED ASSERTIONS_DISABLED_DEFAULT +#define ASSERT_ARG_DISABLED ASSERTIONS_DISABLED #endif #ifndef FATAL_DISABLED -#define FATAL_DISABLED ASSERTIONS_DISABLED_DEFAULT +#define FATAL_DISABLED ASSERTIONS_DISABLED #endif #ifndef ERROR_DISABLED -#define ERROR_DISABLED ASSERTIONS_DISABLED_DEFAULT +#define ERROR_DISABLED ASSERTIONS_DISABLED #endif #ifndef LOG_DISABLED -#define LOG_DISABLED ASSERTIONS_DISABLED_DEFAULT +#define LOG_DISABLED ASSERTIONS_DISABLED #endif #ifndef RELEASE_LOG_DISABLED @@ -372,12 +378,12 @@ WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithSecurityImplication(v #define NO_RETURN_DUE_TO_ASSERT NO_RETURN_DUE_TO_CRASH /* ASSERT_WITH_SECURITY_IMPLICATION - + Failure of this assertion indicates a possible security vulnerability. Class of vulnerabilities that it tests include bad casts, out of bounds accesses, use-after-frees, etc. Please file a bug using the security template - https://bugs.webkit.org/enter_bug.cgi?product=Security. - + */ #define ASSERT_WITH_SECURITY_IMPLICATION(assertion) \ (!(assertion) ? \ @@ -412,8 +418,8 @@ WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithSecurityImplication(v } \ } while (0) #endif - - + + /* ASSERT_ARG */ #if ASSERT_ARG_DISABLED diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt index bbe151b3c..0405faa71 100644 --- a/Source/WTF/wtf/CMakeLists.txt +++ b/Source/WTF/wtf/CMakeLists.txt @@ -533,7 +533,7 @@ if (USE_VERSION_STAMPER) VERBATIM) endif () -if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) +if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND NOT WIN32) set_target_properties(WTF PROPERTIES INTERPROCEDURAL_OPTIMIZATION 0 LINK_FLAGS "-Wl,-dead_strip" diff --git a/Source/WebCore/PlatformUltralightWin.cmake b/Source/WebCore/PlatformUltralightWin.cmake index 964895ae5..34c9f4605 100644 --- a/Source/WebCore/PlatformUltralightWin.cmake +++ b/Source/WebCore/PlatformUltralightWin.cmake @@ -1,4 +1,4 @@ -add_definitions(/bigobj -D__STDC_CONSTANT_MACROS -DSTATICALLY_LINKED_WITH_WTF +add_definitions(-D__STDC_CONSTANT_MACROS -DSTATICALLY_LINKED_WITH_WTF -DSTATICALLY_LINKED_WITH_JavaScriptCore -DSTATICALLY_LINKED_WITH_PAL -DULTRALIGHT_IMPLEMENTATION -DCURL_STATICLIB) @@ -36,9 +36,9 @@ list(APPEND WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/ultralight" "${WEBCORE_DIR}/platform/graphics/ultralight" "${WEBCORE_DIR}/platform/graphics/harfbuzz" - + "${ULTRALIGHTCORE_DIR}/include" - + "${SQLITE_DIR}" ) @@ -92,7 +92,7 @@ list(APPEND WebCore_SOURCES platform/ultralight/ICUUtils.cpp platform/ultralight/MemoryUtils.cpp platform/ultralight/ResourceUsageOverlayUltralight.cpp - + platform/graphics/ultralight/GradientUltralight.cpp platform/graphics/ultralight/GraphicsContextPlatformPrivateUltralight.h platform/graphics/ultralight/GraphicsContextUltralight.cpp @@ -125,7 +125,7 @@ list(APPEND WebCore_SOURCES platform/graphics/ultralight/CanvasImage.cpp platform/graphics/ultralight/RefPtrFreeTypeFace.cpp platform/graphics/ultralight/RefPtrFreeTypeFace.h - + platform/image-decoders/ultralight/ImageBackingStoreUltralight.cpp platform/graphics/harfbuzz/HarfBuzzFaceUltralight.cpp platform/Cursor.cpp @@ -310,10 +310,12 @@ set(WebCore_OUTPUT_NAME WebCore${DEBUG_SUFFIX} ) -if (${CMAKE_BUILD_TYPE} MATCHES Release OR ${CMAKE_BUILD_TYPE} MATCHES MinSizeRel) - add_compile_options(/GL) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LTCG") +if (MSVC) + if (${CMAKE_BUILD_TYPE} MATCHES Release OR ${CMAKE_BUILD_TYPE} MATCHES MinSizeRel) + add_compile_options(/GL) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LTCG") + endif () endif () if (UWP_PLATFORM) diff --git a/Source/WebCore/PlatformWin.cmake b/Source/WebCore/PlatformWin.cmake index eaf009f7b..52462ea96 100644 --- a/Source/WebCore/PlatformWin.cmake +++ b/Source/WebCore/PlatformWin.cmake @@ -1,4 +1,8 @@ -add_definitions(/bigobj -D__STDC_CONSTANT_MACROS) +add_definitions(-D__STDC_CONSTANT_MACROS) + +if (MSVC) + add_definitions(/bigobj) +endif () list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/../include/private" diff --git a/Source/WebCore/css/CSSGradientValue.cpp b/Source/WebCore/css/CSSGradientValue.cpp index f6bf2495b..a3e8dcafc 100644 --- a/Source/WebCore/css/CSSGradientValue.cpp +++ b/Source/WebCore/css/CSSGradientValue.cpp @@ -127,7 +127,7 @@ class LinearGradientAdapter { : m_data(data) { } - + float gradientLength() const { auto gradientSize = m_data.point0 - m_data.point1; @@ -237,7 +237,7 @@ class ConicGradientAdapter { void normalizeStopsAndEndpointsOutsideRange(Vector& stops) { auto numStops = stops.size(); - + size_t firstZeroOrGreaterIndex = numStops; for (size_t i = 0; i < numStops; ++i) { if (stops[i].offset >= 0) { @@ -250,11 +250,11 @@ class ConicGradientAdapter { if (firstZeroOrGreaterIndex < numStops && stops[firstZeroOrGreaterIndex].offset > 0) { float prevOffset = stops[firstZeroOrGreaterIndex - 1].offset; float nextOffset = stops[firstZeroOrGreaterIndex].offset; - + float interStopProportion = -prevOffset / (nextOffset - prevOffset); // FIXME: when we interpolate gradients using premultiplied colors, this should do premultiplication. Color blendedColor = blend(stops[firstZeroOrGreaterIndex - 1].color, stops[firstZeroOrGreaterIndex].color, interStopProportion); - + // Clamp the positions to 0 and set the color. for (size_t i = 0; i < firstZeroOrGreaterIndex; ++i) { stops[i].offset = 0; @@ -274,16 +274,16 @@ class ConicGradientAdapter { break; } } - + if (lastOneOrLessIndex < numStops - 1) { if (lastOneOrLessIndex < numStops && stops[lastOneOrLessIndex].offset < 1) { float prevOffset = stops[lastOneOrLessIndex].offset; float nextOffset = stops[lastOneOrLessIndex + 1].offset; - + float interStopProportion = (1 - prevOffset) / (nextOffset - prevOffset); // FIXME: when we interpolate gradients using premultiplied colors, this should do premultiplication. Color blendedColor = blend(stops[lastOneOrLessIndex].color, stops[lastOneOrLessIndex + 1].color, interStopProportion); - + // Clamp the positions to 1 and set the color. for (size_t i = lastOneOrLessIndex + 1; i < numStops; ++i) { stops[i].offset = 1; @@ -485,7 +485,7 @@ Gradient::ColorStopVector CSSGradientValue::computeStops(GradientAdapter& gradie // calculate colors for (size_t y = 0; y < 9; ++y) { float relativeOffset = (newStops[y].offset - offset1) / (offset2 - offset1); - float multiplier = std::pow(relativeOffset, std::log(.5f) / std::log(midpoint)); + float multiplier = wtf_pow(relativeOffset, std::log(.5f) / std::log(midpoint)); // FIXME: Why not premultiply here? newStops[y].color = blend(color1, color2, multiplier, false /* do not premultiply */); } @@ -559,7 +559,7 @@ Gradient::ColorStopVector CSSGradientValue::computeStops(GradientAdapter& gradie // If the gradient goes outside the 0-1 range, normalize it by moving the endpoints, and adjusting the stops. if (stops.size() > 1 && (stops.first().offset < 0 || stops.last().offset > 1)) gradientAdapter.normalizeStopsAndEndpointsOutsideRange(stops); - + Gradient::ColorStopVector result; result.reserveInitialCapacity(stops.size()); for (auto& stop : stops) @@ -573,23 +573,23 @@ static float positionFromValue(const CSSPrimitiveValue* value, const CSSToLength int origin = 0; int sign = 1; int edgeDistance = isHorizontal ? size.width() : size.height(); - + // In this case the center of the gradient is given relative to an edge in the // form of: [ top | bottom | right | left ] [ | ]. if (value->isPair()) { CSSValueID originID = value->pairValue()->first()->valueID(); value = value->pairValue()->second(); - + if (originID == CSSValueRight || originID == CSSValueBottom) { // For right/bottom, the offset is relative to the far edge. origin = edgeDistance; sign = -1; } } - + if (value->isNumber()) return origin + sign * value->floatValue() * conversionData.zoom(); - + if (value->isPercentage()) return origin + sign * value->floatValue() / 100.f * edgeDistance; @@ -597,7 +597,7 @@ static float positionFromValue(const CSSPrimitiveValue* value, const CSSToLength Ref calculationValue { value->cssCalcValue()->createCalculationValue(conversionData) }; return origin + sign * calculationValue->evaluate(edgeDistance); } - + switch (value->valueID()) { case CSSValueTop: ASSERT(!isHorizontal); @@ -769,7 +769,7 @@ String CSSLinearGradientValue::customCSSText() const result.append(stop.m_position->cssText()); } } - + } result.append(')'); @@ -837,7 +837,7 @@ static void endPointsFromAngle(float angleDeg, const FloatSize& size, FloatPoint float endX = c / (slope - perpendicularSlope); float endY = perpendicularSlope * endX + c; - // We computed the end point, so set the second point, + // We computed the end point, so set the second point, // taking into account the moved origin and the fact that we're in drawing space (+y = down). secondPoint.set(halfWidth + endX, halfHeight - endY); // Reflect around the center for the start point. @@ -887,7 +887,7 @@ Ref CSSLinearGradientValue::createGradient(RenderElement& renderer, co // Compute angle, and flip it back to "bearing angle" degrees. float angle = 90 - rad2deg(atan2(rise, run)); endPointsFromAngle(angle, size, firstPoint, secondPoint, m_gradientType); - } else if (m_firstX || m_firstY) { + } else if (m_firstX || m_firstY) { secondPoint = computeEndPoint(m_firstX.get(), m_firstY.get(), conversionData, size); if (m_firstX) firstPoint.setX(size.width() - secondPoint.x()); @@ -1417,7 +1417,7 @@ String CSSConicGradientValue::customCSSText() const result.append(stop.m_position->cssText()); } } - + result.append(')'); return result.toString(); } diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index 0f016956e..ad61e11bc 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -363,16 +363,20 @@ class Document // pointer without introducing reference cycles. void incrementReferencingNodeCount() { +#if !defined(NDEBUG) ASSERT(!m_deletionHasBegun); +#endif ++m_referencingNodeCount; } void decrementReferencingNodeCount() { +#if !defined(NDEBUG) ASSERT(!m_deletionHasBegun || !m_referencingNodeCount); +#endif --m_referencingNodeCount; if (!m_referencingNodeCount && !refCount()) { -#if !ASSERT_DISABLED +#if !defined(NDEBUG) && !ASSERT_DISABLED m_deletionHasBegun = true; #endif m_refCountAndParentBit = s_refCountIncrement; // Avoid double destruction through use of Ref/RefPtr. (This is a security mitigation in case of programmer error. It will ASSERT in debug builds.) @@ -422,7 +426,7 @@ class Document WEBCORE_EXPORT DocumentType* doctype() const; WEBCORE_EXPORT DOMImplementation& implementation(); - + Element* documentElement() const { return m_documentElement.get(); } static ptrdiff_t documentElementMemoryOffset() { return OBJECT_OFFSETOF(Document, m_documentElement); } @@ -430,7 +434,7 @@ class Document WEBCORE_EXPORT bool hasFocus() const; bool hasManifest() const; - + WEBCORE_EXPORT ExceptionOr> createElementForBindings(const AtomString& tagName); WEBCORE_EXPORT Ref createDocumentFragment(); WEBCORE_EXPORT Ref createTextNode(const String& data); @@ -591,7 +595,7 @@ class Document unsigned lastStyleUpdateSizeForTesting() const { return m_lastStyleUpdateSizeForTesting; } WEBCORE_EXPORT void updateLayout(); - + // updateLayoutIgnorePendingStylesheets() forces layout even if we are waiting for pending stylesheet loads, // so calling this may cause a flash of unstyled content (FOUC). enum class RunPostLayoutTasks { Asynchronously, Synchronously }; @@ -627,9 +631,9 @@ class Document bool renderTreeBeingDestroyed() const { return m_renderTreeBeingDestroyed; } bool hasLivingRenderTree() const { return renderView() && !renderTreeBeingDestroyed(); } - + bool updateLayoutIfDimensionsOutOfDate(Element&, DimensionsCheck = AllDimensionsCheck); - + AXObjectCache* existingAXObjectCache() const; WEBCORE_EXPORT AXObjectCache* axObjectCache() const; void clearAXObjectCache(); @@ -638,7 +642,7 @@ class Document // to get visually ordered hebrew and arabic pages right void setVisuallyOrdered(); bool visuallyOrdered() const { return m_visuallyOrdered; } - + WEBCORE_EXPORT DocumentLoader* loader() const; WEBCORE_EXPORT ExceptionOr> openForBindings(DOMWindow& activeWindow, DOMWindow& firstDOMWindow, const String& url, const AtomString& name, const String& features); @@ -698,17 +702,17 @@ class Document bool usesStyleBasedEditability() const; void setHasElementUsingStyleBasedEditability(); - + virtual Ref createParser(); DocumentParser* parser() const { return m_parser.get(); } ScriptableDocumentParser* scriptableDocumentParser() const; - + bool printing() const { return m_printing; } void setPrinting(bool p) { m_printing = p; } bool paginatedForScreen() const { return m_paginatedForScreen; } void setPaginatedForScreen(bool p) { m_paginatedForScreen = p; } - + bool paginated() const { return printing() || paginatedForScreen(); } void setCompatibilityMode(DocumentCompatibilityMode); @@ -729,7 +733,7 @@ class Document bool shouldScheduleLayout(); bool isLayoutTimerActive(); Seconds timeSinceDocumentCreation() const; - + void setTextColor(const Color& color) { m_textColor = color; } const Color& textColor() const { return m_textColor; } @@ -888,7 +892,7 @@ class Document DOMTimerHoldingTank* domTimerHoldingTankIfExists() { return m_domTimerHoldingTank.get(); } DOMTimerHoldingTank& domTimerHoldingTank(); #endif - + void processViewport(const String& features, ViewportArguments::Type origin); void processDisabledAdaptations(const String& adaptations); void updateViewportArguments(); @@ -961,7 +965,7 @@ class Document // URL. For the top-level document, it is set to the document's URL. const URL& siteForCookies() const { return m_siteForCookies; } void setSiteForCookies(const URL& url) { m_siteForCookies = url; } - + // The following implements the rule from HTML 4 for what valid names are. // To get this right for all the XML cases, we probably have to improve this or move it // and make it sensitive to the type of document. @@ -1001,7 +1005,7 @@ class Document UndoManager& undoManager() const { return m_undoManager.get(); } // designMode support - enum InheritedBool { off = false, on = true, inherit }; + enum InheritedBool { off = false, on = true, inherit }; void setDesignMode(InheritedBool value); InheritedBool getDesignMode() const; bool inDesignMode() const; @@ -1010,7 +1014,7 @@ class Document Document* parentDocument() const; WEBCORE_EXPORT Document& topDocument() const; - + ScriptRunner& scriptRunner() { return *m_scriptRunner; } ScriptModuleLoader& moduleLoader() { return *m_moduleLoader; } @@ -1468,7 +1472,7 @@ class Document WEBCORE_EXPORT DocumentTimeline& timeline(); DocumentTimeline* existingTimeline() const { return m_timeline.get(); } Vector> getAnimations(); - + #if ENABLE(ATTACHMENT_ELEMENT) void registerAttachmentIdentifier(const String&); void didInsertAttachmentElement(HTMLAttachmentElement&); @@ -1709,7 +1713,7 @@ class Document std::unique_ptr m_axObjectCache; const std::unique_ptr m_markers; - + Timer m_styleRecalcTimer; Element* m_cssTarget { nullptr }; @@ -1717,7 +1721,7 @@ class Document RefPtr m_pendingStateObject; MonotonicTime m_documentCreationTime; bool m_overMinimumLayoutThreshold { false }; - + std::unique_ptr m_scriptRunner; std::unique_ptr m_moduleLoader; @@ -1816,7 +1820,7 @@ class Document DocumentTiming m_documentTiming; RefPtr m_mediaQueryMatcher; - + #if ENABLE(TOUCH_EVENTS) std::unique_ptr m_touchEventTargets; #endif @@ -2023,12 +2027,12 @@ class Document #endif HashSet m_applicationStateChangeListeners; - + #if ENABLE(RESOURCE_LOAD_STATISTICS) RegistrableDomain m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction { }; String m_referrerOverride; #endif - + CSSRegisteredCustomPropertySet m_CSSRegisteredPropertySet; #if ENABLE(CSS_PAINTING_API) diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index 5f85223ba..3b170ef3e 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -146,7 +146,7 @@ class Node : public EventTarget { Node* pseudoAwareLastChild() const; WEBCORE_EXPORT const URL& baseURI() const; - + void getSubresourceURLs(ListHashSet&) const; WEBCORE_EXPORT ExceptionOr insertBefore(Node& newChild, Node* refChild); @@ -179,7 +179,7 @@ class Node : public EventTarget { WEBCORE_EXPORT String textContent(bool convertBRsToNewlines = false) const; WEBCORE_EXPORT ExceptionOr setTextContent(const String&); - + Node* lastDescendant() const; Node* firstDescendant() const; @@ -263,7 +263,7 @@ class Node : public EventTarget { bool composed; }; Node& getRootNode(const GetRootNodeOptions&) const; - + void* opaqueRoot() const; // Use when it's guaranteed to that shadowHost is null. @@ -372,7 +372,7 @@ class Node : public EventTarget { // Returns true if this node is associated with a document and is in its associated document's // node tree, false otherwise (https://dom.spec.whatwg.org/#connected). bool isConnected() const - { + { return getFlag(IsConnectedFlag); } bool isInUserAgentShadowTree() const; @@ -422,7 +422,7 @@ class Node : public EventTarget { // Use these two methods with caution. WEBCORE_EXPORT RenderBox* renderBox() const; RenderBoxModelObject* renderBoxModelObject() const; - + // Wrapper for nodes that don't have a renderer, but still cache the style (like HTMLOptionElement). const RenderStyle* renderStyle() const; @@ -593,8 +593,8 @@ class Node : public EventTarget { }; bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } - void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } - void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } + void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } + void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } bool isParsingChildrenFinished() const { return getFlag(IsParsingChildrenFinishedFlag); } @@ -604,8 +604,8 @@ class Node : public EventTarget { enum ConstructionType { CreateOther = DefaultNodeFlags, CreateText = DefaultNodeFlags | IsTextFlag, - CreateContainer = DefaultNodeFlags | IsContainerFlag, - CreateElement = CreateContainer | IsElementFlag, + CreateContainer = DefaultNodeFlags | IsContainerFlag, + CreateElement = CreateContainer | IsElementFlag, CreatePseudoElement = CreateElement | IsConnectedFlag, CreateShadowRoot = CreateContainer | IsShadowRootFlag | IsInShadowTreeFlag, CreateDocumentFragment = CreateContainer, @@ -694,9 +694,11 @@ inline void adopted(Node* node) ALWAYS_INLINE void Node::ref() { ASSERT(isMainThread()); +#if !defined(NDEBUG) ASSERT(!m_deletionHasBegun); ASSERT(!m_inRemovedLastRefFunction); ASSERT(!m_adoptionIsRequired); +#endif m_refCountAndParentBit += s_refCountIncrement; } @@ -704,9 +706,11 @@ ALWAYS_INLINE void Node::deref() { ASSERT(isMainThread()); ASSERT(refCount()); +#if !defined(NDEBUG) ASSERT(!m_deletionHasBegun); ASSERT(!m_inRemovedLastRefFunction); ASSERT(!m_adoptionIsRequired); +#endif auto updatedRefCount = m_refCountAndParentBit - s_refCountIncrement; if (!updatedRefCount) { // Don't update m_refCountAndParentBit to avoid double destruction through use of Ref/RefPtr. @@ -722,8 +726,10 @@ ALWAYS_INLINE void Node::deref() ALWAYS_INLINE bool Node::hasOneRef() const { +#if !defined(NDEBUG) ASSERT(!m_deletionHasBegun); ASSERT(!m_inRemovedLastRefFunction); +#endif return refCount() == 1; } @@ -786,7 +792,9 @@ inline void Node::setHasValidStyle() inline void Node::setTreeScopeRecursively(TreeScope& newTreeScope) { ASSERT(!isDocumentNode()); +#if !defined(NDEBUG) ASSERT(!m_deletionHasBegun); +#endif if (m_treeScope != &newTreeScope) moveTreeToNewScope(*this, *m_treeScope, newTreeScope); } diff --git a/Source/WebCore/domjit/generate-abstract-heap.rb b/Source/WebCore/domjit/generate-abstract-heap.rb index 8a9d93271..c944e21f2 100644 --- a/Source/WebCore/domjit/generate-abstract-heap.rb +++ b/Source/WebCore/domjit/generate-abstract-heap.rb @@ -147,6 +147,12 @@ def printIndent output, indent $inputFileName = ARGV.shift $outputFileName = ARGV.shift + +print "Input: " +puts $inputFileName +print "Output: " +puts $outputFileName + File.open($outputFileName, "w") {|output| File.open($inputFileName, "rb") {|file| tree = YAML::load(file.read()) diff --git a/Source/WebCore/platform/graphics/ColorUtilities.cpp b/Source/WebCore/platform/graphics/ColorUtilities.cpp index 7e9f9892d..abc07643f 100644 --- a/Source/WebCore/platform/graphics/ColorUtilities.cpp +++ b/Source/WebCore/platform/graphics/ColorUtilities.cpp @@ -50,7 +50,7 @@ float linearToSRGBColorComponent(float c) if (c < 0.0031308f) return 12.92f * c; - return clampTo(1.055f * std::pow(c, 1.0f / 2.4f) - 0.055f, 0, 1); + return clampTo(1.055f * wtf_pow(c, 1.0f / 2.4f) - 0.055f, 0, 1); } float sRGBToLinearColorComponent(float c) @@ -58,7 +58,7 @@ float sRGBToLinearColorComponent(float c) if (c <= 0.04045f) return c / 12.92f; - return clampTo(std::pow((c + 0.055f) / 1.055f, 2.4f), 0, 1); + return clampTo(wtf_pow((c + 0.055f) / 1.055f, 2.4f), 0, 1); } FloatComponents sRGBColorToLinearComponents(const Color& color) @@ -101,7 +101,7 @@ static float sRGBToLinearColorComponentForLuminance(float c) if (c <= 0.03928f) return c / 12.92f; - return clampTo(std::pow((c + 0.055f) / 1.055f, 2.4f), 0, 1); + return clampTo(wtf_pow((c + 0.055f) / 1.055f, 2.4f), 0, 1); } float luminance(const FloatComponents& sRGBComponents) @@ -202,10 +202,10 @@ FloatComponents HSLToSRGB(const FloatComponents& hslColor) hslColor.components[3] }; } - + float temp2 = lightness <= 0.5f ? lightness * (1.0f + saturation) : lightness + saturation - lightness * saturation; float temp1 = 2.0f * lightness - temp2; - + hue *= 6.0f; // calcHue() wants hue in the 0-6 range. return { calcHue(temp1, temp2, hue + 2.0f), @@ -274,7 +274,7 @@ ColorMatrix ColorMatrix::grayscaleMatrix(float amount) matrix.m_matrix[2][0] = 0.2126f - 0.2126f * oneMinusAmount; matrix.m_matrix[2][1] = 0.7152f - 0.7152f * oneMinusAmount; matrix.m_matrix[2][2] = 0.0722f + 0.9278f * oneMinusAmount; - + return matrix; } diff --git a/Source/WebCore/platform/network/curl/CurlContext.h b/Source/WebCore/platform/network/curl/CurlContext.h index 7d06068cd..d01399b8f 100644 --- a/Source/WebCore/platform/network/curl/CurlContext.h +++ b/Source/WebCore/platform/network/curl/CurlContext.h @@ -21,7 +21,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once @@ -37,8 +37,8 @@ #include #if OS(WINDOWS) -#include #include +#include #endif #include @@ -60,7 +60,7 @@ class CurlGlobal { { curl_global_init(CURL_GLOBAL_ALL); } - + virtual ~CurlGlobal() { curl_global_cleanup(); diff --git a/Source/WebCore/rendering/FloatingObjects.h b/Source/WebCore/rendering/FloatingObjects.h index 250b33d45..3c44b2db5 100644 --- a/Source/WebCore/rendering/FloatingObjects.h +++ b/Source/WebCore/rendering/FloatingObjects.h @@ -59,15 +59,21 @@ class FloatingObject { LayoutUnit width() const { return m_frameRect.width(); } LayoutUnit height() const { return m_frameRect.height(); } - void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); } - void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); } - void setWidth(LayoutUnit width) { ASSERT(!isInPlacedTree()); m_frameRect.setWidth(width); } - void setHeight(LayoutUnit height) { ASSERT(!isInPlacedTree()); m_frameRect.setHeight(height); } + inline void checkIsInPlacedTree() { +#if !defined(NDEBUG) + ASSERT(!isInPlacedTree()); +#endif + } + + void setX(LayoutUnit x) { checkIsInPlacedTree(); m_frameRect.setX(x); } + void setY(LayoutUnit y) { checkIsInPlacedTree(); m_frameRect.setY(y); } + void setWidth(LayoutUnit width) { checkIsInPlacedTree(); m_frameRect.setWidth(width); } + void setHeight(LayoutUnit height) { checkIsInPlacedTree(); m_frameRect.setHeight(height); } - void setMarginOffset(LayoutSize offset) { ASSERT(!isInPlacedTree()); m_marginOffset = offset; } + void setMarginOffset(LayoutSize offset) { checkIsInPlacedTree(); m_marginOffset = offset; } const LayoutRect& frameRect() const { ASSERT(isPlaced()); return m_frameRect; } - void setFrameRect(const LayoutRect& frameRect) { ASSERT(!isInPlacedTree()); m_frameRect = frameRect; } + void setFrameRect(const LayoutRect& frameRect) { checkIsInPlacedTree(); m_frameRect = frameRect; } LayoutUnit paginationStrut() const { return m_paginationStrut; } void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; } diff --git a/Source/WebCore/rendering/RenderElement.h b/Source/WebCore/rendering/RenderElement.h index 63824e40b..3ef5b83f4 100644 --- a/Source/WebCore/rendering/RenderElement.h +++ b/Source/WebCore/rendering/RenderElement.h @@ -242,7 +242,7 @@ class RenderElement : public RenderObject { RenderBlockFlag = 1 << 4, RenderBlockFlowFlag = 1 << 5, }; - + typedef unsigned BaseTypeFlags; RenderElement(Element&, RenderStyle&&, BaseTypeFlags); @@ -286,7 +286,7 @@ class RenderElement : public RenderObject { void removeFromRenderFragmentedFlowIncludingDescendants(bool shouldUpdateState); void adjustFragmentedFlowStateOnContainingBlockChangeIfNeeded(); - + bool isVisibleInViewport() const; private: @@ -324,7 +324,7 @@ class RenderElement : public RenderObject { bool getTrailingCorner(FloatPoint& output, bool& insideFixed) const; void clearSubtreeLayoutRootIfNeeded() const; - + bool shouldWillChangeCreateStackingContext() const; void issueRepaintForOutlineAuto(float outlineSize); @@ -365,7 +365,9 @@ inline void RenderElement::setAncestorLineBoxDirty(bool f) inline void RenderElement::setChildNeedsLayout(MarkingBehavior markParents) { +#if !defined(NDEBUG) ASSERT(!isSetNeedsLayoutForbidden()); +#endif if (normalChildNeedsLayout()) return; setNormalChildNeedsLayoutBit(true); diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index ef38ae262..092a3f7e5 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -180,7 +180,7 @@ class RenderObject : public CachedImageClient, public CanMakeWeakPtr&, const LayoutPoint& /* additionalOffset */, const RenderLayerModelObject* /* paintContainer */ = nullptr) { }; LayoutRect absoluteOutlineBounds() const @@ -899,7 +899,7 @@ class RenderObject : public CachedImageClient, public CanMakeWeakPtr(m_selectionState); } ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_selectionState = selectionState; } - + ALWAYS_INLINE FragmentedFlowState fragmentedFlowState() const { return static_cast(m_fragmentedFlowState); } ALWAYS_INLINE void setFragmentedFlowState(FragmentedFlowState fragmentedFlowState) { m_fragmentedFlowState = fragmentedFlowState; } @@ -979,11 +979,11 @@ class RenderObject : public CachedImageClient, public CanMakeWeakPtr cachedFirstLineStyle; }; - + const RenderObject::RenderObjectRareData& rareData() const; RenderObjectRareData& ensureRareData(); void removeRareData(); - + typedef HashMap> RareDataMap; static RareDataMap& rareDataMap(); @@ -1046,7 +1046,9 @@ inline bool RenderObject::isBeforeOrAfterContent() const inline void RenderObject::setNeedsLayout(MarkingBehavior markParents) { +#if !defined(NDEBUG) ASSERT(!isSetNeedsLayoutForbidden()); +#endif if (m_bitfields.needsLayout()) return; m_bitfields.setNeedsLayout(true); @@ -1060,7 +1062,7 @@ inline bool RenderObject::preservesNewline() const { if (isSVGInlineText()) return false; - + return style().preserveNewline(); } diff --git a/Source/cmake/OptionsCommon.cmake b/Source/cmake/OptionsCommon.cmake index a574ef8c2..7ebea5c81 100644 --- a/Source/cmake/OptionsCommon.cmake +++ b/Source/cmake/OptionsCommon.cmake @@ -130,40 +130,50 @@ endif () # Check whether features.h header exists. # Including glibc's one defines __GLIBC__, that is used in Platform.h -WEBKIT_CHECK_HAVE_INCLUDE(HAVE_FEATURES_H features.h) +if (NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")) + WEBKIT_CHECK_HAVE_INCLUDE(HAVE_FEATURES_H features.h) +endif () # Check for headers WEBKIT_CHECK_HAVE_INCLUDE(HAVE_ERRNO_H errno.h) -WEBKIT_CHECK_HAVE_INCLUDE(HAVE_LANGINFO_H langinfo.h) -WEBKIT_CHECK_HAVE_INCLUDE(HAVE_MMAP sys/mman.h) -WEBKIT_CHECK_HAVE_INCLUDE(HAVE_PTHREAD_NP_H pthread_np.h) +if (NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")) + WEBKIT_CHECK_HAVE_INCLUDE(HAVE_LANGINFO_H langinfo.h) + WEBKIT_CHECK_HAVE_INCLUDE(HAVE_MMAP sys/mman.h) + WEBKIT_CHECK_HAVE_INCLUDE(HAVE_PTHREAD_NP_H pthread_np.h) +endif () WEBKIT_CHECK_HAVE_INCLUDE(HAVE_STRINGS_H strings.h) WEBKIT_CHECK_HAVE_INCLUDE(HAVE_SYS_PARAM_H sys/param.h) WEBKIT_CHECK_HAVE_INCLUDE(HAVE_SYS_TIME_H sys/time.h) WEBKIT_CHECK_HAVE_INCLUDE(HAVE_SYS_TIMEB_H sys/timeb.h) -WEBKIT_CHECK_HAVE_INCLUDE(HAVE_LINUX_MEMFD_H linux/memfd.h) +if (NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")) + WEBKIT_CHECK_HAVE_INCLUDE(HAVE_LINUX_MEMFD_H linux/memfd.h) +endif () # Check for functions WEBKIT_CHECK_HAVE_FUNCTION(HAVE_ALIGNED_MALLOC _aligned_malloc) WEBKIT_CHECK_HAVE_FUNCTION(HAVE_ISDEBUGGERPRESENT IsDebuggerPresent) -WEBKIT_CHECK_HAVE_FUNCTION(HAVE_LOCALTIME_R localtime_r) -WEBKIT_CHECK_HAVE_FUNCTION(HAVE_MALLOC_TRIM malloc_trim) -WEBKIT_CHECK_HAVE_FUNCTION(HAVE_STRNSTR strnstr) -WEBKIT_CHECK_HAVE_FUNCTION(HAVE_TIMEGM timegm) +if (NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")) + WEBKIT_CHECK_HAVE_FUNCTION(HAVE_LOCALTIME_R localtime_r) + WEBKIT_CHECK_HAVE_FUNCTION(HAVE_MALLOC_TRIM malloc_trim) + WEBKIT_CHECK_HAVE_FUNCTION(HAVE_STRNSTR strnstr) + WEBKIT_CHECK_HAVE_FUNCTION(HAVE_TIMEGM timegm) +endif () WEBKIT_CHECK_HAVE_FUNCTION(HAVE_VASPRINTF vasprintf) # Check for symbols -WEBKIT_CHECK_HAVE_SYMBOL(HAVE_REGEX_H regexec regex.h) -if (NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")) -WEBKIT_CHECK_HAVE_SYMBOL(HAVE_PTHREAD_MAIN_NP pthread_main_np pthread_np.h) -endif () -# Windows has signal.h but is missing symbols that are used in calls to signal. -WEBKIT_CHECK_HAVE_SYMBOL(HAVE_SIGNAL_H SIGTRAP signal.h) +if (NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")) + WEBKIT_CHECK_HAVE_SYMBOL(HAVE_REGEX_H regexec regex.h) + if (NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")) + WEBKIT_CHECK_HAVE_SYMBOL(HAVE_PTHREAD_MAIN_NP pthread_main_np pthread_np.h) + endif () + # Windows has signal.h but is missing symbols that are used in calls to signal. + WEBKIT_CHECK_HAVE_SYMBOL(HAVE_SIGNAL_H SIGTRAP signal.h) -# Check for struct members -WEBKIT_CHECK_HAVE_STRUCT(HAVE_STAT_BIRTHTIME "struct stat" st_birthtime sys/stat.h) -WEBKIT_CHECK_HAVE_STRUCT(HAVE_TM_GMTOFF "struct tm" tm_gmtoff time.h) -WEBKIT_CHECK_HAVE_STRUCT(HAVE_TM_ZONE "struct tm" tm_zone time.h) + # Check for struct members + WEBKIT_CHECK_HAVE_STRUCT(HAVE_STAT_BIRTHTIME "struct stat" st_birthtime sys/stat.h) + WEBKIT_CHECK_HAVE_STRUCT(HAVE_TM_GMTOFF "struct tm" tm_gmtoff time.h) + WEBKIT_CHECK_HAVE_STRUCT(HAVE_TM_ZONE "struct tm" tm_zone time.h) +endif () # Check for int types check_type_size("__int128_t" INT128_VALUE) diff --git a/Source/cmake/OptionsFTW.cmake b/Source/cmake/OptionsFTW.cmake index 6cf389a9d..ab8f8f1c4 100644 --- a/Source/cmake/OptionsFTW.cmake +++ b/Source/cmake/OptionsFTW.cmake @@ -13,7 +13,9 @@ endif () set(PORT FTW) # Compilation options -include(OptionsMSVC) +if (MSVC) + include(OptionsMSVC) +endif () add_definitions(-DWTF_PLATFORM_FTW=1) # Prevent min() and max() macros from being exposed @@ -110,7 +112,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_STREAMS_API PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SVG_FONTS PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PRIVATE OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_SLIDER PRIVATE OFF) -WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_UNIFIED_BUILDS PRIVATE ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_UNIFIED_BUILDS PRIVATE OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PRIVATE ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBASSEMBLY PRIVATE OFF) @@ -146,6 +148,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGPU PRIVATE OFF) # Off for now, but should be on WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PRIVATE OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE OFF) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RELEASE_ASSERTIONS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_APPLICATION_MANIFEST PRIVATE OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASYNC_SCROLLING PRIVATE OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_EXTENSIONS PRIVATE OFF) diff --git a/Source/cmake/OptionsMSVC.cmake b/Source/cmake/OptionsMSVC.cmake index df2ffb43f..47c06ef23 100644 --- a/Source/cmake/OptionsMSVC.cmake +++ b/Source/cmake/OptionsMSVC.cmake @@ -1,3 +1,6 @@ + +if (MSVC) + add_compile_options( /wd4018 /wd4068 /wd4099 /wd4100 /wd4127 /wd4138 /wd4146 /wd4180 /wd4189 /wd4201 /wd4206 /wd4244 /wd4251 /wd4267 /wd4275 /wd4288 /wd4291 /wd4305 @@ -107,3 +110,9 @@ if (COMPILER_IS_CLANG_CL) set(HAVE_INT128_T OFF) list(REMOVE_ITEM _WEBKIT_CONFIG_FILE_VARIABLES HAVE_INT128_T) endif () + +else () + + message(FATAL_ERROR, "MSVC options being used on non-MSVC compatible compiler.") + +endif () \ No newline at end of file diff --git a/Source/cmake/OptionsUltralightLinux.cmake b/Source/cmake/OptionsUltralightLinux.cmake index df17c56d2..d51123e79 100644 --- a/Source/cmake/OptionsUltralightLinux.cmake +++ b/Source/cmake/OptionsUltralightLinux.cmake @@ -16,6 +16,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PUBLIC OFF) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RELEASE_ASSERTIONS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ATTACHMENT_ELEMENT PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CHANNEL_MESSAGING PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT PUBLIC OFF) diff --git a/Source/cmake/OptionsUltralightMac.cmake b/Source/cmake/OptionsUltralightMac.cmake index 05b5a82af..30cba658a 100644 --- a/Source/cmake/OptionsUltralightMac.cmake +++ b/Source/cmake/OptionsUltralightMac.cmake @@ -14,6 +14,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PUBLIC OFF) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RELEASE_ASSERTIONS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ATTACHMENT_ELEMENT PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CHANNEL_MESSAGING PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT PUBLIC OFF) diff --git a/Source/cmake/OptionsUltralightWin.cmake b/Source/cmake/OptionsUltralightWin.cmake index 5615b8f8c..26a34b075 100644 --- a/Source/cmake/OptionsUltralightWin.cmake +++ b/Source/cmake/OptionsUltralightWin.cmake @@ -5,6 +5,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PUBLIC OFF) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RELEASE_ASSERTIONS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ATTACHMENT_ELEMENT PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CHANNEL_MESSAGING PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT PUBLIC OFF) @@ -91,7 +92,7 @@ if (MSVC) ) if (UWP_PLATFORM) - add_definitions(-DUWP_PLATFORM) + add_definitions(-DUWP_PLATFORM) endif () # We do not use exceptions @@ -103,19 +104,19 @@ if (MSVC) # Use CRT security features add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1) - + # Turn off certain link features #add_compile_options(/Gy- /openmp- /GF-) - + IF( NOT CMAKE_BUILD_TYPE ) SET( CMAKE_BUILD_TYPE Release ) ENDIF() - + # Force CMake to use the actual linker for linking instead of the C Compiler front-end # See Modules/CMakeCInformation.cmake in CMake's source distribution #set(CMAKE_C_LINK_EXECUTABLE # " -o ") - + # Force CMake to use the actual linker for linking instead of the CXX Compiler front-end # See Modules/CMakeCXXInformation.cmake in CMake's source distribution #set(CMAKE_CXX_LINK_EXECUTABLE @@ -124,11 +125,11 @@ if (MSVC) # Needed for bmalloc on Windows set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") - + if (${CMAKE_BUILD_TYPE} MATCHES Debug OR ${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo) # Create pdb files for debugging purposes # add_compile_options(/Zi /GS) - + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG /OPT:NOREF /OPT:NOICF /DEBUG:FASTLINK") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /OPT:NOREF /OPT:NOICF /DEBUG:FASTLINK") @@ -143,7 +144,7 @@ if (MSVC) #set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /OPT:REF /OPT:ICF /LTCG /INCREMENTAL:NO") #set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /OPT:REF /OPT:ICF /LTCG /INCREMENTAL:NO") add_compile_options(/Os /cgthreads8) - + # Uncomment this block to add PDB to optimized release builds #add_compile_options(/Zi) #set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /OPT:ICF /DEBUG") diff --git a/Source/cmake/OptionsWin.cmake b/Source/cmake/OptionsWin.cmake index cbdc301a8..2e26375da 100644 --- a/Source/cmake/OptionsWin.cmake +++ b/Source/cmake/OptionsWin.cmake @@ -21,6 +21,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_OVERFLOW_SCROLLING_TOUCH PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PUBLIC ON) +WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RELEASE_ASSERTIONS PUBLIC OFF) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ATTACHMENT_ELEMENT PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CHANNEL_MESSAGING PUBLIC ON) WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT PUBLIC OFF) diff --git a/Source/cmake/WebKitCommon.cmake b/Source/cmake/WebKitCommon.cmake index 97b9f20cb..a270981d4 100644 --- a/Source/cmake/WebKitCommon.cmake +++ b/Source/cmake/WebKitCommon.cmake @@ -10,6 +10,8 @@ if (NOT HAS_RUN_WEBKIT_COMMON) # Find common packages (used by all ports) # ----------------------------------------------------------------------------- if (WIN32) + list(APPEND CMAKE_PROGRAM_PATH $ENV{SystemDrive}/ProgramData/msys64/mingw64/bin) + list(APPEND CMAKE_PROGRAM_PATH $ENV{SystemDrive}/msys64/mingw64/bin) list(APPEND CMAKE_PROGRAM_PATH $ENV{SystemDrive}/cygwin/bin) endif () diff --git a/Source/cmake/WebKitFeatures.cmake b/Source/cmake/WebKitFeatures.cmake index f9fe394d3..2b4d243f9 100644 --- a/Source/cmake/WebKitFeatures.cmake +++ b/Source/cmake/WebKitFeatures.cmake @@ -93,6 +93,7 @@ macro(WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_ACCESSIBILITY "Whether to enable support for accessibility" PRIVATE ON) WEBKIT_OPTION_DEFINE(ENABLE_ACCESSIBILITY_STATIC_TREE "Toggle static accessibility tree support" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_API_TESTS "Enable public API unit tests" PRIVATE OFF) + WEBKIT_OPTION_DEFINE(ENABLE_RELEASE_ASSERTIONS "Enable runtime assertions" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_APPLE_PAY "Toggle Apply Pay support" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_APPLE_PAY_SESSION_V3 "Toggle Apple Pay Session V3 support" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_APPLE_PAY_SESSION_V4 "Toggle Apple Pay Session V4 support" PRIVATE OFF) @@ -126,6 +127,7 @@ macro(WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_DATA_INTERACTION "Toggle data interaction support" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_DEVICE_ORIENTATION "Toggle Device Orientation support" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_DFG_JIT "Toggle data flow graph JIT tier" PRIVATE ${ENABLE_JIT_DEFAULT}) + WEBKIT_OPTION_DEFINE(ENABLE_DISASSEMBLER "Toggle disassembly support" PUBLIC OFF) WEBKIT_OPTION_DEFINE(ENABLE_DOWNLOAD_ATTRIBUTE "Toggle Download Attribute support" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_DRAG_SUPPORT "Toggle support of drag actions (including selection of text with mouse)" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_ENCRYPTED_MEDIA "Toggle EME V3 support" PRIVATE OFF) @@ -204,7 +206,7 @@ macro(WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEFINE(ENABLE_TEXT_AUTOSIZING "Toggle automatic text size adjustment support" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_EVENTS "Toggle Touch Events support" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_SLIDER "Toggle Touch Slider support" PRIVATE OFF) - WEBKIT_OPTION_DEFINE(ENABLE_UNIFIED_BUILDS "Toggle unified builds" PRIVATE ON) + WEBKIT_OPTION_DEFINE(ENABLE_UNIFIED_BUILDS "Toggle unified builds" PRIVATE OFF) WEBKIT_OPTION_DEFINE(ENABLE_USERSELECT_ALL "Toggle user-select:all support" PRIVATE ON) WEBKIT_OPTION_DEFINE(ENABLE_USER_MESSAGE_HANDLERS "Toggle user script message handler support" PRIVATE ON) WEBKIT_OPTION_DEFINE(ENABLE_VARIATION_FONTS "Toggle variation fonts support" PRIVATE OFF) @@ -238,6 +240,7 @@ macro(WEBKIT_OPTION_BEGIN) WEBKIT_OPTION_DEPEND(ENABLE_LEGACY_ENCRYPTED_MEDIA ENABLE_VIDEO) WEBKIT_OPTION_DEPEND(ENABLE_DFG_JIT ENABLE_JIT) WEBKIT_OPTION_DEPEND(ENABLE_FTL_JIT ENABLE_DFG_JIT) + WEBKIT_OPTION_DEPEND(ENABLE_DISASSEMBLER ENABLE_JIT) WEBKIT_OPTION_DEPEND(ENABLE_WEBASSEMBLY ENABLE_FTL_JIT) WEBKIT_OPTION_DEPEND(ENABLE_INDEXED_DATABASE_IN_WORKERS ENABLE_INDEXED_DATABASE) WEBKIT_OPTION_DEPEND(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS ENABLE_REMOTE_INSPECTOR)