Skip to content

Update WebKit to 13.2 #1220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Dec 5, 2019
Merged
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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ set(MAIN_TEMPLATE "${CMAKE_SOURCE_DIR}/cmake/main.m")
set(INFO_PLIST_TEMPLATE "${CMAKE_SOURCE_DIR}/cmake/Info.plist")

#WTF uses unsigned short for UCHAR_TYPE and we need to match it
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 -stdlib=libc++ -DUCHAR_TYPE=\"unsigned short\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17 -stdlib=libc++ -DUCHAR_TYPE=\"unsigned short\"")

# Override RelWithDebInfo configuration's default optimization O2 to O3
# because we've started releasing NativeScript.framework from it
Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/Calling/CFunctionWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CFunctionCall : public FFICall {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsCFunctionWrapperSpace;
}
Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/Calling/FFICall.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class FFICall {
auto scope = DECLARE_THROW_SCOPE(vm);

if (!this->_argumentCountValidator(this, execState)) {
WTF::String message = WTF::String::format("Actual arguments count: \"%lu\". Expected: \"%lu\".", execState->argumentCount(), this->parametersCount());
WTF::String message = makeString("Actual arguments count: \"", execState->argumentCount(), "\". Expected: \"", this->parametersCount(), "\".");
throwException(execState, scope, JSC::createError(execState, message, defaultSourceAppender));
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/Calling/FunctionWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FunctionWrapper : public JSC::InternalFunction {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsFunctionWrapperSpace;
}
Expand Down
5 changes: 2 additions & 3 deletions src/NativeScript/GlobalObject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static EncodedJSValue JSC_HOST_CALL time(ExecState* execState) {
static EncodedJSValue JSC_HOST_CALL releaseNativeCounterpart(ExecState* execState) {
if (execState->argumentCount() != 1) {
auto scope = DECLARE_THROW_SCOPE(execState->vm());
WTF::String message = WTF::String::format("Actual arguments count: \"%lu\". Expected: \"%lu\".", execState->argumentCount(), 1);
WTF::String message = makeString("Actual arguments count: \"", execState->argumentCount(), "\". Expected: \"", 1, "\".");
return JSValue::encode(throwException(execState, scope, JSC::createError(execState, message, defaultSourceAppender)));
}

Expand Down Expand Up @@ -412,8 +412,7 @@ static void runLoopBeforeWaitingPerformWork(CFRunLoopObserverRef observer, CFRun
}

if (!symbolWrapper) {
WTF::String errorMessage = WTF::String::format("Metadata for \"%s.%s\" found but symbol not available at runtime.",
symbolMeta->topLevelModule()->getName(), symbolMeta->name(), symbolMeta->name());
WTF::String errorMessage = makeString("Metadata for \"", symbolMeta->topLevelModule()->getName(), ".", symbolMeta->name(), "\" found but symbol not available at runtime.");
JSC::VM& vm = execState->vm();
auto scope = DECLARE_THROW_SCOPE(vm);

Expand Down
4 changes: 2 additions & 2 deletions src/NativeScript/GlobalObject.moduleLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ static mode_t stat(NSString* path) {
}

if (!absoluteFilePath) {
WTF::String errorMessage = WTF::String::format("Could not find module '%s'. Computed path '%s'.", keyValue.toWTFString(execState).utf8().data(), absolutePath.UTF8String);
WTF::String errorMessage = makeString("Could not find module '", keyValue.toWTFString(execState), "'. Computed path '", absolutePath.UTF8String, "'.");
throwException(execState, scope, createError(execState, errorMessage, defaultSourceAppender));
return Identifier();
}
Expand Down Expand Up @@ -328,7 +328,7 @@ static mode_t stat(NSString* path) {

String moduleContentStr = WTF::String::fromUTF8((const LChar*)moduleContent.bytes, moduleContent.length);
if (moduleContentStr.isNull() && moduleContent.length > 0) {
return deferred->reject(execState, createTypeError(execState, WTF::String::format("Only UTF-8 character encoding is supported: %s", keyValue.toWTFString(execState).utf8().data())));
return deferred->reject(execState, createTypeError(execState, makeString("Only UTF-8 character encoding is supported: ", keyValue.toWTFString(execState))));
}

WTF::StringBuilder moduleUrl;
Expand Down
4 changes: 2 additions & 2 deletions src/NativeScript/Interop.mm
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static EncodedJSValue JSC_HOST_CALL interopFuncFree(ExecState* execState) {

if (!pointerValue.inherits(vm, PointerInstance::info())) {
const char* className = PointerInstance::info()->className;
return JSValue::encode(scope.throwException(execState, createError(execState, pointerValue, WTF::String::format("must be a %s.", className), defaultSourceAppender)));
return JSValue::encode(scope.throwException(execState, createError(execState, pointerValue, makeString("must be a ", className, "."), defaultSourceAppender)));
}

PointerInstance* pointer = jsCast<PointerInstance*>(pointerValue);
Expand All @@ -187,7 +187,7 @@ static EncodedJSValue JSC_HOST_CALL interopFuncAdopt(ExecState* execState) {
auto scope = DECLARE_THROW_SCOPE(vm);

const char* className = PointerInstance::info()->className;
return JSValue::encode(scope.throwException(execState, createError(execState, WTF::String::format("Argument must be a %s", className))));
return JSValue::encode(scope.throwException(execState, createError(execState, makeString("Argument must be a ", className, "."))));
}

PointerInstance* pointer = jsCast<PointerInstance*>(pointerValue);
Expand Down
1 change: 0 additions & 1 deletion src/NativeScript/JSClientData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <heap/MarkingConstraint.h>
#include <heap/SubspaceInlines.h>
#include <runtime/JSDestructibleObjectHeapCellType.h>
#include <runtime/JSSegmentedVariableObjectHeapCellType.h>
#include <runtime/VM.h>
#include <wtf/MainThread.h>

Expand Down
3 changes: 1 addition & 2 deletions src/NativeScript/LiveEdit/ClearChangedCellsFunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ void ClearChangedCellsFunctor::visit(JSC::HeapCell* heapCell) const {
if (JSC::FunctionCodeBlock* functionCodeBlock = executable->codeBlockForCall()) {
functionCodeBlock->unlinkIncomingCalls();
}
executable->clearNumParametersForCall();
auto& subspace = JSC::VM::ScriptExecutableSpaceAndSet::clearableCodeSetFor(*executable->subspace());
auto& subspace = JSC::VM::SpaceAndSet::setFor(*executable->subspace());
executable->clearCode(subspace);
executable->unlinkedExecutable()->clearCode(m_vm);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FunctionReferenceInstance : public JSC::InternalFunction {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsFunctionReferenceInstanceSpace;
}
Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/Marshalling/Pointer/PointerConstructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PointerConstructor : public JSC::InternalFunction {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsPointerConstructorSpace;
}
Expand Down
12 changes: 7 additions & 5 deletions src/NativeScript/Marshalling/Pointer/PointerPrototype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
#include "PointerPrototype.h"
#include "Interop.h"
#include "PointerInstance.h"
#include "WTF/HexNumber.h"

namespace NativeScript {
using namespace JSC;
using namespace WTF;

const ClassInfo PointerPrototype::s_info = { "Pointer", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(PointerPrototype) };

Expand All @@ -37,22 +39,22 @@ static EncodedJSValue JSC_HOST_CALL pointerProtoFuncSubtract(ExecState* execStat

static EncodedJSValue JSC_HOST_CALL pointerProtoFuncToString(ExecState* execState) {
PointerInstance* pointer = jsCast<PointerInstance*>(execState->thisValue());
const void* value = pointer->data();
JSValue result = jsString(execState, WTF::String::format("<%s: %p>", PointerInstance::info()->className, value));
auto value = reinterpret_cast<intptr_t>(pointer->data());
JSValue result = jsString(execState, makeString("<", PointerInstance::info()->className, ": 0x", hex(value, HexConversionMode::Lowercase), ">"));
return JSValue::encode(result);
}

static EncodedJSValue JSC_HOST_CALL pointerProtoFuncToHexString(ExecState* execState) {
PointerInstance* pointer = jsCast<PointerInstance*>(execState->thisValue());
const void* value = pointer->data();
JSValue result = jsString(execState, WTF::String::format("%p", value));
auto value = reinterpret_cast<intptr_t>(pointer->data());
JSValue result = jsString(execState, makeString("0x", hex(value, HexConversionMode::Lowercase)));
return JSValue::encode(result);
}

static EncodedJSValue JSC_HOST_CALL pointerProtoFuncToDecimalString(ExecState* execState) {
PointerInstance* pointer = jsCast<PointerInstance*>(execState->thisValue());
const void* value = pointer->data();
JSValue result = jsString(execState, WTF::String::format("%ld", static_cast<intptr_t>(reinterpret_cast<size_t>(value))));
JSValue result = jsString(execState, makeString(static_cast<intptr_t>(reinterpret_cast<size_t>(value))));
return JSValue::encode(result);
}

Expand Down
4 changes: 2 additions & 2 deletions src/NativeScript/Marshalling/Record/RecordConstructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void RecordConstructor::write(ExecState* execState, const JSValue& value, void*
}
}
} else if (!value.isUndefinedOrNull()) {
JSValue exception = createError(execState, WTF::String::format("Could not marshall \"%s\" to \"%s\" type.", value.toWTFString(execState).utf8().data(), constructor->name().utf8().data()));
JSValue exception = createError(execState, makeString("Could not marshall \"", value.toWTFString(execState), "\" to \"", constructor->name(), "\" type."));
throwVMError(execState, scope, exception);
return;
}
Expand Down Expand Up @@ -218,7 +218,7 @@ EncodedJSValue JSC_HOST_CALL RecordConstructor::createRecordInstance(ExecState*

const JSValue value = execState->argument(0);
if (!value.inherits(vm, PointerInstance::info())) {
const WTF::String message = WTF::String::format("Argument must be a %s.", PointerInstance::info()->className);
const WTF::String message = makeString("Argument must be a ", PointerInstance::info()->className, ".");
return JSValue::encode(scope.throwException(execState, createError(execState, message, defaultSourceAppender)));
}

Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/Marshalling/Record/RecordConstructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RecordConstructor : public JSC::InternalFunction {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsRecordConstructorSpace;
}
Expand Down
5 changes: 3 additions & 2 deletions src/NativeScript/Marshalling/Record/RecordPrototype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#include "RecordField.h"
#include "RecordInstance.h"
#include "RecordPrototypeFunctions.h"
#include "WTF/HexNumber.h"
#include <JavaScriptCore/ObjectConstructor.h>

namespace NativeScript {
using namespace JSC;
using namespace WTF;

const ClassInfo RecordPrototype::s_info = { "record", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(RecordPrototype) };

Expand All @@ -24,9 +26,8 @@ static EncodedJSValue JSC_HOST_CALL recordProtoFuncToString(ExecState* execState

const RecordType type = recordConstructor->recordType();
const char* typeName = type == RecordType::Struct ? "struct" : type == RecordType::Union ? "union" : "record";
CString name = recordConstructor->name().utf8();

return JSValue::encode(jsString(execState, WTF::String::format("<%s %s: %p>", typeName, name.data(), record->data())));
return JSValue::encode(jsString(execState, makeString("<", typeName, " ", recordConstructor->name(), ": 0x", hex(reinterpret_cast<intptr_t>(record->data()), HexConversionMode::Lowercase), ">")));
}

static EncodedJSValue JSC_HOST_CALL recordProtoFuncToJSON(ExecState* execState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RecordProtoFieldGetter : public JSC::InternalFunction {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsRecordProtoFieldGetterSpace;
}
Expand Down Expand Up @@ -69,7 +69,7 @@ class RecordProtoFieldSetter : public JSC::InternalFunction {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsRecordProtoFieldSetterSpace;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@

#include "IndexedRefPrototype.h"
#include "IndexedRefInstance.h"
#include "WTF/HexNumber.h"

namespace NativeScript {
using namespace JSC;
using namespace WTF;

const ClassInfo IndexedRefPrototype::s_info = { "IndexedRef", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(IndexedRefPrototype) };

static EncodedJSValue JSC_HOST_CALL indexedRefProtoFuncToString(ExecState* execState) {
IndexedRefInstance* reference = jsCast<IndexedRefInstance*>(execState->thisValue());
WTF::String toString = WTF::String::format("<%s: %p>", IndexedRefInstance::info()->className, reference->data());
WTF::String toString = makeString("<", IndexedRefInstance::info()->className, ": 0x", hex(reinterpret_cast<intptr_t>(reference->data()), HexConversionMode::Lowercase), ">");
return JSValue::encode(jsString(execState, toString));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

#include "ReferencePrototype.h"
#include "ReferenceInstance.h"
#include "WTF/HexNumber.h"

namespace NativeScript {
using namespace JSC;
using namespace WTF;

const ClassInfo ReferencePrototype::s_info = { "Reference", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(ReferencePrototype) };

Expand All @@ -32,7 +34,7 @@ static EncodedJSValue JSC_HOST_CALL referenceProtoFuncSetValue(ExecState* execSt

static EncodedJSValue JSC_HOST_CALL referenceProtoFuncToString(ExecState* execState) {
ReferenceInstance* reference = jsCast<ReferenceInstance*>(execState->thisValue());
WTF::String toString = WTF::String::format("<%s: %p>", ReferenceInstance::info()->className, reference->data());
WTF::String toString = makeString("<", ReferenceInstance::info()->className, ": 0x", hex(reinterpret_cast<intptr_t>(reference->data()), HexConversionMode::Lowercase), ">");
return JSValue::encode(jsString(execState, toString));
}

Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/ObjC/Block/ObjCBlockCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ObjCBlockWrapper : public FunctionWrapper {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsObjCBlockWrapperSpace;
}
Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/ObjC/Constructor/ObjCConstructorBase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static JSValue getInitializerForSwiftStyleConstruction(ExecState* execState, Obj
if (!handle) {
auto scope = DECLARE_THROW_SCOPE(vm);

WTF::String message = WTF::String::format("Value must be a %s.", PointerInstance::info()->className);
WTF::String message = makeString("Value must be a ", PointerInstance::info()->className, ".");
return throwVMError(execState, scope, createError(execState, message));
}

Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/ObjC/Constructor/ObjCConstructorCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ObjCConstructorWrapper : public FunctionWrapper {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsObjCConstructorWrapperSpace;
}
Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/ObjC/Constructor/ObjCConstructorDerived.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ObjCConstructorDerived : public ObjCConstructorBase {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsObjCConstructorDerivedSpace;
}
Expand Down
2 changes: 1 addition & 1 deletion src/NativeScript/ObjC/Constructor/ObjCConstructorNative.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ObjCConstructorNative : public ObjCConstructorBase {

DECLARE_INFO;

template <typename CellType>
template <typename CellType, JSC::SubspaceAccess mode>
static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) {
return &vm.tnsObjCConstructorNativeSpace;
}
Expand Down
Loading