Merge branch 'master' into refactor

Conflicts:
	src/3rdparty/v8
	src/gui/text/qfont_qpa.cpp
	src/gui/widgets/qlinecontrol.cpp
	src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
	tests/auto/gui.pro
	tests/auto/network.pro
	tests/auto/qstring/tst_qstring.cpp

Change-Id: Id118c172645303ccf06a207050d5bf1462ff57fe
This commit is contained in:
Gunnar Sletta 2011-09-12 07:49:03 +02:00
commit a9ac6da893
38 changed files with 986 additions and 720 deletions

View File

@ -299,10 +299,9 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
# Generate the new contents
my $newContents = $existingContents;
# Strip out any existing config test results or include statements
# Strip out any existing config test results
$newContents =~ s/^config_test_[^\$]*$//gm;
$newContents =~ s/^# Compile time test results[^\$]*$//gm;
$newContents =~ s/include\(\$\$PWD\/..\/.qmake.cache\)$//gm;
# Add any remaining content and make sure we start on a new line
if ($newContents and chop $newContents ne '\n') {
@ -322,9 +321,6 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
# Remove blank lines
$newContents =~ s/^[\s]*$//gms;
# Include top level .qmake.cache
$newContents = $newContents . "include(\$\$PWD/../.qmake.cache)\n";
# and open the file
open my $cacheFileHandle, ">$qmakeCachePath" or die "Unable to open $qmakeCachePath for writing: $!\n";

15
configure vendored
View File

@ -1041,7 +1041,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style yes options
-incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu)
-incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-v8|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
@ -7361,6 +7361,7 @@ fi
canBuildQtXmlPatterns="yes"
canBuildWebKit="$HAVE_STL"
canBuildQtConcurrent="yes"
canBuildV8="yes"
# WebKit requires stdint.h
"$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stdint "Stdint" $L_FLAGS $I_FLAGS $l_FLAGS
@ -7584,8 +7585,18 @@ fi
#fi
case "$CFG_ARCH" in
i386|x86_64|arm|macosx) ;;
*) canBuildV8="no";;
esac
if [ "$CFG_V8" = "yes" -a "$canBuildV8" = "no" ]; then
echo "Error: V8 was requested, but is not supported on this platform."
exit 1
fi
if [ "$CFG_V8" = "auto" ]; then
CFG_V8=yes
CFG_V8="$canBuildV8"
fi
if [ "$CFG_V8" = "no" ]; then

6
dist/changes-5.0.0 vendored
View File

@ -116,6 +116,9 @@ Qt for Windows CE
- moc
* [QTBUG-20785] The moc now has a -b<file> option to #include an additional
file at the beginning of the generated file.
- uic
@ -125,6 +128,9 @@ Qt for Windows CE
- qmake
* QMAKE_MOC_OPTIONS variable is now available for passing additional parameters
to the moc.
- configure

View File

@ -45,10 +45,10 @@ defineReplace(mocCmdBase) {
contains(TEMPLATE, "vc.*") {
RET += $$mocinclude.commands
}
RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D)
RET += $$QMAKE_MOC $(DEFINES) @$$WIN_INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$QMAKE_MOC_OPTIONS
return($$RET)
}
return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D))
return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$QMAKE_MOC_OPTIONS)
}
#moc headers

View File

@ -1524,8 +1524,8 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCEventTool &tool)
{
xml
<< tag(tool.EventName)
<< attrTagS(_Command, tool.CommandLine.join(vcxCommandSeparator()))
<< attrTagS(_Message, tool.Description)
<< tag(_Command) << valueTag(tool.CommandLine.join(vcxCommandSeparator()))
<< tag(_Message) << valueTag(tool.Description)
<< closetag(tool.EventName);
}

View File

@ -3535,6 +3535,61 @@ bool QString::endsWith(const QChar &c, Qt::CaseSensitivity cs) const
}
#if defined(QT_ALWAYS_HAVE_SSE2)
static inline __m128i mergeQuestionMarks(__m128i chunk)
{
const __m128i questionMark = _mm_set1_epi16('?');
# ifdef __SSE4_2__
// compare the unsigned shorts for the range 0x0100-0xFFFF
// note on the use of _mm_cmpestrm:
// The MSDN documentation online (http://technet.microsoft.com/en-us/library/bb514080.aspx)
// says for range search the following:
// For each character c in a, determine whether b0 <= c <= b1 or b2 <= c <= b3
//
// However, all examples on the Internet, including from Intel
// (see http://software.intel.com/en-us/articles/xml-parsing-accelerator-with-intel-streaming-simd-extensions-4-intel-sse4/)
// put the range to be searched first
//
// Disassembly and instruction-level debugging with GCC and ICC show
// that they are doing the right thing. Inverting the arguments in the
// instruction does cause a bunch of test failures.
const int mode = _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK;
const __m128i rangeMatch = _mm_cvtsi32_si128(0xffff0100);
const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8, mode);
// replace the non-Latin 1 characters in the chunk with question marks
chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask);
# else
// SSE has no compare instruction for unsigned comparison.
// The variables must be shiffted + 0x8000 to be compared
const __m128i signedBitOffset = _mm_set1_epi16(0x8000);
const __m128i thresholdMask = _mm_set1_epi16(0xff + 0x8000);
const __m128i signedChunk = _mm_add_epi16(chunk, signedBitOffset);
const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask);
# ifdef __SSE4_1__
// replace the non-Latin 1 characters in the chunk with question marks
chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask);
# else
// offLimitQuestionMark contains '?' for each 16 bits that was off-limit
// the 16 bits that were correct contains zeros
const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark);
// correctBytes contains the bytes that were in limit
// the 16 bits that were off limits contains zeros
const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk);
// merge offLimitQuestionMark and correctBytes to have the result
chunk = _mm_or_si128(correctBytes, offLimitQuestionMark);
# endif
# endif
return chunk;
}
#endif
static QByteArray toLatin1_helper(const QChar *data, int length)
{
QByteArray ba;
@ -3545,41 +3600,15 @@ static QByteArray toLatin1_helper(const QChar *data, int length)
#if defined(QT_ALWAYS_HAVE_SSE2)
if (length >= 16) {
const int chunkCount = length >> 4; // divided by 16
const __m128i questionMark = _mm_set1_epi16('?');
// SSE has no compare instruction for unsigned comparison.
// The variables must be shiffted + 0x8000 to be compared
const __m128i signedBitOffset = _mm_set1_epi16(short(0x8000));
const __m128i thresholdMask = _mm_set1_epi16(short(0xff + 0x8000));
for (int i = 0; i < chunkCount; ++i) {
__m128i chunk1 = _mm_loadu_si128((__m128i*)src); // load
chunk1 = mergeQuestionMarks(chunk1);
src += 8;
{
// each 16 bit is equal to 0xFF if the source is outside latin 1 (>0xff)
const __m128i signedChunk = _mm_add_epi16(chunk1, signedBitOffset);
const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask);
// offLimitQuestionMark contains '?' for each 16 bits that was off-limit
// the 16 bits that were correct contains zeros
const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark);
// correctBytes contains the bytes that were in limit
// the 16 bits that were off limits contains zeros
const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk1);
// merge offLimitQuestionMark and correctBytes to have the result
chunk1 = _mm_or_si128(correctBytes, offLimitQuestionMark);
}
__m128i chunk2 = _mm_loadu_si128((__m128i*)src); // load
chunk2 = mergeQuestionMarks(chunk2);
src += 8;
{
// exactly the same operations as for the previous chunk of data
const __m128i signedChunk = _mm_add_epi16(chunk2, signedBitOffset);
const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask);
const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark);
const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk2);
chunk2 = _mm_or_si128(correctBytes, offLimitQuestionMark);
}
// pack the two vector to 16 x 8bits elements
const __m128i result = _mm_packus_epi16(chunk1, chunk2);

View File

@ -901,15 +901,38 @@ static const char *certificate_blacklist[] = {
"92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43", "addons.mozilla.org", // Comodo
"b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0", "login.live.com", // Comodo
"d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0", "global trustee", // Comodo
"05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", "*.google.com", // DigiNotar
"05:e2:e6:a4:cd:09:ea:54:d6:65:b0:75:fe:22:a2:56", "*.google.com", // leaf certificate issued by DigiNotar
"0c:76:da:9c:91:0c:4e:2c:9e:fe:15:d0:58:93:3c:4c", "DigiNotar Root CA", // DigiNotar root
"f1:4a:13:f4:87:2b:56:dc:39:df:84:ca:7a:a1:06:49", "DigiNotar Services CA", // DigiNotar intermediate signed by DigiNotar Root
"36:16:71:55:43:42:1b:9d:e6:cb:a3:64:41:df:24:38", "DigiNotar Services 1024 CA", // DigiNotar intermediate signed by DigiNotar Root
"0a:82:bd:1e:14:4e:88:14:d7:5b:1a:55:27:be:bf:3e", "DigiNotar Root CA G2", // other DigiNotar Root CA
"a4:b6:ce:e3:2e:d3:35:46:26:3c:b3:55:3a:a8:92:21", "CertiID Enterprise Certificate Authority", // DigiNotar intermediate signed by "DigiNotar Root CA G2"
"5b:d5:60:9c:64:17:68:cf:21:0e:35:fd:fb:05:ad:41", "DigiNotar Qualified CA", // DigiNotar intermediate signed by DigiNotar Root
"1184640176", "DigiNotar Services 1024 CA", // DigiNotar intermediate cross-signed by Entrust
"120000525", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust
"120000505", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust
"120000515", "DigiNotar Cyber CA", // DigiNotar intermediate cross-signed by CyberTrust
"20015536", "DigiNotar PKIoverheid CA Overheid en Bedrijven", // DigiNotar intermediate cross-signed by the Dutch government
"20001983", "DigiNotar PKIoverheid CA Organisatie - G2", // DigiNotar intermediate cross-signed by the Dutch government
"d6:d0:29:77:f1:49:fd:1a:83:f2:b9:ea:94:8c:5c:b4", "DigiNotar Extended Validation CA", // DigiNotar intermediate signed by DigiNotar EV Root
"1e:7d:7a:53:3d:45:30:41:96:40:0f:71:48:1f:45:04", "DigiNotar Public CA 2025", // DigiNotar intermediate
// "(has not been seen in the wild so far)", "DigiNotar Public CA - G2", // DigiNotar intermediate
// "(has not been seen in the wild so far)", "Koninklijke Notariele Beroepsorganisatie CA", // compromised during DigiNotar breach
// "(has not been seen in the wild so far)", "Stichting TTP Infos CA," // compromised during DigiNotar breach
"1184640175", "DigiNotar Root CA", // DigiNotar intermediate cross-signed by Entrust
"1184644297", "DigiNotar Root CA", // DigiNotar intermediate cross-signed by Entrust
0
};
bool QSslCertificatePrivate::isBlacklisted(const QSslCertificate &certificate)
{
for (int a = 0; certificate_blacklist[a] != 0; a++) {
QString blacklistedCommonName = QString::fromUtf8(certificate_blacklist[(a+1)]);
if (certificate.serialNumber() == certificate_blacklist[a++] &&
certificate.subjectInfo(QSslCertificate::CommonName).contains(QString::fromUtf8(certificate_blacklist[a])))
(certificate.subjectInfo(QSslCertificate::CommonName).contains(blacklistedCommonName) ||
certificate.issuerInfo(QSslCertificate::CommonName).contains(blacklistedCommonName)))
return true;
}
return false;

View File

@ -1270,12 +1270,15 @@ bool QSslSocketBackendPrivate::startHandshake()
// Start translating errors.
QList<QSslError> errors;
if (QSslCertificatePrivate::isBlacklisted(configuration.peerCertificate)) {
QSslError error(QSslError::CertificateBlacklisted, configuration.peerCertificate);
errors << error;
emit q->peerVerifyError(error);
if (q->state() != QAbstractSocket::ConnectedState)
return false;
// check the whole chain for blacklisting (including root, as we check for subjectInfo and issuer)
foreach (const QSslCertificate &cert, configuration.peerCertificateChain) {
if (QSslCertificatePrivate::isBlacklisted(cert)) {
QSslError error(QSslError::CertificateBlacklisted, cert);
errors << error;
emit q->peerVerifyError(error);
if (q->state() != QAbstractSocket::ConnectedState)
return false;
}
}
bool doVerifyPeer = configuration.peerVerifyMode == QSslSocket::VerifyPeer

View File

@ -475,14 +475,14 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::
fid.filename = fontfile->fileName.toLocal8Bit();
fid.index = fontfile->indexValue;
//try and get the pattern
FcPattern *pattern = FcPatternCreate();
bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
QFontEngineFT::GlyphFormat format = antialias? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono;
engine = new QFontEngineFT(fontDef);
// try and get the pattern
FcPattern *pattern = FcPatternCreate();
FcValue value;
value.type = FcTypeString;
QByteArray cs = fontDef.family.toUtf8();
@ -497,9 +497,8 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::
value.u.i = fid.index;
FcPatternAdd(pattern,FC_INDEX,value,true);
QFontEngineFT::HintStyle default_hint_style;
if (FcConfigSubstitute(0,pattern,FcMatchPattern)) {
QFontEngineFT::HintStyle default_hint_style;
//hinting
int hint_style = 0;
@ -519,9 +518,10 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::
default_hint_style = QFontEngineFT::HintFull;
break;
}
engine->setDefaultHintStyle(default_hint_style);
}
FcPatternDestroy(pattern);
engine->setDefaultHintStyle(default_hint_style);
if (!engine->init(fid,antialias,format)) {
delete engine;
engine = 0;
@ -576,26 +576,29 @@ QStringList QFontconfigDatabase::fallbacksForFamily(const QString family, const
}
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcConfigSubstitute(0, pattern, FcMatchFont);
FcDefaultSubstitute(pattern);
FcResult result = FcResultMatch;
FcFontSet *fontSet = FcFontSort(0,pattern,FcFalse,0,&result);
FcPatternDestroy(pattern);
if (fontSet && result == FcResultMatch)
{
for (int i = 0; i < fontSet->nfont; i++) {
FcChar8 *value = 0;
if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
continue;
// capitalize(value);
QString familyName = QString::fromUtf8((const char *)value);
if (!fallbackFamilies.contains(familyName,Qt::CaseInsensitive)) {
fallbackFamilies << familyName;
if (fontSet) {
if (result == FcResultMatch) {
for (int i = 0; i < fontSet->nfont; i++) {
FcChar8 *value = 0;
if (FcPatternGetString(fontSet->fonts[i], FC_FAMILY, 0, &value) != FcResultMatch)
continue;
// capitalize(value);
QString familyName = QString::fromUtf8((const char *)value);
if (!fallbackFamilies.contains(familyName,Qt::CaseInsensitive) &&
familyName.compare(family, Qt::CaseInsensitive)) {
fallbackFamilies << familyName;
}
}
}
FcFontSetDestroy(fontSet);
}
// qDebug() << "fallbackFamilies for:" << family << fallbackFamilies;
// qDebug() << "fallbackFamilies for:" << family << style << styleHint << script << fallbackFamilies;
return fallbackFamilies;
}

View File

@ -83,7 +83,8 @@ void error(const char *msg = "Invalid argument")
" -U<macro> undefine macro\n"
" -i do not generate an #include statement\n"
" -p<path> path prefix for included file\n"
" -f[<file>] force #include, optional file name\n"
" -f[<file>] force #include, optional file name (overwrite default)\n"
" -b<file> prepend #include <file> (preserve default include)\n"
" -nn do not display notes\n"
" -nw do not display warnings\n"
" @<file> read additional options from file\n"
@ -156,6 +157,7 @@ QByteArray composePreprocessorOutput(const Symbols &symbols) {
int runMoc(int _argc, char **_argv)
{
bool autoInclude = true;
bool defaultInclude = true;
Preprocessor pp;
Moc moc;
pp.macros["Q_MOC_RUN"];
@ -226,8 +228,21 @@ int runMoc(int _argc, char **_argv)
break;
moc.noInclude = false;
autoInclude = false;
if (opt[1]) // -fsomething.h
if (opt[1]) { // -fsomething.h
moc.includeFiles.append(opt.mid(1));
defaultInclude = false;
}
break;
case 'b':
if (ignoreConflictingOptions)
break;
if (!more) {
if (!(n < argc-1))
error("Missing file name for the -b option.");
moc.includeFiles.prepend(argv[++n]);
} else if (opt[1]) {
moc.includeFiles.prepend(opt.mid(1));
}
break;
case 'p': // include file path
if (ignoreConflictingOptions)
@ -341,7 +356,7 @@ int runMoc(int _argc, char **_argv)
// spos >= -1 && ppos > spos => ppos >= 0
moc.noInclude = (ppos > spos && tolower(filename[ppos + 1]) != 'h');
}
if (moc.includeFiles.isEmpty()) {
if (defaultInclude) {
if (moc.includePath.isEmpty()) {
if (filename.size()) {
if (output.size())

View File

@ -1,25 +1,25 @@
From e13ce09287a56c920d5ffdc5d4662d49f1838f16 Mon Sep 17 00:00:00 2001
From 3dff2e903674d8ab5310d44281b57de36db659c9 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 15:47:20 +1000
Subject: [PATCH 01/16] Add hashing and comparison methods to v8::String
Subject: [PATCH 01/15] Add hashing and comparison methods to v8::String
This allows us to more rapidly search for a v8::String inside
a hash of QStrings.
---
include/v8.h | 44 ++++++++++++++++++++++++++++++
include/v8.h | 45 +++++++++++++++++++++++++++++++
src/api.cc | 43 +++++++++++++++++++++++++++++
src/heap-inl.h | 2 +
src/heap.cc | 3 ++
src/objects-inl.h | 1 +
src/objects.cc | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/objects.h | 15 +++++++++-
7 files changed, 182 insertions(+), 3 deletions(-)
7 files changed, 183 insertions(+), 3 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index d15d024..bbd29e9 100644
index d15d024..be1ee71 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -994,6 +994,48 @@ class String : public Primitive {
@@ -994,6 +994,49 @@ class String : public Primitive {
V8EXPORT int Utf8Length() const;
/**
@ -63,12 +63,13 @@ index d15d024..bbd29e9 100644
+ */
+ V8EXPORT bool Equals(uint16_t *string, int length);
+ V8EXPORT bool Equals(char *string, int length);
+ inline bool Equals(Handle<Value> that) const { return v8::Value::Equals(that); }
+
+ /**
* Write the contents of the string to an external buffer.
* If no arguments are given, expects the buffer to be large
* enough to hold the entire string and NULL terminator. Copies
@@ -1023,6 +1065,8 @@ class String : public Primitive {
@@ -1023,6 +1066,8 @@ class String : public Primitive {
HINT_MANY_WRITES_EXPECTED = 1
};
@ -339,5 +340,5 @@ index e966b3d..6e26f57 100644
// Maximal memory usage for a single sequential two-byte string.
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From 7c9cfff80b7864d5687432d424074e51712c4a07 Mon Sep 17 00:00:00 2001
From 01f7bd262fb1be893fe4bdc6b98a1b43c5a0bb7d Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 15:55:26 +1000
Subject: [PATCH 02/16] Add a bit field 3 to Map
Subject: [PATCH 02/15] Add a bit field 3 to Map
Bit field 3 will be used to add QML specific map flags.
---
@ -114,5 +114,5 @@ index 6e26f57..07e1089 100644
static const int kCodeCacheEntrySize = 2;
static const int kCodeCacheEntryNameOffset = 0;
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From ae8688b53d67044f2c9b0cce25fc282b078610c1 Mon Sep 17 00:00:00 2001
From 530ded6ea634bccb96652cd3e0cf67725449ed63 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 16:21:02 +1000
Subject: [PATCH 03/16] Add a "fallback" mode for named property interceptors
Subject: [PATCH 03/15] Add a "fallback" mode for named property interceptors
By default interceptors are called before the normal property
resolution on objects. When an interceptor is installed as a
@ -24,10 +24,10 @@ declarations.
9 files changed, 99 insertions(+), 18 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index bbd29e9..85452aa 100644
index be1ee71..bb31ea0 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2169,6 +2169,7 @@ class V8EXPORT FunctionTemplate : public Template {
@@ -2170,6 +2170,7 @@ class V8EXPORT FunctionTemplate : public Template {
NamedPropertyQuery query,
NamedPropertyDeleter remover,
NamedPropertyEnumerator enumerator,
@ -35,7 +35,7 @@ index bbd29e9..85452aa 100644
Handle<Value> data);
void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
IndexedPropertySetter setter,
@@ -2253,6 +2254,13 @@ class V8EXPORT ObjectTemplate : public Template {
@@ -2254,6 +2255,13 @@ class V8EXPORT ObjectTemplate : public Template {
NamedPropertyEnumerator enumerator = 0,
Handle<Value> data = Handle<Value>());
@ -360,5 +360,5 @@ index 7335da8..660352c 100644
return isolate->heap()->undefined_value();
}
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From 4827116b12c50f6662794017c5a662b5dbb2da0b Mon Sep 17 00:00:00 2001
From f9368b52060c31e9532ef26f6cca1a2cb0283f51 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 16:55:35 +1000
Subject: [PATCH 04/16] Generalize external object resources
Subject: [PATCH 04/15] Generalize external object resources
V8 was already able to manage and finalize an external string
resource. This change generalizes that mechanism to handle a
@ -31,10 +31,10 @@ object space.
11 files changed, 280 insertions(+), 115 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 85452aa..7f06ae7 100644
index bb31ea0..205e856 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1630,6 +1630,25 @@ class Object : public Value {
@@ -1631,6 +1631,25 @@ class Object : public Value {
/** Sets a native pointer in an internal field. */
V8EXPORT void SetPointerInInternalField(int index, void* value);
@ -60,7 +60,7 @@ index 85452aa..7f06ae7 100644
// Testers for local properties.
V8EXPORT bool HasRealNamedProperty(Handle<String> key);
V8EXPORT bool HasRealIndexedProperty(uint32_t index);
@@ -2331,6 +2350,12 @@ class V8EXPORT ObjectTemplate : public Template {
@@ -2332,6 +2351,12 @@ class V8EXPORT ObjectTemplate : public Template {
*/
void SetInternalFieldCount(int value);
@ -685,7 +685,7 @@ index 5795a6b..8866e58 100644
} else {
delete resource;
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 68a5062..1b1e361 100644
index 68a5062..775f787 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -163,7 +163,7 @@ void MarkCompactCollector::Finish() {
@ -704,7 +704,7 @@ index 68a5062..1b1e361 100644
- if ((*p)->IsExternalString()) {
- heap_->FinalizeExternalString(String::cast(*p));
+ if ((*p)->IsExternalString() ||
+ (*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource()) {
+ ((*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource())) {
+ heap_->FinalizeExternalString(HeapObject::cast(*p));
}
// Set the entry to null_value (as deleted).
@ -890,5 +890,5 @@ index a209cd0..1bdb5c7 100644
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From fd7d475e298e5b63cd6383c78cc900635c82aa38 Mon Sep 17 00:00:00 2001
From 60c1a26bf89d3b06bcdd8408fcee89a018120f32 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 23 May 2011 18:26:19 +1000
Subject: [PATCH 05/16] Introduce a QML compilation mode
Subject: [PATCH 05/15] Introduce a QML compilation mode
In QML mode, there is a second global object - known as the QML
global object. During property resolution, if a property is not
@ -15,8 +15,8 @@ closures etc. created during the run will retain a reference to this
object, so different objects can be passed in different script
runs.
---
include/v8.h | 18 ++++++++--
src/api.cc | 52 ++++++++++++++++++++++++-----
include/v8.h | 18 +++++++--
src/api.cc | 52 ++++++++++++++++++++++-----
src/arm/code-stubs-arm.cc | 4 ++
src/arm/full-codegen-arm.cc | 26 ++++++++------
src/arm/lithium-arm.cc | 2 +-
@ -27,10 +27,10 @@ runs.
src/ast.h | 1 +
src/code-stubs.h | 2 +-
src/compiler.cc | 15 +++++++-
src/compiler.h | 22 ++++++++++--
src/contexts.cc | 23 +++++++++++++
src/compiler.h | 22 +++++++++--
src/contexts.cc | 35 ++++++++++++++++++
src/contexts.h | 4 ++
src/execution.cc | 28 +++++++++++++--
src/execution.cc | 28 ++++++++++++--
src/execution.h | 6 +++
src/full-codegen.cc | 3 +-
src/full-codegen.h | 1 +
@ -43,14 +43,14 @@ runs.
src/ia32/lithium-ia32.cc | 2 +-
src/ia32/lithium-ia32.h | 6 +++-
src/ia32/macro-assembler-ia32.h | 5 +++
src/objects-inl.h | 12 +++++++
src/objects-inl.h | 12 ++++++
src/objects.h | 5 +++
src/parser.cc | 27 +++++++++++++--
src/parser.cc | 27 ++++++++++++--
src/parser.h | 4 ++-
src/prettyprinter.cc | 3 ++
src/runtime.cc | 68 ++++++++++++++++++++++++-------------
src/runtime.cc | 72 ++++++++++++++++++++++++-------------
src/runtime.h | 8 ++--
src/scopes.cc | 10 +++++
src/scopes.cc | 59 +++++++++++++++++++++++++++++++
src/scopes.h | 7 ++++
src/variables.cc | 3 +-
src/variables.h | 5 +++
@ -60,10 +60,10 @@ runs.
src/x64/lithium-x64.cc | 2 +-
src/x64/lithium-x64.h | 6 +++
src/x64/macro-assembler-x64.h | 5 +++
45 files changed, 391 insertions(+), 108 deletions(-)
45 files changed, 455 insertions(+), 109 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 7f06ae7..a858eae 100644
index 205e856..d78ab1f 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -577,6 +577,10 @@ class ScriptOrigin {
@ -125,7 +125,7 @@ index 7f06ae7..a858eae 100644
/**
* Returns the script id value.
@@ -3326,6 +3335,7 @@ class V8EXPORT Context {
@@ -3327,6 +3336,7 @@ class V8EXPORT Context {
* JavaScript frames an empty handle is returned.
*/
static Local<Context> GetCalling();
@ -608,47 +608,59 @@ index e75e869..17cd369 100644
// Compile from function info (used for lazy compilation). Returns true on
// success and false if the compilation resulted in a stack overflow.
diff --git a/src/contexts.cc b/src/contexts.cc
index 520f3dd..da5cacb 100644
index 520f3dd..035ac3b 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -89,6 +89,8 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
@@ -89,6 +89,9 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
PrintF(")\n");
}
+ Handle<JSObject> qml_global;
+ Handle<JSObject> qml_global_global;
+
do {
if (FLAG_trace_contexts) {
PrintF(" - looking in context %p", reinterpret_cast<void*>(*context));
@@ -119,6 +121,10 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
@@ -119,6 +122,11 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
}
}
+ if (qml_global.is_null() && !context->qml_global()->IsUndefined()) {
+ qml_global = Handle<JSObject>(context->qml_global(), isolate);
+ qml_global_global = Handle<JSObject>(context->global(), isolate);
+ }
+
if (context->is_function_context()) {
// we have context-local slots
@@ -198,6 +204,23 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
@@ -198,6 +206,33 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
}
} while (follow_context_chain);
+ if (!qml_global.is_null()) {
+ if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0) {
+ *attributes = qml_global->GetLocalPropertyAttribute(*name);
+ *attributes = qml_global_global->GetLocalPropertyAttribute(*name);
+ } else {
+ *attributes = qml_global->GetPropertyAttribute(*name);
+ *attributes = qml_global_global->GetPropertyAttribute(*name);
+ }
+
+ if (*attributes != ABSENT) {
+ // property found
+ if (FLAG_trace_contexts) {
+ PrintF("=> found property in qml global object %p\n",
+ reinterpret_cast<void*>(*qml_global));
+ *attributes = ABSENT;
+ } else {
+ if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0) {
+ *attributes = qml_global->GetLocalPropertyAttribute(*name);
+ } else {
+ *attributes = qml_global->GetPropertyAttribute(*name);
+ }
+
+ if (*attributes != ABSENT) {
+ // property found
+ if (FLAG_trace_contexts) {
+ PrintF("=> found property in qml global object %p\n",
+ reinterpret_cast<void*>(*qml_global));
+ }
+ return qml_global;
+ }
+ return qml_global;
+ }
+ }
+
@ -1234,7 +1246,7 @@ index c777ab4..1964e02 100644
PrintLiteralIndented(buf.start(), value, true);
}
diff --git a/src/runtime.cc b/src/runtime.cc
index 660352c..827d954 100644
index 660352c..c13f92d 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1065,8 +1065,6 @@ static Failure* ThrowRedeclarationError(Isolate* isolate,
@ -1441,17 +1453,35 @@ index 660352c..827d954 100644
}
@@ -10633,7 +10652,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
@@ -10570,6 +10589,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Handle<JSFunction> function(JSFunction::cast(frame->function()));
Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
ScopeInfo<> sinfo(*scope_info);
+ bool qml_mode = function->shared()->qml_mode();
// Traverse the saved contexts chain to find the active context for the
// selected frame.
@@ -10633,7 +10653,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Compiler::CompileEval(function_source,
context,
context->IsGlobalContext(),
- kNonStrictMode);
+ kNonStrictMode,
+ false);
+ qml_mode);
if (shared.is_null()) return Failure::Exception();
Handle<JSFunction> compiled_function =
isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context);
@@ -10722,7 +10742,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
@@ -10656,7 +10677,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Handle<Object>::cast(source).location() };
Handle<Object> result =
Execution::Call(Handle<JSFunction>::cast(evaluation_function), receiver,
- argc, argv, &has_pending_exception);
+ argc, argv, &has_pending_exception,
+ Handle<Object>(function->context()->qml_global()));
if (has_pending_exception) return Failure::Exception();
// Skip the global proxy as it has no properties and always delegates to the
@@ -10722,7 +10744,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
// Currently, the eval code will be executed in non-strict mode,
// even in the strict code context.
Handle<SharedFunctionInfo> shared =
@ -1487,7 +1517,7 @@ index bf1ba68..5e97173 100644
F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
\
diff --git a/src/scopes.cc b/src/scopes.cc
index 8df93c5..734a217 100644
index 8df93c5..b5d7ff3 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -198,6 +198,7 @@ void Scope::SetDefaults(Type type,
@ -1498,33 +1528,82 @@ index 8df93c5..734a217 100644
outer_scope_calls_eval_ = false;
inner_scope_calls_eval_ = false;
outer_scope_is_eval_scope_ = false;
@@ -796,6 +797,10 @@ void Scope::ResolveVariable(Scope* global_scope,
@@ -796,6 +797,25 @@ void Scope::ResolveVariable(Scope* global_scope,
ASSERT(global_scope != NULL);
var = global_scope->DeclareGlobal(proxy->name());
+ if (qml_mode_ && !Isolate::Current()->global()->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ if (qml_mode_) {
+ Handle<GlobalObject> global = Isolate::Current()->global();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (Isolate::Current()->debug()->IsLoaded() && Isolate::Current()->debug()->InDebugger()) {
+ //Get the context before the debugger was entered.
+ SaveContext *save = Isolate::Current()->save_context();
+ while (save != NULL && *save->context() == *Isolate::Current()->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global());
+ }
+#endif
+
+ if (!global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
+
} else if (scope_inside_with_) {
// If we are inside a with statement we give up and look up
// the variable at runtime.
@@ -816,6 +821,8 @@ void Scope::ResolveVariable(Scope* global_scope,
// variables.
@@ -817,6 +837,25 @@ void Scope::ResolveVariable(Scope* global_scope,
if (context->GlobalIfNotShadowedByEval(proxy->name())) {
var = NonLocal(proxy->name(), Variable::DYNAMIC_GLOBAL);
+ if (qml_mode_ && !Isolate::Current()->global()->HasProperty(*(proxy->name())))
+ var->set_is_qml_global(true);
+ if (qml_mode_) {
+ Handle<GlobalObject> global = Isolate::Current()->global();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (Isolate::Current()->debug()->IsLoaded() && Isolate::Current()->debug()->InDebugger()) {
+ //Get the context before the debugger was entered.
+ SaveContext *save = Isolate::Current()->save_context();
+ while (save != NULL && *save->context() == *Isolate::Current()->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global());
+ }
+#endif
+
+ if (qml_mode_ && !global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
+
} else {
var = NonLocal(proxy->name(), Variable::DYNAMIC);
@@ -827,6 +834,9 @@ void Scope::ResolveVariable(Scope* global_scope,
}
@@ -827,6 +866,26 @@ void Scope::ResolveVariable(Scope* global_scope,
// variable is global unless it is shadowed by eval-introduced
// variables.
var = NonLocal(proxy->name(), Variable::DYNAMIC_GLOBAL);
+
+ if (qml_mode_ && !Isolate::Current()->global()->HasProperty(*(proxy->name())))
+ var->set_is_qml_global(true);
+ if (qml_mode_) {
+ Handle<GlobalObject> global = Isolate::Current()->global();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (Isolate::Current()->debug()->IsLoaded() && Isolate::Current()->debug()->InDebugger()) {
+ //Get the context before the debugger was entered.
+ SaveContext *save = Isolate::Current()->save_context();
+ while (save != NULL && *save->context() == *Isolate::Current()->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global());
+ }
+#endif
+
+ if (qml_mode_ && !global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
+
}
}
}
@ -1773,5 +1852,5 @@ index 4c17720..aa284ed 100644
static inline Operand StackSpaceOperand(int index) {
#ifdef _WIN64
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From f890f0d1a1e5bd62711815489c87755a4f382436 Mon Sep 17 00:00:00 2001
From 1209b88e96f253cdc19aa4c95e011c84597844f0 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Wed, 25 May 2011 10:36:13 +1000
Subject: [PATCH 06/16] Allow access to the calling script data
Subject: [PATCH 06/15] Allow access to the calling script data
---
include/v8.h | 1 +
@ -9,10 +9,10 @@ Subject: [PATCH 06/16] Allow access to the calling script data
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index a858eae..9aba4a8 100644
index d78ab1f..2bc0ed1 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3336,6 +3336,7 @@ class V8EXPORT Context {
@@ -3337,6 +3337,7 @@ class V8EXPORT Context {
*/
static Local<Context> GetCalling();
static Local<Object> GetCallingQmlGlobal();
@ -44,5 +44,5 @@ index 39767f4..ff74efb 100644
v8::Local<v8::Object> Context::Global() {
if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) {
--
1.7.6
1.7.4.4

View File

@ -1,17 +1,17 @@
From dac5d9db84cf20564621c679937ca7b9c6a8e880 Mon Sep 17 00:00:00 2001
From 2a5cf85d7fd7912e516138db03e4cda47cc2a1ab Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Fri, 27 May 2011 13:04:15 +1000
Subject: [PATCH 07/16] Fix warnings
Subject: [PATCH 07/15] Fix warnings
---
include/v8.h | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 9aba4a8..8891dab 100644
index 2bc0ed1..99f4b9a 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2415,7 +2415,7 @@ class V8EXPORT Extension { // NOLINT
@@ -2416,7 +2416,7 @@ class V8EXPORT Extension { // NOLINT
const char** deps = 0);
virtual ~Extension() { }
virtual v8::Handle<v8::FunctionTemplate>
@ -20,7 +20,7 @@ index 9aba4a8..8891dab 100644
return v8::Handle<v8::FunctionTemplate>();
}
@@ -3721,13 +3721,13 @@ class Internals {
@@ -3722,13 +3722,13 @@ class Internals {
return *reinterpret_cast<T*>(addr);
}
@ -42,5 +42,5 @@ index 9aba4a8..8891dab 100644
} // namespace internal
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From bec11b8b7f89d135e7d9a823ac4fe98c70d017cf Mon Sep 17 00:00:00 2001
From a7c491e6e533110a17fe9f7d47cf92a1b2263180 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Mon, 27 Jun 2011 14:57:28 +1000
Subject: [PATCH 08/16] Add custom object compare callback
Subject: [PATCH 08/15] Add custom object compare callback
A global custom object comparison callback can be set with:
V8::SetUserObjectComparisonCallbackFunction()
@ -28,10 +28,10 @@ instances.
12 files changed, 218 insertions(+), 3 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 8891dab..d5d6972 100644
index 99f4b9a..7544deb 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2365,6 +2365,12 @@ class V8EXPORT ObjectTemplate : public Template {
@@ -2366,6 +2366,12 @@ class V8EXPORT ObjectTemplate : public Template {
bool HasExternalResource();
void SetHasExternalResource(bool value);
@ -44,7 +44,7 @@ index 8891dab..d5d6972 100644
private:
ObjectTemplate();
static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor);
@@ -2565,6 +2571,10 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
@@ -2566,6 +2572,10 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
AccessType type,
Local<Value> data);
@ -55,7 +55,7 @@ index 8891dab..d5d6972 100644
// --- G a r b a g e C o l l e c t i o n C a l l b a c k s
/**
@@ -2815,6 +2825,9 @@ class V8EXPORT V8 {
@@ -2816,6 +2826,9 @@ class V8EXPORT V8 {
/** Callback function for reporting failed access checks.*/
static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
@ -359,7 +359,7 @@ index edbc47a..e75e9f1 100644
diff --git a/src/runtime.cc b/src/runtime.cc
index 827d954..d552ddb 100644
index c13f92d..b50de80 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -6279,6 +6279,29 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringEquals) {
@ -485,5 +485,5 @@ index d923494..10b9b56 100644
ASSERT(GetCondition() == equal);
__ subq(rax, rdx);
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From 4183b973ed3bd603784c798dfa63ba48f6b68003 Mon Sep 17 00:00:00 2001
From: "ager@chromium.org" <ager@chromium.org>
From 15ce2909579aef8c8f6b0c2c07fdebbaf0f4d611 Mon Sep 17 00:00:00 2001
From: ager@chromium.org <ager@chromium.org>
Date: Wed, 4 May 2011 13:03:08 +0000
Subject: [PATCH 09/16] Add CallAsFunction method to the Object class in the
Subject: [PATCH 09/15] Add CallAsFunction method to the Object class in the
API
Patch by Peter Varga.
@ -21,10 +21,10 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7781 ce2b1a6d-e
5 files changed, 163 insertions(+), 37 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index d5d6972..8a8e1cd 100644
index 7544deb..277153e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1757,6 +1757,14 @@ class Object : public Value {
@@ -1758,6 +1758,14 @@ class Object : public Value {
V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
@ -283,5 +283,5 @@ index d7621d1..693d51e 100644
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From 3d6d4249878f7960eac4c9c94e0f2529f9a58c4a Mon Sep 17 00:00:00 2001
From: "ager@chromium.org" <ager@chromium.org>
From 3ba270e3b93d292dc53a675a21479bdb0b50bbbe Mon Sep 17 00:00:00 2001
From: ager@chromium.org <ager@chromium.org>
Date: Fri, 6 May 2011 11:07:52 +0000
Subject: [PATCH 10/16] Implement CallAsConstructor method for Object in the
Subject: [PATCH 10/15] Implement CallAsConstructor method for Object in the
API
Patch by Peter Varga.
@ -21,10 +21,10 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7803 ce2b1a6d-e
5 files changed, 276 insertions(+), 8 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 8a8e1cd..84462b5 100644
index 277153e..18527e1 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1765,6 +1765,14 @@ class Object : public Value {
@@ -1766,6 +1766,14 @@ class Object : public Value {
int argc,
Handle<Value> argv[]);
@ -394,5 +394,5 @@ index 693d51e..1334f63 100644
}
}
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From f22d0312faeb93ced8747d9aae8c6d77e11b4aba Mon Sep 17 00:00:00 2001
From 5f3e5dd6901b54707ea4f868d8fa7317c4ab3852 Mon Sep 17 00:00:00 2001
From: Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Date: Tue, 7 Dec 2010 11:56:42 +0100
Subject: [PATCH 11/16] QtScript/V8: Add new v8 api to check if a value is an
Subject: [PATCH 11/15] QtScript/V8: Add new v8 api to check if a value is an
error.
New function v8::Value::IsError was created.
@ -15,7 +15,7 @@ research.
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 84462b5..08b0ec2 100644
index 18527e1..43e00f5 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -937,6 +937,11 @@ class Value : public Data {
@ -60,5 +60,5 @@ index 8cbf378..db90bb9 100644
V(to_string_symbol, "toString") \
V(char_at_symbol, "CharAt") \
--
1.7.6
1.7.4.4

View File

@ -1,8 +1,7 @@
From 472c04c9e7a64e8734c76d2cf97a7cc5b773b788 Mon Sep 17 00:00:00 2001
From: "ager@chromium.org"
<ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
From a338d96fe138fbffd4b45c7d13a54e068daa6e12 Mon Sep 17 00:00:00 2001
From: ager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Date: Mon, 9 May 2011 15:24:48 +0000
Subject: [PATCH 12/16] Add IsCallable method for Object in the API
Subject: [PATCH 12/15] Add IsCallable method for Object in the API
Patch by Peter Varga.
@ -19,10 +18,10 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7828 ce2b1a6d-e
3 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 08b0ec2..4194d4a 100644
index 43e00f5..5e1ce50 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1763,6 +1763,13 @@ class Object : public Value {
@@ -1764,6 +1764,13 @@ class Object : public Value {
V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
/**
@ -113,5 +112,5 @@ index 1334f63..45db5a1 100644
return v8::HandleScope::NumberOfHandles();
}
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From dc2cad4f8fc88c52fcea09b8d0262d35cd32dc44 Mon Sep 17 00:00:00 2001
From c36be227e9d7952a1952caa529c78ecdc376bd55 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Thu, 25 Aug 2011 11:09:58 +1000
Subject: [PATCH 13/16] Remove execute flag from v8-debug.h
Subject: [PATCH 13/15] Remove execute flag from v8-debug.h
---
0 files changed, 0 insertions(+), 0 deletions(-)
@ -11,5 +11,5 @@ diff --git a/include/v8-debug.h b/include/v8-debug.h
old mode 100755
new mode 100644
--
1.7.6
1.7.4.4

View File

@ -1,25 +0,0 @@
From d7e876decc00c611d327185bf890a7efecb2cf7e Mon Sep 17 00:00:00 2001
From: Kent Hansen <kent.hansen@nokia.com>
Date: Mon, 29 Aug 2011 13:26:13 +0200
Subject: [PATCH 14/16] Fix build error: "suggest parentheses around '&&'
within '||'"
---
src/mark-compact.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 1b1e361..775f787 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1020,7 +1020,7 @@ class SymbolTableCleaner : public ObjectVisitor {
// Since no objects have yet been moved we can safely access the map of
// the object.
if ((*p)->IsExternalString() ||
- (*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource()) {
+ ((*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource())) {
heap_->FinalizeExternalString(HeapObject::cast(*p));
}
// Set the entry to null_value (as deleted).
--
1.7.6

View File

@ -1,7 +1,7 @@
From 97cb46d421faebd2b139570bcf9aaf2d5eadc333 Mon Sep 17 00:00:00 2001
From ed5cc903d70f73780e5985e7d2de33f6b8d86402 Mon Sep 17 00:00:00 2001
From: Kent Hansen <kent.hansen@nokia.com>
Date: Fri, 2 Sep 2011 12:03:09 +0200
Subject: [PATCH 16/16] Fix deprecated Python code
Subject: [PATCH 14/15] Fix deprecated Python code
Needed to make the scripts run on Python 3, which is the
default python interpreter on some newer distros.
@ -47,4 +47,5 @@ index 646bf14..395441b 100644
if identifier_second_char != 0:
new_identifier = (
--
1.7.6
1.7.4.4

View File

@ -0,0 +1,46 @@
From 523f03f03b1ac16d272a13389f8a5654d9ff12e6 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Fri, 9 Sep 2011 14:16:12 +1000
Subject: [PATCH 15/15] Allow a script to be flagged as "native"
Native scripts do not appear in backtraces, or in the source and
line number when exceptions are thrown from within them. This is
useful to be able to write code in JavaScript instead of C++ and
still have it appear sensibly to the user.
---
include/v8.h | 5 +++--
src/compiler.cc | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 5e1ce50..a2d61d1 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -578,8 +578,9 @@ class ScriptOrigin {
class V8EXPORT Script {
public:
enum CompileFlags {
- Default = 0x00,
- QmlMode = 0x01
+ Default = 0x00,
+ QmlMode = 0x01,
+ NativeMode = 0x02
};
/**
diff --git a/src/compiler.cc b/src/compiler.cc
index d2191b9..873018c 100755
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -507,7 +507,7 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
// Create a script object describing the script to be compiled.
Handle<Script> script = FACTORY->NewScript(source);
- if (natives == NATIVES_CODE) {
+ if (natives == NATIVES_CODE || compile_flags & v8::Script::NativeMode) {
script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
}
if (!script_name.is_null()) {
--
1.7.4.4

View File

@ -1,25 +0,0 @@
From 0af1e15a3d6b28923c262a02a5ace35812c8f5d6 Mon Sep 17 00:00:00 2001
From: Simon Hausmann <simon.hausmann@nokia.com>
Date: Thu, 4 Aug 2011 21:28:38 +0200
Subject: [PATCH 15/16] Fix source compatibility where the String::Equals
overloads would shadow the Value::Equals function,
breaking the build.
---
include/v8.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 4194d4a..5e1ce50 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1048,6 +1048,7 @@ class String : public Primitive {
*/
V8EXPORT bool Equals(uint16_t *string, int length);
V8EXPORT bool Equals(char *string, int length);
+ inline bool Equals(Handle<Value> that) const { return v8::Value::Equals(that); }
/**
* Write the contents of the string to an external buffer.
--
1.7.6

View File

@ -213,7 +213,7 @@ void tst_QGlobal::qtry()
// check propper if/else scoping
i = 0;
if (true)
if (true) {
QT_TRY {
i = 2;
QT_THROW(42);
@ -222,12 +222,13 @@ void tst_QGlobal::qtry()
QCOMPARE(i, 2);
i = 4;
}
else
} else {
QCOMPARE(i, 0);
}
QCOMPARE(i, 4);
i = 0;
if (false)
if (false) {
QT_TRY {
i = 2;
QT_THROW(42);
@ -236,14 +237,15 @@ void tst_QGlobal::qtry()
QCOMPARE(i, 2);
i = 2;
}
else
} else {
i = 8;
}
QCOMPARE(i, 8);
i = 0;
if (false)
if (false) {
i = 42;
else
} else {
QT_TRY {
i = 2;
QT_THROW(42);
@ -252,6 +254,7 @@ void tst_QGlobal::qtry()
QCOMPARE(i, 2);
i = 4;
}
}
QCOMPARE(i, 4);
}

View File

@ -18,3 +18,6 @@ SUBDIRS=\
qdbusthreading \
qdbusxmlparser \
!contains(QT_CONFIG,private_tests): SUBDIRS -= \
qdbusmarshall \

View File

@ -146,9 +146,12 @@ win32:SUBDIRS -= qtextpiecetable
qgraphicssceneindex \
qlistwidget \
qmainwindow \
qnetworkreply \
qpathclipper \
qpixmapcache \
qsidebar \
qstylesheetstyle \
qtextlayout \
qtextpiecetable \
qtipc \
qtoolbar \

View File

@ -6,4 +6,4 @@ TEMPLATE=subdirs
SUBDIRS=\
network \
networkselftest \
qobjectperformance \
qobjectperformance

View File

@ -118,7 +118,7 @@ void tst_QNetworkProxyFactory::systemProxyForQuery() const
QNetworkProxy proxy;
QList<QNetworkProxy> nativeProxyList;
nativeProxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QString("http://test.proxy.com"), 8080) << QNetworkProxy::NoProxy;
nativeProxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QString("test.proxy.com"), 8080) << QNetworkProxy::NoProxy;
foreach (proxy, systemProxyList) {
if (!nativeProxyList.contains(proxy)) {

View File

@ -1649,7 +1649,7 @@ void tst_QStyleSheetStyle::QTBUG11658_cachecrash()
void tst_QStyleSheetStyle::QTBUG15910_crashNullWidget()
{
struct : QWidget {
struct Widget : QWidget {
virtual void paintEvent(QPaintEvent* ) {
QStyleOption opt;
opt.init(this);

View File

@ -55,6 +55,7 @@ private slots:
void cleanupTestCase() {}
void eval();
void evalwithinwith();
void userobjectcompare();
};
@ -63,6 +64,11 @@ void tst_v8::eval()
QVERIFY(v8test_eval());
}
void tst_v8::evalwithinwith()
{
QVERIFY(v8test_evalwithinwith());
}
void tst_v8::userobjectcompare()
{
QVERIFY(v8test_userobjectcompare());

View File

@ -1,3 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "v8test.h"
#include <stdio.h>
@ -11,6 +52,7 @@ int main(int argc, char *argv[])
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
RUN_TEST(eval);
RUN_TEST(evalwithinwith);
RUN_TEST(userobjectcompare);
return -1;

View File

@ -81,6 +81,49 @@ cleanup:
ENDTEST();
}
bool v8test_evalwithinwith()
{
BEGINTEST();
HandleScope handle_scope;
Persistent<Context> context = Context::New();
Context::Scope context_scope(context);
Local<Object> qmlglobal = Object::New();
qmlglobal->Set(String::New("a"), Integer::New(1922));
// There was a bug that the "eval" lookup would incorrectly resolve
// to the QML global object
qmlglobal->Set(String::New("eval"), Integer::New(1922));
#define SOURCE \
"(function() { " \
" var b = { c: 10 }; " \
" with (b) { " \
" return eval(\"a\"); " \
" } " \
"})"
Local<Script> script = Script::Compile(String::New(SOURCE), NULL, NULL,
Handle<String>(), Script::QmlMode);
#undef SOURCE
TryCatch tc;
Local<Value> result = script->Run(qmlglobal);
VERIFY(!tc.HasCaught());
VERIFY(result->IsFunction());
{
Local<Value> fresult = Handle<Function>::Cast(result)->Call(context->Global(), 0, 0);
VERIFY(!tc.HasCaught());
VERIFY(fresult->Int32Value() == 1922);
}
cleanup:
context.Dispose();
ENDTEST();
}
static int userObjectComparisonCalled = 0;
static bool userObjectComparisonReturn = false;
static Local<Object> expectedLhs;

View File

@ -49,6 +49,7 @@
#endif
bool v8test_eval();
bool v8test_evalwithinwith();
bool v8test_userobjectcompare();
#endif // V8TEST_H

View File

@ -2727,6 +2727,9 @@ void Configure::generateOutputVars()
// We currently have no switch for QtSvg, so add it unconditionally.
qtConfig += "svg";
if (dictionary[ "V8" ] == "yes")
qtConfig += "v8";
// Add config levels --------------------------------------------
QStringList possible_configs = QStringList()
<< "minimal"