diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-11 11:53:04 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-12 13:15:23 (GMT) |
commit | 45e2a19b4b75fe94a78161f26862bf3c6f727d74 (patch) | |
tree | a6e698eee514ad28815519f3b2ba5ac592941de3 /src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp | |
parent | e806a4e887b6584f1115ced3cb489bb0e9a2de36 (diff) | |
download | Qt-45e2a19b4b75fe94a78161f26862bf3c6f727d74.zip Qt-45e2a19b4b75fe94a78161f26862bf3c6f727d74.tar.gz Qt-45e2a19b4b75fe94a78161f26862bf3c6f727d74.tar.bz2 |
Refactor the way the JS stack are created for native function
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
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp index 5fe792f..d4eb307 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp @@ -25,12 +25,6 @@ #include "config.h" #include "ConstructData.h" -#ifdef QT_BUILD_SCRIPT_LIB -#include "ExceptionHelpers.h" -#include "Interpreter.h" -#include "JSGlobalObject.h" -#include "bridge/qscriptobject_p.h" -#endif #include "JSFunction.h" @@ -60,39 +54,8 @@ JSObject* JSC::NativeConstrWrapper::operator() (ExecState* exec, JSObject* jsobj JSObject* construct(ExecState* exec, JSValue callee, ConstructType constructType, const ConstructData& constructData, const ArgList& args) { - if (constructType == ConstructTypeHost) { -#ifdef QT_BUILD_SCRIPT_LIB - Structure* structure; - JSValue prototype = callee.get(exec, exec->propertyNames().prototype); - if (prototype.isObject()) - structure = asObject(prototype)->inheritorID(); - else - structure = exec->lexicalGlobalObject()->emptyObjectStructure(); - JSObject* thisObj = new (exec) QScriptObject(structure); - - ScopeChainNode* scopeChain = exec->scopeChain(); - Interpreter *interp = exec->interpreter(); - Register *oldEnd = interp->registerFile().end(); - int argc = 1 + args.size(); // implicit "this" parameter - if (!interp->registerFile().grow(oldEnd + argc + RegisterFile::CallFrameHeaderSize)) - return asObject(createStackOverflowError(exec)); - CallFrame* newCallFrame = CallFrame::create(oldEnd); - size_t dst = 0; - newCallFrame[0] = JSValue(thisObj); - ArgList::const_iterator it; - for (it = args.begin(); it != args.end(); ++it) - newCallFrame[++dst] = *it; - newCallFrame += argc + RegisterFile::CallFrameHeaderSize; - newCallFrame->init(0, /*vPC=*/0, scopeChain, exec, 0, argc, asObject(callee)); - JSObject *result = constructData.native.function(newCallFrame, asObject(callee), args); - if (!result) - result = thisObj; - interp->registerFile().shrink(oldEnd); - return result; -#else + if (constructType == ConstructTypeHost) return constructData.native.function(exec, asObject(callee), args); -#endif - } ASSERT(constructType == ConstructTypeJS); // FIXME: Can this be done more efficiently using the constructData? return asFunction(callee)->construct(exec, args); |