summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptvalue.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use JSC::asObject() when we know that the value is an objectKent Hansen2009-10-071-2/+2
| | | | | It's faster than calling getObject(), since getObject() will do type checking of the value.
* Inline QScriptValuePrivate operator new and deleteKent Hansen2009-10-071-16/+0
| | | | Make allocation faster.
* implement property getters&setters for setProperty(quint32) overloadKent Hansen2009-10-061-2/+4
| | | | | | It's better that this works rather than asserts. Reviewed-by: Olivier Goffart
* Update src/3rdparty/javascriptcore and adapt src/script to the changes.Kent Hansen2009-09-241-18/+16
| | | | Reviewed-by: Simon Hausmann
* don't crash in property access after script class has been set to 0Kent Hansen2009-09-221-5/+9
| | | | | | | | When the script class is set to 0, we need to remove the script object's delegate entirely, because the delegate requires a non-0 script class in order to be useful. Reviewed-by: Olivier Goffart
* Fix QScriptValue::strictlyEqualsSimon Hausmann2009-09-221-1/+8
| | | | | | | | strictlyEquals has to continue to work if one of the values has an engine and the other one doesn't. Use the other value's engine to construct a JSValue if possible and use JSC::JSValue::strictEqual. Reviewed-by: Kent Hansen
* Fix QScriptValue constructors without a QScriptEngineSimon Hausmann2009-09-221-36/+9
| | | | | | | Don't create JSC types as the conversion back to a string now requires an ExecState. Reviewed-by: Kent Hansen
* use JSObject::inherits() instead of JSObject::isObject()Kent Hansen2009-09-211-1/+1
| | | | | | The functions are identical, but in recent WebKit trunk isObject() doesn't exist anymore. So this renaming is done to prepare for the import of a more recent JavaScriptCore.
* Fix compilation with winscwSimon Hausmann2009-09-101-12/+12
| | | | | | | | 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
* Update tech preview license header for files that are new in 4.6.Jason McDonald2009-08-311-13/+13
| | | | Reviewed-by: Trust Me
* fix crash due to double deletionKent Hansen2009-08-311-1/+0
| | | | Needed due to commit 3636e666528b72de79f8c7012690bb9e279f0863
* warn if QScriptValue::setScriptClass() is called on incompatible objectKent Hansen2009-08-261-1/+6
|
* don't crash when attempting to access properties of a JS Object that ↵Kent Hansen2009-08-261-24/+23
| | | | | | | | | | | belonged to a deleted script engine When the engine is deleted, the JSValue is invalidated, but the QScriptValue's type will still be QScriptValuePrivate::JSC. Use a new helper function, isObject(), that checks both that the value is of type JSC _and_ that it is valid, before calling JSValue::isObject() (JSValue::isObject() assumes that the value is valid).
* fix performance issue with QScriptValue::propertyFlags()Kent Hansen2009-08-261-28/+37
| | | | | | | Calling QScriptEngine::toStringHandle() is dead slow, so don't call it; use JSC::Identifier directly. This is the same issue as was fixed for setProperty() in commit a8574172dd5e6bc11cf6f69b6fad5a063549e88d.
* fix performance issue with QScriptValue::setProperty()Kent Hansen2009-08-241-75/+81
| | | | | Calling QScriptEngine::toStringHandle() is dead slow, so don't call it; use JSC::Identifier() directly instead.
* add an internal QScriptValue ctor to initialize from d-pointerKent Hansen2009-08-241-0/+8
| | | | | Avoid having to create a dummy QScriptValue (which will have its d_ptr set to 0).
* make some internal qtscript functions inlineKent Hansen2009-08-241-53/+0
| | | | Make it faster.
* compile fix with namespaced Qthjk2009-08-241-2/+2
|
* pass engine pointer to QScriptValuePrivateKent Hansen2009-08-241-31/+17
| | | | Just a little cleanup.
* handle memory management of QScriptValuePrivate in engine if possibleKent Hansen2009-08-241-15/+31
| | | | | | | | | 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
* avoid calling QScriptValue::isFunction() inside call() and construct()Kent Hansen2009-08-241-16/+26
| | | | | | | Avoid calling virtual function JSC::JSValue::get{Call,Construct}Data() twice. Reviewed-by: Olivier Goffart
* use QVarLengthArray instead of QVector for holding JS argumentsKent Hansen2009-08-241-4/+3
| | | | | | It's faster. Reviewed-by: Olivier Goffart
* QScriptValue: No need to create the activation object for call or constructOlivier Goffart2009-08-241-4/+0
| | | | It is uneeded and add useless overhead
* Fix obsolete license headers.Jason McDonald2009-08-211-1/+1
| | | | Reviewed-by: Trust Me
* compile again after mergeHarald Fernengel2009-08-211-33/+4
|
* 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-36/+20
| | | | Get rid of the hash.
* store the engine's d-pointer in QScriptValuePrivateKent Hansen2009-08-201-117/+85
| | | | | It's the d-pointer that we most frequently want to access, so store it to avoid having to use QScriptEnginePrivate::get() all over the place.
* remove redundant variableKent Hansen2009-08-201-5/+2
|
* Fix QScriptValue::objectId().Jedrzej Nowacki2009-08-191-2/+2
| | | | | | | QScriptValue id were made persistent. It depands on JSC:JSValue JSCell pointer not on QScriptValuePrivate attr. Reviewed-by: Kent Hansen
* Clean upJedrzej Nowacki2009-08-191-1/+0
| | | | | | There is no point in setting class member in destructor Reviewed-by: Kent Hansen
* Internal API clean up.Jedrzej Nowacki2009-08-191-11/+0
| | | | | | Static method QScriptValue::initFromJSCValue was removed. Reviewed-by: Kent Hansen
* Clean up.Jedrzej Nowacki2009-08-191-32/+32
| | | | | | | | | Internal API of QScriptValue were cleaned. toPublic() was removed and replaced by standard static Private::get(). All initFromXXX() methods were replaced by overload call of initFrom(). Reviewed-by: Kent Hansen
* Clean up.Jedrzej Nowacki2009-08-181-11/+9
| | | | | | | Get rid of conversion functions QScript::qtStringFromJSCUString and QScript::qtStringToJSCUString. Code was moved to cast operators. Reviewed-by: Kent Hansen
* Fix compilation on WindowsSimon Hausmann2009-08-141-0/+1
| | | | | | In WebKit/JSC config.h needs to be included first in .cpp files, to among other things make sure that min/max are not defined as macros through windows.h.
* Lazily construct the QScriptActivationObjectOlivier Goffart2009-08-131-0/+5
| | | | | | | | | | | 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-5/+0
|
* Refactor the way the JS stack are created for native functionOlivier Goffart2009-08-121-1/+0
| | | | | | | | | | 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
* make property flags lookup work for properties in prototype chainKent Hansen2009-08-101-3/+7
| | | | | JSObject::getPropertyAttributes() does not follow the prototype chain, so we have to do it.
* make ResolveScope property lookup work (kind of)Kent Hansen2009-08-101-2/+9
| | | | | Look in the __qt_scope__ property that is set by QScriptValue::setScope().
* 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
* remove docs that mention QScriptValue::{scope,setScope}()Kent Hansen2009-08-061-2/+2
| | | | | | Those functions are internal and we don't want to support them in the JSC back-end, because they expose too much implementation detail of the old back-end.
* adapt to commit 014c4c63066fd3920594e6a58b02f314b5c88cdfKent Hansen2009-08-041-6/+6
|
* Unify QScriptValue::toObject() and QScriptEngine::toObject()Benjamin Poulain2009-08-031-19/+1
| | | | | | | QScriptValue::toObject() call QScriptEngine::toObject() so the code is not duplicated. Reviewed-by: Kent Hansen
* Move the declaration on some function into qscriptengine_p.hOlivier Goffart2009-07-311-7/+0
|
* Fix license headersOlivier Goffart2009-07-291-7/+37
|
* don't allow defining getter/setter for __proto__ propertyKent Hansen2009-07-281-4/+9
|
* make more tests pass for QScriptValue::setProperty()Kent Hansen2009-07-281-23/+53
| | | | | | JSC doesn't provide a way of un-defining a getter/setter. If deleting e.g. only the setter, we remember the getter, delete the property, then re-establish the getter.
* make QScriptEngine::setGlobalObject() work to some extentKent Hansen2009-07-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 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.