summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/interpreter
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/interpreter')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h8
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp87
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h15
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp2
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h4
6 files changed, 80 insertions, 38 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h
index 2d677cea0..75de082a3 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/CallFrame.h
@@ -37,7 +37,7 @@ namespace JSC {
// Passed as the first argument to most functions.
class ExecState : private Register {
public:
- JSFunction* callee() const { return this[RegisterFile::Callee].function(); }
+ JSObject* callee() const { return this[RegisterFile::Callee].object(); }
CodeBlock* codeBlock() const { return this[RegisterFile::CodeBlock].Register::codeBlock(); }
ScopeChainNode* scopeChain() const { return this[RegisterFile::ScopeChain].Register::scopeChain(); }
int argumentCount() const { return this[RegisterFile::ArgumentCount].i(); }
@@ -110,7 +110,7 @@ namespace JSC {
void setScopeChain(ScopeChainNode* scopeChain) { this[RegisterFile::ScopeChain] = scopeChain; }
ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain,
- CallFrame* callerFrame, int returnValueRegister, int argc, JSFunction* function)
+ CallFrame* callerFrame, int returnValueRegister, int argc, JSObject* callee)
{
ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller.
@@ -120,7 +120,7 @@ namespace JSC {
this[RegisterFile::ReturnPC] = vPC; // This is either an Instruction* or a pointer into JIT generated code stored as an Instruction*.
this[RegisterFile::ReturnValueRegister] = returnValueRegister;
setArgumentCount(argc); // original argument count (for the sake of the "arguments" object)
- setCallee(function);
+ setCallee(callee);
setCalleeArguments(0);
}
@@ -136,7 +136,7 @@ namespace JSC {
private:
void setArgumentCount(int count) { this[RegisterFile::ArgumentCount] = count; }
- void setCallee(JSFunction* callee) { this[RegisterFile::Callee] = callee; }
+ void setCallee(JSObject* callee) { this[RegisterFile::Callee] = callee; }
void setCodeBlock(CodeBlock* codeBlock) { this[RegisterFile::CodeBlock] = codeBlock; }
static const intptr_t HostCallFrameFlag = 1;
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp
index e4eebb202..c78466e59 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp
@@ -65,6 +65,14 @@
#include "JIT.h"
#endif
+#if ENABLE(ASSEMBLER)
+#include "AssemblerBuffer.h"
+#endif
+
+#ifdef QT_BUILD_SCRIPT_LIB
+#include "bridge/qscriptobject_p.h"
+#endif
+
using namespace std;
namespace JSC {
@@ -510,9 +518,9 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
exception = createNotAnObjectError(callFrame, static_cast<JSNotAnObjectErrorStub*>(exception), bytecodeOffset, codeBlock);
exceptionValue = exception;
} else {
- if (!exception->hasProperty(callFrame, Identifier(callFrame, "line")) &&
+ if (!exception->hasProperty(callFrame, Identifier(callFrame, JSC_ERROR_LINENUMBER_PROPERTYNAME)) &&
!exception->hasProperty(callFrame, Identifier(callFrame, "sourceId")) &&
- !exception->hasProperty(callFrame, Identifier(callFrame, "sourceURL")) &&
+ !exception->hasProperty(callFrame, Identifier(callFrame, JSC_ERROR_FILENAME_PROPERTYNAME)) &&
!exception->hasProperty(callFrame, Identifier(callFrame, expressionBeginOffsetPropertyName)) &&
!exception->hasProperty(callFrame, Identifier(callFrame, expressionCaretOffsetPropertyName)) &&
!exception->hasProperty(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName))) {
@@ -521,16 +529,16 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
int endOffset = 0;
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(callFrame, bytecodeOffset, divotPoint, startOffset, endOffset);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, line), ReadOnly | DontDelete);
+ exception->putWithAttributes(callFrame, Identifier(callFrame, JSC_ERROR_LINENUMBER_PROPERTYNAME), jsNumber(callFrame, line), ReadOnly | DontDelete);
// We only hit this path for error messages and throw statements, which don't have a specific failure position
// So we just give the full range of the error/throw statement.
exception->putWithAttributes(callFrame, Identifier(callFrame, expressionBeginOffsetPropertyName), jsNumber(callFrame, divotPoint - startOffset), ReadOnly | DontDelete);
exception->putWithAttributes(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName), jsNumber(callFrame, divotPoint + endOffset), ReadOnly | DontDelete);
} else
- exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)), ReadOnly | DontDelete);
+ exception->putWithAttributes(callFrame, Identifier(callFrame, JSC_ERROR_LINENUMBER_PROPERTYNAME), jsNumber(callFrame, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)), ReadOnly | DontDelete);
exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode()->sourceID()), ReadOnly | DontDelete);
- exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode()->sourceURL()), ReadOnly | DontDelete);
+ exception->putWithAttributes(callFrame, Identifier(callFrame, JSC_ERROR_FILENAME_PROPERTYNAME), jsOwnedString(callFrame, codeBlock->ownerNode()->sourceURL()), ReadOnly | DontDelete);
}
if (exception->isWatchdogException()) {
@@ -542,7 +550,8 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
}
}
- if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
+ Debugger* debugger = callFrame->dynamicGlobalObject()->debugger();
+ if (debugger) {
DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
debugger->exception(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset));
}
@@ -567,10 +576,18 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV
HandlerInfo* handler = 0;
while (!(handler = codeBlock->handlerForBytecodeOffset(bytecodeOffset))) {
- if (!unwindCallFrame(callFrame, exceptionValue, bytecodeOffset, codeBlock))
+ if (!unwindCallFrame(callFrame, exceptionValue, bytecodeOffset, codeBlock)) {
+#ifdef QT_BUILD_SCRIPT_LIB
+ if (debugger)
+ debugger->exceptionThrow(DebuggerCallFrame(callFrame, exceptionValue), codeBlock->ownerNode()->sourceID(),false);
+#endif
return 0;
+ }
}
-
+#ifdef QT_BUILD_SCRIPT_LIB
+ if (debugger)
+ debugger->exceptionThrow(DebuggerCallFrame(callFrame, exceptionValue), codeBlock->ownerNode()->sourceID(),true);
+#endif
// Now unwind the scope chain within the exception handler's call frame.
ScopeChainNode* scopeChain = callFrame->scopeChain();
@@ -870,7 +887,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject*
return result;
}
-NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHookID, int firstLine, int lastLine)
+NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHookID, int firstLine, int lastLine, int column)
{
Debugger* debugger = callFrame->dynamicGlobalObject()->debugger();
if (!debugger)
@@ -884,7 +901,7 @@ NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHook
debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
return;
case WillExecuteStatement:
- debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
+ debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine, column);
return;
case WillExecuteProgram:
debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
@@ -893,7 +910,7 @@ NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHook
debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
return;
case DidReachBreakpoint:
- debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
+ debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine, column);
return;
}
}
@@ -1127,7 +1144,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
Instruction* vPC = callFrame->codeBlock()->instructions().begin();
Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
- unsigned tickCount = globalData->timeoutChecker.ticksUntilNextCheck();
+ unsigned tickCount = globalData->timeoutChecker->ticksUntilNextCheck();
#define CHECK_FOR_EXCEPTION() \
do { \
@@ -1143,11 +1160,11 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#define CHECK_FOR_TIMEOUT() \
if (!--tickCount) { \
- if (globalData->timeoutChecker.didTimeOut(callFrame)) { \
+ if (globalData->timeoutChecker->didTimeOut(callFrame)) { \
exceptionValue = jsNull(); \
goto vm_throw; \
} \
- tickCount = globalData->timeoutChecker.ticksUntilNextCheck(); \
+ tickCount = globalData->timeoutChecker->ticksUntilNextCheck(); \
}
#if ENABLE(OPCODE_SAMPLING)
@@ -3062,7 +3079,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (callType == CallTypeHost) {
ScopeChainNode* scopeChain = callFrame->scopeChain();
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
- newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, 0);
+ newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, asObject(v));
Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
ArgList args(thisRegister + 1, argCount - 1);
@@ -3104,7 +3121,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
exceptionValue = createStackOverflowError(callFrame);
goto vm_throw;
}
- int32_t expectedParams = callFrame->callee()->body()->parameterCount();
+ int32_t expectedParams = static_cast<JSFunction*>(callFrame->callee())->body()->parameterCount();
int32_t inplaceArgs = min(argCount, expectedParams);
int32_t i = 0;
Register* argStore = callFrame->registers() + argsOffset;
@@ -3216,7 +3233,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
if (callType == CallTypeHost) {
ScopeChainNode* scopeChain = callFrame->scopeChain();
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
- newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, 0);
+ newCallFrame->init(0, vPC + 5, scopeChain, callFrame, dst, argCount, asObject(v));
Register* thisRegister = newCallFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
ArgList args(thisRegister + 1, argCount - 1);
@@ -3295,17 +3312,27 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
register base to those of the calling function.
*/
+#ifdef QT_BUILD_SCRIPT_LIB
+ Debugger* debugger = callFrame->dynamicGlobalObject()->debugger();
+ intptr_t sourceId = callFrame->codeBlock()->source()->asID();
+#endif
+
int result = (++vPC)->u.operand;
if (callFrame->codeBlock()->needsFullScopeChain())
callFrame->scopeChain()->deref();
JSValue returnValue = callFrame->r(result).jsValue();
+#ifdef QT_BUILD_SCRIPT_LIB
+ if (debugger) {
+ debugger->functionExit(returnValue, sourceId);
+ }
+#endif
vPC = callFrame->returnPC();
int dst = callFrame->returnValueRegister();
callFrame = callFrame->callerFrame();
-
+
if (callFrame->hasHostCallFrameFlag())
return returnValue;
@@ -3448,8 +3475,12 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
structure = asObject(prototype)->inheritorID();
else
structure = callDataScopeChain->globalObject()->emptyObjectStructure();
+#ifdef QT_BUILD_SCRIPT_LIB
+ // ### world-class hack
+ QScriptObject* newObject = new (globalData) QScriptObject(structure);
+#else
JSObject* newObject = new (globalData) JSObject(structure);
-
+#endif
callFrame->r(thisRegister) = JSValue(newObject); // "this" value
CallFrame* previousCallFrame = callFrame;
@@ -3475,8 +3506,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
ArgList args(callFrame->registers() + thisRegister + 1, argCount - 1);
ScopeChainNode* scopeChain = callFrame->scopeChain();
+
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
- newCallFrame->init(0, vPC + 7, scopeChain, callFrame, dst, argCount, 0);
+ newCallFrame->init(0, vPC + 7, scopeChain, callFrame, dst, argCount, asObject(v));
JSValue returnValue;
{
@@ -3647,6 +3679,16 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
*/
ASSERT(exceptionValue);
ASSERT(!globalData->exception);
+
+#ifdef QT_BUILD_SCRIPT_LIB
+ CodeBlock* codeBlock = callFrame->codeBlock();
+ Debugger* debugger = callFrame->dynamicGlobalObject()->debugger();
+ if (debugger) {
+ DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
+ debugger->exceptionCatch(debuggerCallFrame, codeBlock->ownerNode()->sourceID());
+ }
+#endif
+
int ex = (++vPC)->u.operand;
callFrame->r(ex) = exceptionValue;
exceptionValue = JSValue();
@@ -3787,7 +3829,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
NEXT_INSTRUCTION();
}
DEFINE_OPCODE(op_debug) {
- /* debug debugHookID(n) firstLine(n) lastLine(n)
+ /* debug debugHookID(n) firstLine(n) lastLine(n) columnNumber(n)
Notifies the debugger of the current state of execution. This opcode
is only generated while the debugger is attached.
@@ -3795,8 +3837,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
int debugHookID = (++vPC)->u.operand;
int firstLine = (++vPC)->u.operand;
int lastLine = (++vPC)->u.operand;
+ int column = (++vPC)->u.operand;
- debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);
+ debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine, column);
++vPC;
NEXT_INSTRUCTION();
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h
index 5331d929f..69f83cf91 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.h
@@ -110,7 +110,7 @@ namespace JSC {
NEVER_INLINE JSValue callEval(CallFrame*, RegisterFile*, Register* argv, int argc, int registerOffset, JSValue& exceptionValue);
NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset, bool);
- NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine);
+ NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine, int column);
private:
enum ExecutionFlag { Normal, InitializeAndReturn };
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
index 31f0c8b06..6d01eb7c5 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
@@ -40,7 +40,6 @@ namespace JSC {
class CodeBlock;
class ExecState;
class JSActivation;
- class JSFunction;
class JSPropertyNameIterator;
class ScopeChainNode;
@@ -73,7 +72,7 @@ namespace JSC {
Register(JSActivation*);
Register(CallFrame*);
Register(CodeBlock*);
- Register(JSFunction*);
+ Register(JSObject*);
Register(JSPropertyNameIterator*);
Register(ScopeChainNode*);
Register(Instruction*);
@@ -82,7 +81,7 @@ namespace JSC {
Arguments* arguments() const;
CallFrame* callFrame() const;
CodeBlock* codeBlock() const;
- JSFunction* function() const;
+ JSObject* object() const;
JSPropertyNameIterator* propertyNameIterator() const;
ScopeChainNode* scopeChain() const;
Instruction* vPC() const;
@@ -96,7 +95,7 @@ namespace JSC {
Arguments* arguments;
CallFrame* callFrame;
CodeBlock* codeBlock;
- JSFunction* function;
+ JSObject* object;
JSPropertyNameIterator* propertyNameIterator;
ScopeChainNode* scopeChain;
Instruction* vPC;
@@ -152,9 +151,9 @@ namespace JSC {
u.codeBlock = codeBlock;
}
- ALWAYS_INLINE Register::Register(JSFunction* function)
+ ALWAYS_INLINE Register::Register(JSObject* object)
{
- u.function = function;
+ u.object = object;
}
ALWAYS_INLINE Register::Register(Instruction* vPC)
@@ -211,9 +210,9 @@ namespace JSC {
return u.codeBlock;
}
- ALWAYS_INLINE JSFunction* Register::function() const
+ ALWAYS_INLINE JSObject* Register::object() const
{
- return u.function;
+ return u.object;
}
ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp
index cfcf1d362..06ddefc9e 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp
@@ -38,7 +38,7 @@ RegisterFile::~RegisterFile()
#elif HAVE(VIRTUALALLOC)
VirtualFree(m_buffer, 0, MEM_RELEASE);
#else
- #error "Don't know how to release virtual memory on this platform."
+ fastFree(m_buffer);
#endif
}
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h
index d46bdc918..5a34d11b2 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h
@@ -204,8 +204,8 @@ namespace JSC {
CRASH();
}
m_commitEnd = reinterpret_cast<Register*>(reinterpret_cast<char*>(m_buffer) + committedSize);
- #else
- #error "Don't know how to reserve virtual memory on this platform."
+ #else // Neither MMAP nor VIRTUALALLOC - use fastMalloc instead
+ m_buffer = static_cast<Register*>(fastMalloc(bufferLength));
#endif
m_start = m_buffer + maxGlobals;
m_end = m_start;