summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptcontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* use JSObject::inherits() instead of JSObject::isObject()Kent Hansen2009-09-211-3/+3
| | | | | | 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.
* put the this-register calculation into a functionKent Hansen2009-09-181-1/+1
| | | | | | Avoid copy and paste. Reviewed-by: Olivier Goffart
* Fix the bactkrace in the QScript DebuggerOlivier Goffart2009-09-091-6/+1
| | | | | | | | | | | | | | | | | | This patch remove the 'fake' context that appears in the debugger backtrace when there is a break point in the global context. This problem never appeared in the tests because the QScriptContext::backtrace has always at least two items in the backtrace as it needs the native 'bt' function to be called. Changed QScriptEnginePrivate::contextForFrame to skip the fake frame (instead of QScriptContext::parentContext). So we never have a QScriptContext pointing to that frame. The changes in QScriptContextInfo are for retreiving the right filename information for the global context when the global context is on top. Reviewed-by: Kent Hansen
* 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 QScriptContext::argumentObjects for function called with QScriptValue::callOlivier Goffart2009-08-241-2/+7
| | | | They have the hostCallFrameFlag, but are function context, not <eval> context
* remove unused variableKent Hansen2009-08-201-1/+0
|
* Fix the QScriptContext::argumentsObject and QScriptContext::argument for js ↵Olivier Goffart2009-08-181-7/+14
| | | | | | | | | | | | functions On js functions, if the number of arguments is different from the number of expected arguments, they are located in different place in the stackframe. We need to call the JSC functions that take that into account. Test is the backtrace test Reviewed-by: Kent Hansen
* Clean up.Jedrzej Nowacki2009-08-181-2/+2
| | | | | | | Get rid of conversion functions QScript::qtStringFromJSCUString and QScript::qtStringToJSCUString. Code was moved to cast operators. Reviewed-by: Kent Hansen
* push the right object when the argument is the Global ObjectKent Hansen2009-08-141-4/+13
| | | | | | | | | Since the internal Global Object is never exposed to the public, we need to do like we do in setActivationObject(): if the object passed is the Global Object proxy, use the internal Global Object as the "real" argument. (JSC requires that the initial object pushed onto the scope chain is an instance of JSC::JSGlobalObject, and the Global Object proxy is not; hence, we can't push the proxy.)
* Detect evaluation context in the backtraceOlivier Goffart2009-08-141-0/+3
|
* More polishing on the backtraceOlivier Goffart2009-08-141-3/+7
| | | | | | change the coding style of function from foo (arg=text) to foo(arg = 'text')
* make sure QScriptContext::scopeChain() returns the right objectKent Hansen2009-08-141-2/+9
| | | | | | | | Follow-up to commit e0a86dc604b87921652b844a5f85889bb6291ed9. Just like in the activationObject() function, we need to check if the activation object is actually a proxy to another object, and return that other object if that's the case (the proxy object should not be exposed to the public).
* make it possible for any script object to serve as activation objectKent Hansen2009-08-141-6/+23
| | | | | | | This was possible in the old back-end. In JSC, activation objects have to be instances of JSC::JSVariableObject. So the way we solve it is by having our QScriptActivationObject be able to act as a proxy to any other JSObject.
* 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.
* Skip the fake context created by Interpreter::exucute for the backtraceOlivier Goffart2009-08-141-0/+5
|
* Lazily construct the QScriptActivationObjectOlivier Goffart2009-08-131-23/+36
| | | | | | | | | | | 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
* Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into ↵Kent Hansen2009-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtscript-jsc-backend Conflicts: configure src/script/qscriptarray_p.h src/script/qscriptasm.cpp src/script/qscriptasm_p.h src/script/qscriptbuffer_p.h src/script/qscriptclass.cpp src/script/qscriptclassdata.cpp src/script/qscriptclassdata_p.h src/script/qscriptclassinfo_p.h src/script/qscriptclasspropertyiterator_p.h src/script/qscriptcompiler.cpp src/script/qscriptcompiler_p.h src/script/qscriptcontext_p.cpp src/script/qscriptcontext_p.h src/script/qscriptcontextfwd_p.h src/script/qscriptcontextinfo_p.h src/script/qscriptecmaarray.cpp src/script/qscriptecmaarray_p.h src/script/qscriptecmaboolean.cpp src/script/qscriptecmaboolean_p.h src/script/qscriptecmacore.cpp src/script/qscriptecmacore_p.h src/script/qscriptecmadate.cpp src/script/qscriptecmadate_p.h src/script/qscriptecmaerror.cpp src/script/qscriptecmaerror_p.h src/script/qscriptecmafunction.cpp src/script/qscriptecmafunction_p.h src/script/qscriptecmaglobal.cpp src/script/qscriptecmaglobal_p.h src/script/qscriptecmamath.cpp src/script/qscriptecmamath_p.h src/script/qscriptecmanumber.cpp src/script/qscriptecmanumber_p.h src/script/qscriptecmaobject.cpp src/script/qscriptecmaobject_p.h src/script/qscriptecmaregexp.cpp src/script/qscriptecmaregexp_p.h src/script/qscriptecmastring.cpp src/script/qscriptecmastring_p.h src/script/qscriptengine.cpp src/script/qscriptengine_p.cpp src/script/qscriptengine_p.h src/script/qscriptengineagent_p.h src/script/qscriptenginefwd_p.h src/script/qscriptextenumeration.cpp src/script/qscriptextenumeration_p.h src/script/qscriptextqobject.cpp src/script/qscriptextqobject_p.h src/script/qscriptextvariant.cpp src/script/qscriptextvariant_p.h src/script/qscriptfunction.cpp src/script/qscriptfunction_p.h src/script/qscriptgc_p.h src/script/qscriptglobals_p.h src/script/qscriptmember_p.h src/script/qscriptnameid_p.h src/script/qscriptnodepool_p.h src/script/qscriptobject_p.h src/script/qscriptobjectfwd_p.h src/script/qscriptprettypretty.cpp src/script/qscriptprettypretty_p.h src/script/qscriptsyntaxcheckresult_p.h src/script/qscriptvalue.cpp src/script/qscriptvalue_p.h src/script/qscriptvaluefwd_p.h src/script/qscriptvalueimpl.cpp src/script/qscriptvalueimpl_p.h src/script/qscriptvalueimplfwd_p.h src/script/qscriptvalueiteratorimpl.cpp src/script/qscriptvalueiteratorimpl_p.h
* make it possible to pop all items in a scope chain and then push to itKent Hansen2009-08-111-8/+24
| | | | | | | | | | | | | A lot of the JSC::ExecState functions rely on scopeChain() not being 0. This means we shouldn't pop the scope chain if doing so would make it empty; otherwise when you call e.g. pushScope() or evaluate(), you will crash. So instead of popping the chain completely, we now set the sole scope chain item's object pointer to 0 and add appropriate checks elsewhere. A second issue, not solved in this commit, is that JSC expects the Global Object to always be the last item in every scope chain. If it's not, you will crash.
* Fix line number and arguments in QScriptContext::toStringOlivier Goffart2009-08-111-5/+2
| | | | | | | | | | | | For arguments, we always need to skip the implicit 'this' argument For line number, we walk thought the stack frames from the top to find the one above the requested one, which contains the returnPC we need. Also fixed a crash because QScriptContext::parentContext would have returned a pointer with flags inside. Reviewed-by: Kent Hansen
* make QScriptContext::setScope() fail for object created in other engineKent Hansen2009-08-101-0/+6
| | | | | Also fix some autotest failures, improve the descriptions of failures, and make the tests run to completion.
* implement QScriptContext::setActivationObject()Kent Hansen2009-08-101-3/+19
|
* cleanup (hide the use of reinterpret_cast)Kent Hansen2009-08-101-20/+20
| | | | | Introduce a frameForContext() function so we don't have to cast all over the place.
* implement QScriptContext::backtrace()Kent Hansen2009-08-101-34/+2
| | | | | Doesn't pass the test yet, but at least it returns something that might be useful on occasion.
* 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
* Use a more reliable method to dinstinguish between an op_call and an ↵Olivier Goffart2009-08-041-2/+5
| | | | | | | | | | | | | | | | | | op_construct The two opcode operand looks like this. -7 -6 -5 -4 -3 -2 -1 op_construct dst(r) func(r) argCount(n) registerOffset(n) proto(r) thisRegister(r) op_call dst(r) func(r) argCount(n) registerOffset(n) as the registerOffset must always be bigger than any register we can use that knoweldge to differenciate the two calls Note that this is only the fallback used for JavaScript function. native function still uses the QScriptActivationObject Reviewed-by: Kent Hansen
* QScriptContext::calledAsConstructor also works with non-native functionOlivier Goffart2009-08-031-5/+21
| | | | | | | Use the opcode to see if it was called with op_construct This could also work with native function, but not when they are called with QScriptValue::call() or QScriptValue::construct()
* Remove QScriptContextPrivate, QScriptContext is now a JSC::CallFrameOlivier Goffart2009-07-311-100/+75
| | | | | | | | | | | | | | 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-5/+0
|
* Small Refactoring of QScriptOlivier Goffart2009-07-311-4/+14
| | | | | | | | | - 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
* implement QScriptContext::activationObject()Kent Hansen2009-07-301-9/+38
|
* Implement QScriptEngine::pushContext end popContextOlivier Goffart2009-07-301-1/+3
| | | | Reviewed-by: Kent Hansen
* set calledAsConstructor to true when function is called as constructorKent Hansen2009-07-291-0/+5
|
* initialize calledAsConstructor memberKent Hansen2009-07-291-0/+1
|
* Memory leak.Olivier Goffart2009-07-291-1/+1
| | | | d_ptr is not stack allocated anymore
* Set the this object on the global context sets the global objectOlivier Goffart2009-07-281-1/+1
| | | | Reviewed-by: Kent Hansen
* Fix tst_QScriptEngine::nestedEvaluateOlivier Goffart2009-07-281-7/+1
| | | | | | The 'this' value was not correctly set when evaluating Reviewed-by: Kent Hansen
* don't rely on custom global object to get GC callbackKent Hansen2009-07-271-6/+6
| | | | | | | | | | | 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).
* Fix tst_QScriptContext::argumentsOlivier Goffart2009-07-271-2/+3
|
* avoid crashing when attempting to set this-object of global contextKent Hansen2009-07-151-0/+4
|
* some small fixes/experimentsKent Hansen2009-07-101-4/+20
|
* make arguments object work for native functionsKent Hansen2009-07-091-1/+1
| | | | There's an off-by-one issue that we just work around for now.
* rewrite most of QScriptContext handlingKent Hansen2009-07-081-33/+117
| | | | Do it The right way(TM), by lazily wrapping JSC::ExecState objects.
* Merge branch 'qtwebkit-4.6-staging' into qtscript-jsc-backendKent Hansen2009-06-291-4/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/script/api/qscriptable.cpp src/script/api/qscriptclasspropertyiterator.cpp src/script/api/qscriptcontext.cpp src/script/api/qscriptengine.h src/script/api/qscriptengineagent.cpp src/script/api/qscriptextensionplugin.cpp src/script/api/qscriptvalue.h src/script/api/qscriptvalueiterator.cpp src/script/parser/qscript.g src/script/parser/qscriptast.cpp src/script/parser/qscriptast_p.h src/script/parser/qscriptastvisitor_p.h src/script/parser/qscriptgrammar.cpp src/script/parser/qscriptgrammar_p.h src/script/parser/qscriptlexer.cpp src/script/parser/qscriptlexer_p.h src/script/parser/qscriptparser.cpp src/script/parser/qscriptparser_p.h src/script/parser/qscriptsyntaxchecker.cpp src/script/qscriptable.h src/script/qscriptable_p.h src/script/qscriptarray_p.h src/script/qscriptasm.cpp src/script/qscriptasm_p.h src/script/qscriptastfwd_p.h src/script/qscriptastvisitor.cpp src/script/qscriptbuffer_p.h src/script/qscriptclass.cpp src/script/qscriptclass.h src/script/qscriptclass_p.h src/script/qscriptclassdata.cpp src/script/qscriptclassdata_p.h src/script/qscriptclassinfo_p.h src/script/qscriptclasspropertyiterator.h src/script/qscriptclasspropertyiterator_p.h src/script/qscriptcompiler.cpp src/script/qscriptcompiler_p.h src/script/qscriptcontext.h src/script/qscriptcontext_p.cpp src/script/qscriptcontext_p.h src/script/qscriptcontextfwd_p.h src/script/qscriptcontextinfo.cpp src/script/qscriptcontextinfo.h src/script/qscriptcontextinfo_p.h src/script/qscriptecmaarray.cpp src/script/qscriptecmaarray_p.h src/script/qscriptecmaboolean.cpp src/script/qscriptecmaboolean_p.h src/script/qscriptecmacore.cpp src/script/qscriptecmacore_p.h src/script/qscriptecmadate.cpp src/script/qscriptecmadate_p.h src/script/qscriptecmaerror.cpp src/script/qscriptecmaerror_p.h src/script/qscriptecmafunction.cpp src/script/qscriptecmafunction_p.h src/script/qscriptecmaglobal.cpp src/script/qscriptecmaglobal_p.h src/script/qscriptecmamath.cpp src/script/qscriptecmamath_p.h src/script/qscriptecmanumber.cpp src/script/qscriptecmanumber_p.h src/script/qscriptecmaobject.cpp src/script/qscriptecmaobject_p.h src/script/qscriptecmaregexp.cpp src/script/qscriptecmaregexp_p.h src/script/qscriptecmastring.cpp src/script/qscriptecmastring_p.h src/script/qscriptengine.cpp src/script/qscriptengine_p.cpp src/script/qscriptengine_p.h src/script/qscriptengineagent.h src/script/qscriptengineagent_p.h src/script/qscriptenginefwd_p.h src/script/qscriptextensioninterface.h src/script/qscriptextensionplugin.h src/script/qscriptextenumeration.cpp src/script/qscriptextenumeration_p.h src/script/qscriptextqobject.cpp src/script/qscriptextqobject_p.h src/script/qscriptextvariant.cpp src/script/qscriptextvariant_p.h src/script/qscriptfunction.cpp src/script/qscriptfunction_p.h src/script/qscriptgc_p.h src/script/qscriptglobals_p.h src/script/qscriptmember_p.h src/script/qscriptmemberfwd_p.h src/script/qscriptmemorypool_p.h src/script/qscriptnameid_p.h src/script/qscriptnodepool_p.h src/script/qscriptobject_p.h src/script/qscriptobjectdata_p.h src/script/qscriptobjectfwd_p.h src/script/qscriptrepository_p.h src/script/qscriptstring.cpp src/script/qscriptstring.h src/script/qscriptstring_p.h src/script/qscriptsyntaxchecker_p.h src/script/qscriptsyntaxcheckresult_p.h src/script/qscriptvalue.cpp src/script/qscriptvalue_p.h src/script/qscriptvaluefwd_p.h src/script/qscriptvalueimpl.cpp src/script/qscriptvalueimpl_p.h src/script/qscriptvalueimplfwd_p.h src/script/qscriptvalueiterator.h src/script/qscriptvalueiterator_p.h src/script/qscriptvalueiteratorimpl.cpp src/script/qscriptvalueiteratorimpl_p.h src/script/visitors/qscriptprettypretty.cpp src/script/visitors/qscriptprettypretty_p.h src/script/visitors/qscriptxmlgenerator.cpp src/script/visitors/qscriptxmlgenerator_p.h
* make more qscriptengine tests runKent Hansen2009-06-241-6/+45
| | | | | Not everything passes but at least nothing asserts anymore, so the test runs to completion.
* Import JSC-based Qt Script from Kent's tree.Simon Hausmann2009-06-161-0/+496