Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif ()

set(WEBCORE_DEPS_REV "df325984")
set(GSTREAMER_REV "e78cae57")
set(ULTRALIGHTCORE_REV "07737e9d")
set(ULTRALIGHTCORE_REV "41a04e01")

if (${ALLINONE_BUILD})
message("Using local deps from all-in-one build.")
Expand Down
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pipeline {
# Build Release
mkdir -p build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUL_GENERATE_SDK=1
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUL_GENERATE_SDK=1 -DUL_ENABLE_VIDEO=0
ninja
cd ..
'''
Expand All @@ -55,7 +55,7 @@ pipeline {
rem Build Release
if not exist build mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUWP_PLATFORM=0 -DWINDOWS_DESKTOP_PLATFORM=1 -DUL_GENERATE_SDK=1
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUWP_PLATFORM=0 -DWINDOWS_DESKTOP_PLATFORM=1 -DUL_GENERATE_SDK=1 -DUL_ENABLE_VIDEO=0
ninja
cd ..
'''
Expand Down Expand Up @@ -87,7 +87,7 @@ pipeline {
cd build
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUL_GENERATE_SDK=1
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DUL_GENERATE_SDK=1 -DUL_ENABLE_VIDEO=0
ninja
cd ..
'''
Expand Down
12 changes: 12 additions & 0 deletions Source/JavaScriptCore/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@
#undef new
#undef delete
#include <wtf/FastMalloc.h>

#if USE(ULTRALIGHT)
#include <Ultralight/private/tracy/Tracy.hpp>
#include <wtf/MemoryProfiler.h>
#else
#define ProfileAlloc(ptr, size, name)
#define ProfileFree(ptr, name)
#define ProfiledZone
#define ProfiledMemoryZone(tag)
#endif


#endif // #ifdef __cplusplus

#include <wtf/DisallowCType.h>
6 changes: 6 additions & 0 deletions Source/JavaScriptCore/interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ void Interpreter::notifyDebuggerOfExceptionToBeThrown(VM& vm, CallFrame* callFra

JSValue Interpreter::executeProgram(const SourceCode& source, CallFrame* callFrame, JSObject* thisObj)
{
ProfiledZone;
JSScope* scope = thisObj->globalObject()->globalScope();
VM& vm = *scope->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
Expand Down Expand Up @@ -848,6 +849,7 @@ JSValue Interpreter::executeProgram(const SourceCode& source, CallFrame* callFra

JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args)
{
ProfiledZone;
VM& vm = callFrame->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);

Expand Down Expand Up @@ -913,6 +915,7 @@ JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallT

JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* constructor, ConstructType constructType, const ConstructData& constructData, const ArgList& args, JSValue newTarget)
{
ProfiledZone;
VM& vm = callFrame->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);

Expand Down Expand Up @@ -987,6 +990,7 @@ JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* construc

CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, ProtoCallFrame* protoCallFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope, const ArgList& args)
{
ProfiledZone;
VM& vm = *scope->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
throwScope.assertNoException();
Expand All @@ -1012,6 +1016,7 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionE

JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, JSScope* scope)
{
ProfiledZone;
VM& vm = *scope->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);

Expand Down Expand Up @@ -1161,6 +1166,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue

JSValue Interpreter::executeModuleProgram(ModuleProgramExecutable* executable, CallFrame* callFrame, JSModuleEnvironment* scope)
{
ProfiledZone;
VM& vm = *scope->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);

Expand Down
1 change: 1 addition & 0 deletions Source/JavaScriptCore/jit/JITCodeInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace JSC {

ALWAYS_INLINE JSValue JITCode::execute(VM* vm, ProtoCallFrame* protoCallFrame)
{
ProfiledZone;
auto scope = DECLARE_THROW_SCOPE(*vm);
void* entryAddress;
entryAddress = addressForCall(MustCheckArity).executableAddress();
Expand Down
1 change: 1 addition & 0 deletions Source/JavaScriptCore/runtime/CallData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ JSValue call(ExecState* exec, JSValue functionObject, JSValue thisValue, const A

JSValue call(ExecState* exec, JSValue functionObject, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args)
{
ProfiledZone;
ProfiledMemoryZone(MemoryTag::JavaScript);
VM& vm = exec->vm();
ASSERT(callType == CallType::JS || callType == CallType::Host);
Expand Down
1 change: 1 addition & 0 deletions Source/JavaScriptCore/runtime/ScriptExecutable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ static void setupJIT(VM& vm, CodeBlock* codeBlock)
Exception* ScriptExecutable::prepareForExecutionImpl(
VM& vm, JSFunction* function, JSScope* scope, CodeSpecializationKind kind, CodeBlock*& resultCodeBlock)
{
ProfiledZone;
ProfiledMemoryZone(MemoryTag::JavaScript_Bytecode);
auto throwScope = DECLARE_THROW_SCOPE(vm);
DeferGCForAWhile deferGC(vm.heap);
Expand Down
3 changes: 2 additions & 1 deletion Source/WTF/wtf/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,8 @@
#define HAVE_TM_GMTOFF 1
#define HAVE_TM_ZONE 1
#define HAVE_TIMEGM 1
#define HAVE_PTHREAD_MAIN_NP 1
// Allows running off the main thread on macOS
#define HAVE_PTHREAD_MAIN_NP 0

#if CPU(X86_64) || CPU(ARM64)
#define HAVE_INT128_T 1
Expand Down
3 changes: 3 additions & 0 deletions Source/WebCore/bindings/js/ScheduledAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void ScheduledAction::execute(ScriptExecutionContext& context)

void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSValue thisValue, ScriptExecutionContext& context)
{
ProfiledZone;
ASSERT(m_function);
VM& vm = context.vm();
JSLockHolder lock(vm);
Expand Down Expand Up @@ -125,6 +126,7 @@ void ScheduledAction::executeFunctionInContext(JSGlobalObject* globalObject, JSV

void ScheduledAction::execute(Document& document)
{
ProfiledZone;
JSDOMWindow* window = toJSDOMWindow(document.frame(), m_isolatedWorld);
if (!window)
return;
Expand All @@ -141,6 +143,7 @@ void ScheduledAction::execute(Document& document)

void ScheduledAction::execute(WorkerGlobalScope& workerGlobalScope)
{
ProfiledZone;
// In a Worker, the execution should always happen on a worker thread.
ASSERT(workerGlobalScope.thread().thread() == &Thread::current());

Expand Down
10 changes: 10 additions & 0 deletions Source/WebCore/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@

#include <ciso646>

#if USE(ULTRALIGHT)
#include <Ultralight/private/tracy/Tracy.hpp>
#include <wtf/MemoryProfiler.h>
#else
#define ProfileAlloc(ptr, size, name)
#define ProfileFree(ptr, name)
#define ProfiledZone
#define ProfiledMemoryZone(tag)
#endif

#endif

#include <wtf/DisallowCType.h>
Expand Down
6 changes: 2 additions & 4 deletions Source/WebCore/editing/ApplyBlockElementCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,9 @@ void ApplyBlockElementCommand::formatSelection(const VisiblePosition& startOfSel
if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent().anchorNode()->isConnected())
break;
// Sanity check: Make sure our moveParagraph calls didn't remove endOfNextParagraph.deepEquivalent().deprecatedNode()
// If somehow we did, return to prevent crashes.
if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().anchorNode()->isConnected()) {
ASSERT_NOT_REACHED();
// If somehow, e.g. mutation event handler, we did, return to prevent crashes.
if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().anchorNode()->isConnected())
return;
}
endOfCurrentParagraph = endOfNextParagraph;
}
}
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/loader/SubresourceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ void SubresourceLoader::didReceiveBuffer(Ref<SharedBuffer>&& buffer, long long e

void SubresourceLoader::didReceiveDataOrBuffer(const char* data, int length, RefPtr<SharedBuffer>&& buffer, long long encodedDataLength, DataPayloadType dataPayloadType)
{
ProfiledZone;
ASSERT(m_resource);

if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgnoreHTTPStatusCodeErrors())
Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/platform/graphics/GradientImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

#include "GraphicsContext.h"
#include "ImageBuffer.h"
#if USE(ULTRALIGHT)
#include "PlatformContextUltralight.h"
#endif

namespace WebCore {

Expand Down Expand Up @@ -65,6 +68,7 @@ void GradientImage::drawPattern(GraphicsContext& destContext, const FloatRect& d
double xScale = fabs(destContextCTM.xScale());
double yScale = fabs(destContextCTM.yScale());
#if USE(ULTRALIGHT)
// FIXME: Disable upscaling due to transform math issues
xScale = 1.0;
yScale = 1.0;
#endif
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/platform/graphics/GraphicsContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, con

void GraphicsContext::drawGlyphs(const Font& font, const GlyphBuffer& buffer, unsigned from, unsigned numGlyphs, const FloatPoint& point, FontSmoothingMode fontSmoothingMode)
{
ProfiledZone;
if (paintingDisabled())
return;

Expand Down Expand Up @@ -726,6 +727,7 @@ ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destin

ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)
{
ProfiledZone;
if (paintingDisabled())
return ImageDrawResult::DidNothing;

Expand All @@ -738,6 +740,7 @@ ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destin

ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions)
{
ProfiledZone;
if (paintingDisabled())
return ImageDrawResult::DidNothing;

Expand All @@ -751,6 +754,7 @@ ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& d
ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor,
Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions)
{
ProfiledZone;
if (paintingDisabled())
return ImageDrawResult::DidNothing;

Expand Down Expand Up @@ -778,6 +782,7 @@ void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatRect& desti

void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)
{
ProfiledZone;
if (paintingDisabled())
return;

Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/platform/graphics/ImageSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ bool ImageSource::ensureDecoderAvailable(SharedBuffer* data)

void ImageSource::setData(SharedBuffer* data, bool allDataReceived)
{
ProfiledZone;
if (!data || !ensureDecoderAvailable(data))
return;

Expand All @@ -104,6 +105,7 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived)

void ImageSource::resetData(SharedBuffer* data)
{
ProfiledZone;
m_decoder = nullptr;
setData(data, isAllDataReceived());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ namespace WebCore {
[&](const LinearData& data) -> PlatformGradient {
auto grad = new ultralight::Gradient();
grad->is_radial = false;
grad->num_stops = 0;
grad->p0 = ultralight::Point(data.point0.x(), data.point0.y());
grad->p1 = ultralight::Point(data.point1.x(), data.point1.y());
return grad;
},
[&](const RadialData& data) -> PlatformGradient {
auto grad = new ultralight::Gradient();
grad->is_radial = true;
grad->num_stops = 0;
grad->p0 = ultralight::Point(data.point0.x(), data.point0.y());
grad->p1 = ultralight::Point(data.point1.x(), data.point1.y());
grad->r0 = data.startRadius;
Expand All @@ -58,14 +56,14 @@ namespace WebCore {

size_t num_stops = m_stops.size();

// Clamp to 12 stops
if (num_stops > 12)
num_stops = 12;
// Reserve capacity ahead of time to reduce reallocations
m_gradient->stops.reserve(num_stops);

m_gradient->num_stops = num_stops;
for (size_t i = 0; i < num_stops; ++i) {
m_gradient->stops[i].stop = m_stops[i].offset;
m_gradient->stops[i].color = UltralightRGBA(m_stops[i].color.red(), m_stops[i].color.green(), m_stops[i].color.blue(), m_stops[i].color.alpha());
ultralight::GradientStop stop;
stop.stop = m_stops[i].offset;
stop.color = UltralightRGBA(m_stops[i].color.red(), m_stops[i].color.green(), m_stops[i].color.blue(), m_stops[i].color.alpha());
m_gradient->stops.push_back(stop);
}

return m_gradient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ Seconds ScalableImageDecoder::frameDurationAtIndex(size_t index) const

NativeImagePtr ScalableImageDecoder::createFrameImageAtIndex(size_t index, SubsamplingLevel, const DecodingOptions&)
{
ProfiledZone;
LockHolder lockHolder(m_mutex);
// Zero-height images can cause problems for some ports. If we have an empty image dimension, just bail.
if (size().isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ bool PNGImageDecoder::setFailed()

void PNGImageDecoder::headerAvailable()
{
ProfiledZone;
png_structp png = m_reader->pngPtr();
png_infop info = m_reader->infoPtr();
png_uint_32 width = png_get_image_width(png, info);
Expand Down Expand Up @@ -552,6 +553,7 @@ void PNGImageDecoder::pngComplete()

void PNGImageDecoder::decode(bool onlySize, unsigned haltAtFrame, bool allDataReceived)
{
ProfiledZone;
if (failed())
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ static void handleCookieHeaders(ResourceHandleInternal* d, const ResourceRequest

void CurlResourceHandleDelegate::curlDidReceiveResponse(CurlRequest& request, CurlResponse&& receivedResponse)
{
ProfiledZone;
ProfiledMemoryZone(MemoryTag::Network);
ASSERT(isMainThread());
ASSERT(!d()->m_defersLoading);
Expand Down Expand Up @@ -148,6 +149,7 @@ void CurlResourceHandleDelegate::curlDidReceiveResponse(CurlRequest& request, Cu

void CurlResourceHandleDelegate::curlDidComplete(CurlRequest&, NetworkLoadMetrics&&)
{
ProfiledZone;
ProfiledMemoryZone(MemoryTag::Network);
ASSERT(isMainThread());

Expand All @@ -172,6 +174,7 @@ void CurlResourceHandleDelegate::curlDidFailWithError(CurlRequest&, ResourceErro

void CurlResourceHandleDelegate::curlConsumeReceiveQueue(CurlRequest&, WTF::ReaderWriterQueue<RefPtr<SharedBuffer>>& queue)
{
ProfiledZone;
ProfiledMemoryZone(MemoryTag::Network);
ASSERT(isMainThread());

Expand Down
21 changes: 13 additions & 8 deletions Source/WebCore/platform/ultralight/RenderThemeUltralight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,26 @@ class RenderThemeUltralight : public RenderTheme {
ultralight::Gradient gradient;
if (simulateExponential) {
constexpr size_t num_samples = 7;
gradient.num_stops = num_samples;
gradient.stops.reserve(num_samples);
ultralight::vec4 colorA = UltralightColorGetFloat4(colorPair->color1);
ultralight::vec4 colorB = UltralightColorGetFloat4(colorPair->color2);

for (size_t i = 0; i < num_samples; ++i) {
float t = i / (num_samples - 1.0f);
gradient.stops[i].color = sampleExponential(colorA, colorB, t);
gradient.stops[i].stop = t;
ultralight::GradientStop s;
s.color = sampleExponential(colorA, colorB, t);
s.stop = t;
gradient.stops.push_back(s);
}
} else {
gradient.num_stops = 2;
gradient.stops[0].color = colorPair->color1;
gradient.stops[0].stop = 0.0f;
gradient.stops[1].color = colorPair->color2;
gradient.stops[1].stop = 1.0f;
gradient.stops.reserve(2);
ultralight::GradientStop s;
s.color = colorPair->color1;
s.stop = 0.0f;
gradient.stops.push_back(s);
s.color = colorPair->color2;
s.stop = 1.0f;
gradient.stops.push_back(s);
}
return gradient;
}
Expand Down
Loading