| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Fixes test tst_QScriptValue::equals(engine->newVariant(QVariant(123)) <=> engine->newArray(10))
Reviewed-by: Jedrzej Nowacki
|
|
|
|
|
|
|
| |
now that QVariant is known to QMetaType, we can test for the metatype id
instead of doing string comparison
Reviewed-by: Kent Hansen
|
|
|
|
|
|
|
|
|
| |
This conversion needs to be as fast as possible since
it's performed every time you access a QObject property
from QtScript. Hence, we should avoid going via QString
and instead do the conversion ourselves.
Reviewed-by: Jedrzej Nowacki
|
|
|
|
|
|
|
| |
Use JSC::UString internally. Only when the public API demands it
should a JSC::UString be converted to a QString.
Reviewed-by: Jedrzej Nowacki
|
|\
| |
| |
| |
| |
| | |
Conflicts:
qmake/generators/symbian/initprojectdeploy_symbian.cpp
qmake/generators/symbian/symmake_abld.h
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Avoid the engine's list of free script values from growing
without bounds.
When a QScriptValue is initially not bound, its private will
be allocated from the normal heap (and not from the engine's
pool of privates, because there is no engine at this point).
But when a value is later bound (e.g. by setting it as a
property of an object, or by passing it as argument to
QScriptValue::call()) and is subsequently destroyed, its
private will be handed to the engine, which will add it to
its free-list (hence the memory is not freed). This
allocation/deallocation asymmetry causes this list go keep
growing.
The solution is to limit the size of the free-list, and free
the memory of the private immediately when the list has
reached a certain size.
Task-number: QTBUG-8400
Reviewed-by: Olivier Goffart
|
| |
| |
| |
| |
| |
| |
| |
| | |
QScriptValue::isQMetaObject shouldn't crash for a value that internally
is represented as a non JSObjects values.
Additional check was added to QScriptEnginePrivate::isQMetaObject.
Reviewed-by: Kent Hansen
|
| |
| |
| |
| |
| |
| | |
Turn off optimizations in qscriptengine.cpp.
I tried to turn it off/on for a selective few functions,
but without success.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
"e:\pulse\work\91088\src\script\api\qscriptengine.h(360) :
fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c[0x510A0530:0x00000007]', line 243)
To work around this problem, try simplifying or changing the program near the locations listed above."
Apparently the compiler doesn't like that a few functions are inlined.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There's no reason to construct QScriptValues when JSC::JSValues
can be operated on directly. A benchmark showed that ~10% of the
time for reading a QObject property from a script was spent just
creating and destroying QScriptValue temporaries. It's time to
finally get rid of this potential bottleneck, not just in the
QObject integration but everywhere.
This change refactors the code so that all internal operations
are performed on JSC::JSValue (most importantly, conversion
from/to Qt types), and the public API functions are just thin
wrappers around these. E.g. instead of doing
enginePrivate->scriptValueFromJSCValue(jsValue).toQObject()
the implementation now does
QScriptEnginePrivate::toQObject(jsValue)
Other operations are delegated to the engine implementation
in similar style.
Task-number: QTBUG-8304
Reviewed-by: Jedrzej Nowacki
|
| |
| |
| |
| |
| |
| | |
More preparation for operating purely on JSC::JSValue internally.
Reviewed-by: Jedrzej Nowacki
|
| |
| |
| |
| |
| |
| | |
In preparation of operating purely on JSC::JSValue internally.
Reviewed-by: Jedrzej Nowacki
|
| |
| |
| |
| |
| |
| | |
In preparation of doing this conversion in more places.
Reviewed-by: Jedrzej Nowacki
|
| |
| |
| |
| |
| |
| |
| |
| | |
In preparation of getting rid of QScriptValue construction internally;
the implementation should only call the private functions that operate
directly on JSC::JSValues.
Reviewed-by: Jedrzej Nowacki
|
| |
| |
| |
| |
| |
| |
| | |
Also rename ToUint{16,32} to ToUInt{16,32} to follow the Qt
naming (it takes precedence over the ECMA one).
Reviewed-by: Jedrzej Nowacki
|
| |
| |
| |
| |
| |
| |
| | |
These are not dependent on QObject, I don't know how they ended
up inside there.
Reviewed-by: Jedrzej Nowacki
|
| |
| |
| |
| |
| |
| | |
Because that's where they belong.
Reviewed-by: Jedrzej Nowacki
|
| |
| |
| |
| |
| |
| |
| |
| | |
All the public QScriptEngine::create() function does is call the
private implementation anyway, so call QScriptEnginePrivate::create()
directly.
Reviewed-by: Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
|
|/
|
|
|
| |
Otherwise we crash with latest WebKit trunk because the
SourceProvider is prematurely destructed.
|
|
|
|
|
| |
Task-number: None, discovering while doing test refactoring
Reviewed-by: Jedrzej Nowacki
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (71 commits)
QNAM HTTP Code: Cache socket state inside ensureConnection()
tst_qhttpnetworkconnection: Test also HEAD in some tests
tst_qhttpnetworkconnection: Relax condition in getMultipleWithPriorities
QNAM HTTP Code: When starting new request, prefer connected sockets.
typo fix
Added the 'framecapture' WebKit example to the default build.
Fix code example
fix typo in qreadwritelock's documentation
QNAM HTTP: Don't call d_func() so often
QNAM HTTP: Fix readBuffer maximum size.
QNAM HTTP: Optimize eatWhitespace()
QNAM HTTP: Check if socket already tries to connect.
network internals: fix build on S60
[syncqt] Make -separate-module work with WebKit's directory structure
doc: Corrected explanation of when append() does nothing.
doc: Added clarification about allocating space for the 0 terminator.
Add a way to access the normalised URL in QUrl.
[syncqt] Make it possible to synchronize headers for a separate module
[syncqt] Make it possible to override the base directory
network internals: start HTTP GET requests right away when called
...
|
| |
| |
| |
| | |
Reviewed-by: Trust Me
|
|/
|
|
|
|
|
|
| |
QScriptDeclarativeClass.
Task-number: QTBUG-6178
Reviewed-by: Kent Hansen
Reviewed-by: Aaron Kennedy
|
|
|
|
|
|
|
| |
Use the base of the file name as the translation context. (This was
the original behavior before the switch to JSC.)
Reviewed-by: Kent Hansen
|
|
|
|
|
|
|
|
|
|
| |
This reinstates the pre-4.6 behavior: A script-owned C++ object
that's not referenced anymore should be garbage collected, even
if it has connections. In order to achieve this, the "weak"
reference to the C++ object's wrapper must be invalidated.
Task-number: QTBUG-6366
Reviewed-by: Simon Hausmann
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The built-in eval() function bypasses the script registration
performed by QScriptEngine::evaluate(), so if we get an
atStatement() callback from JSC from that script, the
scriptID-to-sourceProvider lookup will fail.
In this case, just return from atStatement() without delivering
the positionChange() callback to the QScriptEngineAgent, since
the agent will not have received the scriptLoad() callback for
that script anyway.
This is a change in behavior from 4.5, but we consider it
the minimum-impact fix at this point to keep 4.6.0 from
crashing. The only downside is that debugging will
effectively be "disabled" for the script passed to eval(),
but that's a lot better than crashing.
Task-number: QTBUG-6108
Reviewed-by: Jedrzej Nowacki
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is required due to the switch to the JavaScriptCore-based
back-end.
Instead of segfaulting somewhere inside JSC::initializeThreading(),
call qFatal() when this constraint has been violated.
Reviewed-by: Simon Hausmann
|
|/
|
|
| |
Over src/ tools/ examples/ and demos/
|
|
|
|
|
|
|
|
| |
to the LGPL only.
To do this I ran replace-licenses.zsh $QTDIR/src/script release
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
|
|
|
|
| |
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
|
|
|
|
|
|
|
|
|
| |
QScriptDeclarativeClass is a private, but exported, class used by the
declarativeui module. It is very similar to QScriptClass, but slightly
faster and provides a couple of "backdoor" extension mechanisms used
by declarative.
Reviewed-by: Warwick Allison
|
|
|
|
| |
(cherry picked from commit d01db18696a7729b0d54af76f5224aed6750f3bb)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It appears that simply being in the scope chain of an existant frame
isn't sufficient to be marked. This can lead to a QScriptContext
scope chain that contains a JSObject that has been collected.
For example, this code:
QScriptContext *ctxt = engine->pushContext();
ctxt.pushScope(engine->newObject());
previouslyCreatedFunctionObject.call(); // causes a GC
can lead to the object added to the scope chain to have become
invalid. This leads to hilarity later on.
Reviewed-by: Kent Hansen
|
|
|
|
|
|
|
|
|
|
| |
Avoid hacking a custom toArrayIndex() in the example; instead provide
an ECMA-compliant conversion that's as fast as possible (having to
convert the QScriptString to a QString and then convert the result to
a number is considerably slower than calling JSC's
Identifier::toArrayIndex() function directly).
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
|
|
|
|
|
| |
QScriptProgram encapsulates a Qt Script program (AKA a script).
It retains the compiled representation of the script, so that
repeated evaluation of the same script becomes faster.
An overload of QScriptEngine::evaluate() that takes a QScriptProgram
has been added.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
| |
Makes QScriptValue::toNumber() ~50% faster.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
|
|
|
|
| |
Calls to engine() are mostly done for checking that the "source"
and "target" engines are the same, but we don't want those checks
to slow us down. Use an inline getEngine() function instead.
This makes e.g. QScriptValue::call() ~10% faster for a function
like "function(a, b) { return a + b; }".
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
|
|
| |
For non-object values, just return the value immediately; there is no way
that the later check (result.isObject()) will be true anyway.
This makes qScriptValueFromValue() ~50% faster.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
|
|
| |
Makes creation+destruction of the QScriptValue a lot faster
because it uses the engine's pool of QScriptValuePrivates
instead of qMalloc()/qFree().
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
|
|
|
| |
Also avoid looking up the object's own properties twice
(before we called getOwnPropertySlot() and then getPropertySlot()
on the same object).
Makes QScriptValue::property() ~20% faster when calling it on an "empty" object.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
| |
Makes QScriptValue::property() ~10% faster.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
| |
Makes QScriptContext::engine() 80% faster.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
| |
Makes QScriptContext::parentContext() 50% faster.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
| |
Makes QScriptEngine::currentContext() 25% faster.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
|
|
| |
The idea is that qsreal can be typedef'ed to float on platforms where it's
appropriate. Since the QScriptValue ctor takes a qsreal, we should not
convert it to a double internally.
Reviewed-by: Olivier Goffart
|
|
|
|
|
|
|
|
| |
We must register the same type as they were registered in Qt 4.5
Reported on qt4-preview-feedback mailing list.
Reviewed-by: Kent Hansen
|
|
|
|
|
|
|
|
|
|
|
| |
The QScriptEngine::hasUncaughtException() flag should be set to true if
returning from a JS function was caused by an exception. According to
documentation, the flag had to be accessible from the
QScriptEngineAgent::functionExit event.
New autotest was added.
Reviewed-by: Kent Hansen
|
|
|
|
| |
Reviewed-by: TrustMe
|
|
|
|
|
| |
It's faster than calling getObject(), since getObject() will do
type checking of the value.
|