From fd74c45a857f989f0ebf023a2b63f102940b5c22 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 25 Aug 2016 16:54:21 +0000 Subject: [PATCH] script component can be build as all-in-one now Signed-off-by: Ivailo Monev --- CMakeLists.txt | 5 ++ .../JavaScriptCore/API/JSCallbackObjectFunctions.h | 4 +- .../JavaScriptCore/API/JSObjectRef.h | 2 +- .../JavaScriptCore/API/JSValueRef.cpp | 12 ++-- .../javascriptcore/JavaScriptCore/API/JSValueRef.h | 26 ++++---- .../javascriptcore/JavaScriptCore/jit/JIT.cpp | 1 + .../JavaScriptCore/pcre/pcre_exec.cpp | 75 +++++++++++----------- src/script/bridge/qscriptclassobject.cpp | 2 + src/script/bridge/qscriptdeclarativeobject.cpp | 2 + 9 files changed, 67 insertions(+), 62 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08ee0842d..2b68b9154 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,6 +193,11 @@ if(NOT KATIE_PLATFORM STREQUAL "integrity" AND NOT MINGW) ) endif() +# some things just cannot be done right +if(KATIE_ALLINONE) + add_definitions(-DQT_ALLINONE) +endif() + # for 3rd party source used in help and test components check_include_file(sys/time.h HAVE_SYS_TIME_H) if(HAVE_SYS_TIME_H) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h index 159003fd3..313f67564 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSCallbackObjectFunctions.h @@ -452,7 +452,7 @@ double JSCallbackObject::toNumber(ExecState* exec) const JSValueRef value; { APICallbackShim callbackShim(exec); - value = convertToType(ctx, thisRef, kJSTypeNumber, &exception); + value = convertToType(ctx, thisRef, NumberType, &exception); } if (exception) { exec->setException(toJS(exec, exception)); @@ -479,7 +479,7 @@ UString JSCallbackObject::toString(ExecState* exec) const JSValueRef value; { APICallbackShim callbackShim(exec); - value = convertToType(ctx, thisRef, kJSTypeString, &exception); + value = convertToType(ctx, thisRef, StringType, &exception); } if (exception) { exec->setException(toJS(exec, exception)); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h index 7d954b754..f95ff8aa9 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSObjectRef.h @@ -273,7 +273,7 @@ If this function returns false, the conversion request forwards to object's pare This function is only invoked when converting an object to number or string. An object converted to boolean is 'true.' An object converted to object is itself. */ typedef JSValueRef -(*JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSType type, JSValueRef* exception); +(*JSObjectConvertToTypeCallback) (JSContextRef ctx, JSObjectRef object, JSC::JSType type, JSValueRef* exception); /*! @struct JSStaticValue diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp index 028d77eb8..202970e33 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.cpp @@ -52,17 +52,17 @@ using namespace JSC; JSValue jsValue = toJS(exec, value); if (jsValue.isUndefined()) - return kJSTypeUndefined; + return UndefinedType; if (jsValue.isNull()) - return kJSTypeNull; + return NullType; if (jsValue.isBoolean()) - return kJSTypeBoolean; + return BooleanType; if (jsValue.isNumber()) - return kJSTypeNumber; + return NumberType; if (jsValue.isString()) - return kJSTypeString; + return StringType; Q_ASSERT(jsValue.isObject()); - return kJSTypeObject; + return ObjectType; } bool JSValueIsUndefined(JSContextRef ctx, JSValueRef value) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h index 6df47e7bf..2081c0d71 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/API/JSValueRef.h @@ -27,25 +27,21 @@ #define JSValueRef_h #include +#include /*! @enum JSType @abstract A constant identifying the type of a JSValue. -@constant kJSTypeUndefined The unique undefined value. -@constant kJSTypeNull The unique null value. -@constant kJSTypeBoolean A primitive boolean value, one of true or false. -@constant kJSTypeNumber A primitive number value. -@constant kJSTypeString A primitive string value. -@constant kJSTypeObject An object value (meaning that this JSValueRef is a JSObjectRef). +@constant UnspecifiedType +@constant UndefinedType The unique undefined value. +@constant BooleanType A primitive boolean value, one of true or false. +@constant NumberType A primitive number value. +@constant NullType The unique null value. +@constant StringType A primitive string value. +@constant CompoundType +@constant ObjectType An object value (meaning that this JSValueRef is a JSObjectRef). +@constant GetterSetterType */ -typedef enum { - kJSTypeUndefined, - kJSTypeNull, - kJSTypeBoolean, - kJSTypeNumber, - kJSTypeString, - kJSTypeObject -} JSType; #ifdef __cplusplus extern "C" { @@ -58,7 +54,7 @@ extern "C" { @param value The JSValue whose type you want to obtain. @result A value of type JSType that identifies value's type. */ -JS_EXPORT JSType JSValueGetType(JSContextRef ctx, JSValueRef value); +JS_EXPORT JSC::JSType JSValueGetType(JSContextRef ctx, JSValueRef value); /*! @function diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp index 40c5bd7f9..1094d7fc1 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/jit/JIT.cpp @@ -437,6 +437,7 @@ void JIT::privateCompileSlowCases() m_bytecodeIndex = (unsigned)-1; #endif } +#undef NEXT_OPCODE JITCode JIT::privateCompile() { diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp index 4d60a5d3a..ae5994293 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp @@ -436,14 +436,13 @@ RECURSE: /* Now start processing the operations. */ while (true) { -// TODO: expand the macros +// TODO: expand the macro #define BEGIN_OPCODE(opcode) case OP_##opcode -#define NEXT_OPCODE continue switch (*stack.currentFrame->args.instructionPtr) { /* Non-capturing bracket: optimized */ - BEGIN_OPCODE(BRA): + case OP_BRA: NON_CAPTURING_BRACKET: DPRINTF(("start bracket 0\n")); do { @@ -457,9 +456,9 @@ RECURSE: /* Skip over large extraction number data if encountered. */ - BEGIN_OPCODE(BRANUMBER): + case OP_BRANUMBER: stack.currentFrame->args.instructionPtr += 3; - NEXT_OPCODE; + continue; /* End of the pattern. */ @@ -491,7 +490,7 @@ RECURSE: advanceToEndOfBracket(stack.currentFrame->args.instructionPtr); stack.currentFrame->args.instructionPtr += 1 + LINK_SIZE; stack.currentFrame->args.offsetTop = md.endOffsetTop; - NEXT_OPCODE; + continue; /* Negative assertion: all branches must fail to match */ @@ -504,14 +503,14 @@ RECURSE: } while (*stack.currentFrame->args.instructionPtr == OP_ALT); stack.currentFrame->args.instructionPtr += 1 + LINK_SIZE; - NEXT_OPCODE; + continue; /* An alternation is the end of a branch; scan along to find the end of the bracketed group and go to there. */ BEGIN_OPCODE(ALT): advanceToEndOfBracket(stack.currentFrame->args.instructionPtr); - NEXT_OPCODE; + continue; /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating that it may occur zero times. It may repeat infinitely, or not at all - @@ -526,7 +525,7 @@ RECURSE: RRETURN; advanceToEndOfBracket(stack.currentFrame->locals.startOfRepeatingBracket); stack.currentFrame->args.instructionPtr = stack.currentFrame->locals.startOfRepeatingBracket + 1 + LINK_SIZE; - NEXT_OPCODE; + continue; } BEGIN_OPCODE(BRAMINZERO): { @@ -536,7 +535,7 @@ RECURSE: if (isMatch) RRETURN; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; } /* End of a group, repeated or non-repeating. If we are at the end of @@ -603,7 +602,7 @@ RECURSE: if (*stack.currentFrame->args.instructionPtr == OP_KET || stack.currentFrame->args.subjectPtr == stack.currentFrame->locals.subjectPtrAtStartOfInstruction) { stack.currentFrame->args.instructionPtr += 1 + LINK_SIZE; - NEXT_OPCODE; + continue; } /* The repeating kets try the rest of the pattern or restart from the @@ -632,7 +631,7 @@ RECURSE: if (stack.currentFrame->args.subjectPtr != md.startSubject) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; /* After internal newline if multiline. */ @@ -640,7 +639,7 @@ RECURSE: if (stack.currentFrame->args.subjectPtr != md.startSubject && !isNewline(stack.currentFrame->args.subjectPtr[-1])) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; /* End of subject. */ @@ -648,7 +647,7 @@ RECURSE: if (stack.currentFrame->args.subjectPtr < md.endSubject) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; /* Before internal newline if multiline. */ @@ -656,7 +655,7 @@ RECURSE: if (stack.currentFrame->args.subjectPtr < md.endSubject && !isNewline(*stack.currentFrame->args.subjectPtr)) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; /* Word boundary assertions */ @@ -674,7 +673,7 @@ RECURSE: bool wordBoundaryDesired = (*stack.currentFrame->args.instructionPtr++ == OP_WORD_BOUNDARY); if (wordBoundaryDesired ? currentCharIsWordChar == previousCharIsWordChar : currentCharIsWordChar != previousCharIsWordChar) RRETURN_NO_MATCH; - NEXT_OPCODE; + continue; } /* Match a single character type; inline for speed */ @@ -685,7 +684,7 @@ RECURSE: if (isNewline(*stack.currentFrame->args.subjectPtr++)) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; BEGIN_OPCODE(NOT_DIGIT): if (stack.currentFrame->args.subjectPtr >= md.endSubject) @@ -693,7 +692,7 @@ RECURSE: if (isASCIIDigit(*stack.currentFrame->args.subjectPtr++)) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; BEGIN_OPCODE(DIGIT): if (stack.currentFrame->args.subjectPtr >= md.endSubject) @@ -701,7 +700,7 @@ RECURSE: if (!isASCIIDigit(*stack.currentFrame->args.subjectPtr++)) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; BEGIN_OPCODE(NOT_WHITESPACE): if (stack.currentFrame->args.subjectPtr >= md.endSubject) @@ -709,7 +708,7 @@ RECURSE: if (isSpaceChar(*stack.currentFrame->args.subjectPtr++)) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; BEGIN_OPCODE(WHITESPACE): if (stack.currentFrame->args.subjectPtr >= md.endSubject) @@ -717,7 +716,7 @@ RECURSE: if (!isSpaceChar(*stack.currentFrame->args.subjectPtr++)) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; BEGIN_OPCODE(NOT_WORDCHAR): if (stack.currentFrame->args.subjectPtr >= md.endSubject) @@ -725,7 +724,7 @@ RECURSE: if (isWordChar(*stack.currentFrame->args.subjectPtr++)) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; BEGIN_OPCODE(WORDCHAR): if (stack.currentFrame->args.subjectPtr >= md.endSubject) @@ -733,7 +732,7 @@ RECURSE: if (!isWordChar(*stack.currentFrame->args.subjectPtr++)) RRETURN_NO_MATCH; stack.currentFrame->args.instructionPtr++; - NEXT_OPCODE; + continue; /* Match a back reference, possibly repeatedly. Look past the end of the item to see if there is repeat information following. The code is similar @@ -783,14 +782,14 @@ RECURSE: if (!matchRef(stack.currentFrame->locals.offset, stack.currentFrame->args.subjectPtr, stack.currentFrame->locals.length, md)) RRETURN_NO_MATCH; stack.currentFrame->args.subjectPtr += stack.currentFrame->locals.length; - NEXT_OPCODE; + continue; } /* If the length of the reference is zero, just continue with the main loop. */ if (stack.currentFrame->locals.length == 0) - NEXT_OPCODE; + continue; /* First, ensure the minimum number of matches are present. */ @@ -804,7 +803,7 @@ RECURSE: They are not both allowed to be zero. */ if (min == stack.currentFrame->locals.max) - NEXT_OPCODE; + continue; /* If minimizing, keep trying and advancing the pointer */ @@ -899,7 +898,7 @@ RECURSE: need to recurse. */ if (min == stack.currentFrame->locals.max) - NEXT_OPCODE; + continue; /* If minimizing, keep testing the rest of the expression and advancing the pointer while it matches the class. */ @@ -994,7 +993,7 @@ RECURSE: need to recurse. */ if (min == stack.currentFrame->locals.max) - NEXT_OPCODE; + continue; /* If minimizing, keep testing the rest of the expression and advancing the pointer while it matches the class. */ @@ -1048,7 +1047,7 @@ RECURSE: RRETURN_NO_MATCH; if (stack.currentFrame->locals.fc != *stack.currentFrame->args.subjectPtr++) RRETURN_NO_MATCH; - NEXT_OPCODE; + continue; /* Match a single character, caselessly */ @@ -1062,7 +1061,7 @@ RECURSE: int dc = *stack.currentFrame->args.subjectPtr++; if (stack.currentFrame->locals.fc != dc && jsc_pcre_ucp_othercase(stack.currentFrame->locals.fc) != dc) RRETURN_NO_MATCH; - NEXT_OPCODE; + continue; } /* Match a single ASCII character. */ @@ -1074,7 +1073,7 @@ RECURSE: RRETURN_NO_MATCH; ++stack.currentFrame->args.subjectPtr; stack.currentFrame->args.instructionPtr += 2; - NEXT_OPCODE; + continue; /* Match one of two cases of an ASCII letter. */ @@ -1085,7 +1084,7 @@ RECURSE: RRETURN_NO_MATCH; ++stack.currentFrame->args.subjectPtr; stack.currentFrame->args.instructionPtr += 2; - NEXT_OPCODE; + continue; /* Match a single character repeatedly; different opcodes share code. */ @@ -1133,7 +1132,7 @@ RECURSE: } if (min == stack.currentFrame->locals.max) - NEXT_OPCODE; + continue; if (minimize) { stack.currentFrame->locals.repeatOthercase = othercase; @@ -1176,7 +1175,7 @@ RECURSE: } if (min == stack.currentFrame->locals.max) - NEXT_OPCODE; + continue; if (minimize) { for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { @@ -1228,7 +1227,7 @@ RECURSE: if (b == c) RRETURN_NO_MATCH; } - NEXT_OPCODE; + continue; } /* Match a negated single one-byte character repeatedly. This is almost a @@ -1292,7 +1291,7 @@ RECURSE: } if (min == stack.currentFrame->locals.max) - NEXT_OPCODE; + continue; if (minimize) { for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { @@ -1346,7 +1345,7 @@ RECURSE: } if (min == stack.currentFrame->locals.max) - NEXT_OPCODE; + continue; if (minimize) { for (stack.currentFrame->locals.fi = min;; stack.currentFrame->locals.fi++) { @@ -1493,7 +1492,7 @@ RECURSE: /* If min = max, continue at the same level without recursing */ if (min == stack.currentFrame->locals.max) - NEXT_OPCODE; + continue; /* If minimizing, we have to test the rest of the pattern before each subsequent match. */ diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index a402019b2..3b49ac34f 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -34,9 +34,11 @@ #include "Error.h" #include "PropertyNameArray.h" +#ifndef QT_ALLINONE Q_DECLARE_METATYPE(QScriptContext*) Q_DECLARE_METATYPE(QScriptValue) Q_DECLARE_METATYPE(QScriptValueList) +#endif QT_BEGIN_NAMESPACE diff --git a/src/script/bridge/qscriptdeclarativeobject.cpp b/src/script/bridge/qscriptdeclarativeobject.cpp index b7cde1652..a238bba30 100644 --- a/src/script/bridge/qscriptdeclarativeobject.cpp +++ b/src/script/bridge/qscriptdeclarativeobject.cpp @@ -37,7 +37,9 @@ #include Q_DECLARE_METATYPE(QScriptContext*) +#ifndef QT_ALLINONE Q_DECLARE_METATYPE(QScriptValue) +#endif Q_DECLARE_METATYPE(QScriptValueList) QT_BEGIN_NAMESPACE -- 2.11.0