summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Add QScriptDeclarativeClassAaron Kennedy2009-11-101-1/+1
| | | | | | | | | 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
* Say hello to QScriptProgram :-)Kent Hansen2009-10-281-0/+5
| | | | | | | | | | | 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
* Inline QtScript exception helper functionsKent Hansen2009-10-231-0/+16
| | | | | | Makes QScriptValue::toNumber() ~50% faster. Reviewed-by: Olivier Goffart
* Inline internal property lookup functionKent Hansen2009-10-231-0/+22
| | | | | | | | | 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
* Inline scriptEngineFromExec() functionKent Hansen2009-10-231-2/+18
| | | | | | Makes QScriptContext::engine() 80% faster. Reviewed-by: Olivier Goffart
* Inline internal QtScript functions (frameForContext())Kent Hansen2009-10-231-2/+12
| | | | | | Makes QScriptContext::parentContext() 50% faster. Reviewed-by: Olivier Goffart
* Inline two internal QtScript functions (contextForFrame() and globalExec())Kent Hansen2009-10-231-2/+17
| | | | | | Makes QScriptEngine::currentContext() 25% faster. Reviewed-by: Olivier Goffart
* Use the qsreal type instead of double when working with QtScript numbersKent Hansen2009-10-221-1/+1
| | | | | | | | 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
* Regression fix. Fix the hasUncaughtException() flag in debugger's event.Jedrzej Nowacki2009-10-191-0/+5
| | | | | | | | | | | 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
* Inline QScriptValuePrivate operator new and deleteKent Hansen2009-10-071-0/+16
| | | | Make allocation faster.
* Fix column number provided to QScriptEngineAgentKent Hansen2009-10-011-1/+72
| | | | | | | | Introduced a helper function in our custom source provider, columnNumberFromOffset(), that maps an absolute offset in the source input to a relative column number. Reviewed-by: Jedrzej Nowacki
* QScript: Fix strange bugs and crashes.Olivier Goffart2009-09-281-1/+2
| | | | | | | | | | I was assuming that the default return value register was always set to 0 for native calls. But this is not the case. So we must ensure this. Also be consistend in the way the stackframe grow and shrink. This expose another bug in the way the call frame is created in JSC Reviewed-by: Kent Hansen
* Update src/3rdparty/javascriptcore and adapt src/script to the changes.Kent Hansen2009-09-241-1/+5
| | | | Reviewed-by: Simon Hausmann
* make sure the engine's currentFrame is in sync when calling out to public APIKent Hansen2009-09-221-0/+23
| | | | | | | The currentFrame pointer is used e.g. by QScriptValue::toString(). It needs to be in sync, otherwise we will crash. Reviewed-by: Olivier Goffart
* put the this-register calculation into a functionKent Hansen2009-09-181-0/+1
| | | | | | Avoid copy and paste. Reviewed-by: Olivier Goffart
* Fix compilation with winscwSimon Hausmann2009-09-101-2/+2
| | | | | | | | Winscw gets very confused when the name of an enum value is the same as the name of an entire namespace, JSC in this case. Renaming the enum value to JavaScriptCore fixes this. Rubber-stamped-by: Kent
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* improve memory management scheme of QScriptString(Private)Kent Hansen2009-09-021-5/+24
| | | | | | | | Get rid of QPointer. Use linked list of privates (like was recently done for QScriptValue). Allocate the private on the stack when we can. Reviewed-by: Olivier Goffart
* Optimize QScriptClassOlivier Goffart2009-09-021-0/+10
| | | | | | | Do not convert JSC::Identifier to QString to convert it later to JSC::Identivier again Reviewed-by: Kent Hansen
* Update tech preview license header for files that are new in 4.6.Jason McDonald2009-08-311-13/+13
| | | | Reviewed-by: Trust Me
* make some internal qtscript functions inlineKent Hansen2009-08-241-7/+111
| | | | Make it faster.
* compile fix with namespaced Qthjk2009-08-241-2/+2
|
* handle memory management of QScriptValuePrivate in engine if possibleKent Hansen2009-08-241-0/+4
| | | | | | | | | Avoid calling malloc() and free() so often. The premise is that QScriptValue is usually a short-lived type, and only a few QScriptValues exist at a time, so if we cache privates in the engine, QScriptValues will be much faster to create and destroy. Reviewed-by: Olivier Goffart
* Fix obsolete license headers.Jason McDonald2009-08-211-1/+1
| | | | Reviewed-by: Trust Me
* implement registered script values as a doubly linked listKent Hansen2009-08-201-1/+1
| | | | It's faster.
* use a list to keep track of registered script valuesKent Hansen2009-08-201-8/+2
| | | | Get rid of the hash.
* provide line number information for innermost call frameKent Hansen2009-08-201-0/+1
| | | | | For the innermost frame, we don't have a returnPC, so use the line number that was last passed to the engine agent.
* Do not pass JSValue per const referenceOlivier Goffart2009-08-191-2/+2
| | | | It is a POD with the size of a pointer
* Fix QScriptValue::objectId().Jedrzej Nowacki2009-08-191-2/+0
| | | | | | | QScriptValue id were made persistent. It depands on JSC:JSValue JSCell pointer not on QScriptValuePrivate attr. Reviewed-by: Kent Hansen
* make QScriptEngine::isEvaluating() work for top-level evaluationKent Hansen2009-08-191-0/+1
| | | | | | Since QScriptEngine::evaluate() doesn't create a new stack frame anymore, we need to use a dedicated variable to keep track of whether the engine is currently evaluating or not.
* adopt same ownership relationship of scriptengine agents as in old back-endKent Hansen2009-08-181-1/+4
| | | | The engine owns its agents, and also knows when they are deleted.
* Clean up.Jedrzej Nowacki2009-08-181-2/+0
| | | | | | | Get rid of conversion functions QScript::qtStringFromJSCUString and QScript::qtStringToJSCUString. Code was moved to cast operators. Reviewed-by: Kent Hansen
* Lazily construct the QScriptActivationObjectOlivier Goffart2009-08-131-0/+9
| | | | | | | | | | | We can store flags on the ReturnValueRegister entry in the stackframe header (as native function don't use that) Then when requesting an activation object we can lookup the flags to know if we should create it. This reduce a lot the cost of a native call. Reviewed-by: Kent Hansen
* Make simple function getters inlineOlivier Goffart2009-08-121-2/+2
|
* Refactor the way the JS stack are created for native functionOlivier Goffart2009-08-121-18/+4
| | | | | | | | | | The original JavaScriptCore doesn't create stack frame or scope for native function. JSC has been patched to support that. This commit revert our patches to JSC, and implement create the stack frame from QScript Reviewed-by: Kent Hansen
* get rid of dynamic castsKent Hansen2009-08-101-0/+3
|
* cleanup (hide the use of reinterpret_cast)Kent Hansen2009-08-101-2/+3
| | | | | Introduce a frameForContext() function so we don't have to cast all over the place.
* add configure options for (not) building the QtScript moduleKent Hansen2009-08-071-4/+0
| | | | | | | | | | | | | | | | | | -script (default) and -no-script. This means we can get rid of the SCRIPT feature from qfeatures, since it's now handled by the new configure variable. It also allows us to get rid of all the QT_NO_SCRIPT ifdefs from the source files, since qmake isn't going to include those files for compilation when you configure with -no-script. The QtScriptTools module will be disabled if the QtScript module is not built. You'll have to build the old QtScript back-end (will be made available in a separate package), then build the QtScriptTools module yourself. Reviewed-by: Simon Hausmann
* port commit 47c9e7b1b3551ff6dbe71590461a45ae398a9501 from qt/masterKent Hansen2009-08-061-3/+5
|
* remove unused codeOlivier Goffart2009-08-041-1/+0
|
* Implement QScriptEngine::abortEvaluation()Tor Arne Vestbø2009-08-031-0/+1
| | | | | | We store the abort-state in the TimeoutChecker, since that's where we'll mostly access it, but the abort result is stored in the QScriptEngine's d-pointer.
* Remove QScriptContextPrivate, QScriptContext is now a JSC::CallFrameOlivier Goffart2009-07-311-1/+2
| | | | | | | | | | | | | | There will not be instances of QScriptContext anymore. Pointer to QScriptContext are just pointer to JSC::CallFrame This simplifies the code as we do not need to manage the memory for the QScriptContext anymore. It is compatible because it is not possible to create QScriptContext. They were all created by QScriptEngine. QScriptContext constructor is private. Aknoweldged-by: Kent
* Move the declaration on some function into qscriptengine_p.hOlivier Goffart2009-07-311-11/+18
|
* Small Refactoring of QScriptOlivier Goffart2009-07-311-0/+18
| | | | | | | | | - Create a scope (activation object) for the native constructor in QScriptClass - put the isCalledasConstructor in the activation object (so i can clean up the QScriptContext - Remove the code duplication in all native functions. Aknoweldged-by: Kent
* Fix license headersOlivier Goffart2009-07-291-4/+34
|
* Fix tst_QScriptEngine::nestedEvaluateOlivier Goffart2009-07-281-0/+1
| | | | | | The 'this' value was not correctly set when evaluating Reviewed-by: Kent Hansen
* make QScriptEngine::setGlobalObject() work to some extentKent Hansen2009-07-271-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | JSC requires that the global object is actually a JSGlobalObject instance, whereas QScriptEngine::setGlobalObject() allows any object to be set as the global object. The way we solve this is by proxying from an internal global object to the custom (user-set) object. We need to take care that the internal global object is never actually exposed through our API; a brilliantly named helper function, toUsableValue(), makes that happen. Evaluating "var a = 10" with a custom global object doesn't work yet; the variable always ends up in the internal Global Object. For variable assignments, JSC appears to bypass the normal JSObject::put() and instead use JSGlobalObject::copyGlobals{From,To}(), which means I can't intercept and proxy the assignments. This commit enough to get the Context2D example working. There's another bug with iteration of the built-in Global Object's properties (non-enumerable properties are always skipped by the JSC C++ API, whereas with QScriptValueIterator they should not be), but that's a totally separate issue.
* don't rely on custom global object to get GC callbackKent Hansen2009-07-271-1/+3
| | | | | | | | | | | Install custom ClientData on JSGlobalData instance instead. Also some cleanups to avoid globalObject et al being accessed directly. Killed the proxying scheme employed in setGlobalObject() since it didn't work; if you stored the original Global Object and replaced it with another object, then added properties to the new object, they would show up in the old object, too (because the old object would always proxy to whatever the current Global Object was).
* Remove the uncaughtException, use the JSC exception insteadBenjamin Poulain2009-07-271-1/+0
| | | | | | | | | Use the exception from JSC::exec instead of QScriptEngin::uncaughtException. A few more tests are passing for qscriptvalue and qscriptqobject. Reviewed-by: Kent Hansen
* move engine-specific GC marking to QScriptEnginePrivateKent Hansen2009-07-271-0/+1
|