#define KJS_BREAKPOINT \
if (Debugger::debuggersPresent > 0 && !hitStatement(exec)) \
- return 0;
+ return Completion(Normal);
#define KJS_CHECKEXCEPTION \
if (exec->hadException()) \
return exec->scopeNode()->sourceURL();
}
-JSValue* Node::setErrorCompletion(ExecState* exec, ErrorType e, const char* msg)
+Completion Node::createErrorCompletion(ExecState* exec, ErrorType e, const char *msg)
{
- return exec->setThrowCompletion(Error::create(exec, e, msg, lineNo(), currentSourceId(exec), currentSourceURL(exec)));
+ return Completion(Throw, Error::create(exec, e, msg, lineNo(), currentSourceId(exec), currentSourceURL(exec)));
}
-JSValue* Node::setErrorCompletion(ExecState* exec, ErrorType e, const char* msg, const Identifier& ident)
+Completion Node::createErrorCompletion(ExecState *exec, ErrorType e, const char *msg, const Identifier &ident)
{
UString message = msg;
substitute(message, ident.ustring());
- return exec->setThrowCompletion(Error::create(exec, e, message, lineNo(), currentSourceId(exec), currentSourceURL(exec)));
+ return Completion(Throw, Error::create(exec, e, message, lineNo(), currentSourceId(exec), currentSourceURL(exec)));
}
JSValue *Node::throwError(ExecState* exec, ErrorType e, const char *msg)
}
}
-JSValue* Node::rethrowException(ExecState* exec)
+Completion Node::rethrowException(ExecState* exec)
{
JSValue* exception = exec->exception();
exec->clearException();
handleException(exec, exception);
- return exec->setThrowCompletion(exception);
+ return Completion(Throw, exception);
}
// ------------------------------ StatementNode --------------------------------
m_lastLine = lastLine;
}
-// Set normal completion and return false if the debugger wants us to stop at this point.
-// FIXME: This seems like poor naming and strange design. Why false to stop? Why "hit statement"?
+// return true if the debugger wants us to stop at this point
bool StatementNode::hitStatement(ExecState* exec)
{
- Debugger* debugger = exec->dynamicGlobalObject()->debugger();
- if (!debugger || debugger->atStatement(exec, currentSourceId(exec), firstLine(), lastLine()))
- return true;
- exec->setCompletionType(Normal);
- return false;
+ Debugger *dbg = exec->dynamicGlobalObject()->debugger();
+ if (dbg)
+ return dbg->atStatement(exec, currentSourceId(exec), firstLine(), lastLine());
+ else
+ return true; // continue
}
// ------------------------------ NullNode -------------------------------------
}
// ECMA 12.2
-JSValue* VarStatementNode::execute(ExecState* exec)
+Completion VarStatementNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
next->evaluate(exec);
KJS_CHECKEXCEPTION
- return exec->setNormalCompletion();
+ return Completion(Normal);
}
// ------------------------------ Helper functions for handling Vectors of StatementNode -------------------------------
return (*begin).get();
}
-static inline JSValue* statementListExecute(SourceElements& statements, ExecState* exec)
+static inline Completion statementListExecute(SourceElements& statements, ExecState* exec)
{
- JSValue* value = 0;
- size_t size = statements.size();
- for (size_t i = 0; i != size; ++i) {
- JSValue* statementValue = statements[i]->execute(exec);
- if (exec->completionType() != Normal)
- return statementValue;
- if (statementValue)
- value = statementValue;
+ JSValue* v = 0;
+ Completion c(Normal);
+ const SourceElements::iterator end = statements.end();
+ for (SourceElements::iterator ptr = statements.begin(); ptr != end; ++ptr) {
+ c = (*ptr)->execute(exec);
+
+ if (JSValue* v2 = c.value())
+ v = v2;
+ c.setValue(v);
+
+ if (c.complType() != Normal)
+ return c;
}
- return exec->setNormalCompletion(value);
+ return c;
}
-
+
// ------------------------------ BlockNode ------------------------------------
BlockNode::BlockNode(SourceElements* children)
}
// ECMA 12.1
-JSValue* BlockNode::execute(ExecState* exec)
+Completion BlockNode::execute(ExecState *exec)
{
return statementListExecute(*m_children, exec);
}
// ------------------------------ EmptyStatementNode ---------------------------
// ECMA 12.3
-JSValue* EmptyStatementNode::execute(ExecState* exec)
+Completion EmptyStatementNode::execute(ExecState *)
{
- return exec->setNormalCompletion();
+ return Completion(Normal);
}
// ------------------------------ ExprStatementNode ----------------------------
}
// ECMA 12.4
-JSValue* ExprStatementNode::execute(ExecState* exec)
+Completion ExprStatementNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
- JSValue* value = expr->evaluate(exec);
- KJS_CHECKEXCEPTION
+ JSValue *v = expr->evaluate(exec);
+ KJS_CHECKEXCEPTION
- return exec->setNormalCompletion(value);
+ return Completion(Normal, v);
}
// ------------------------------ IfNode ---------------------------------------
}
// ECMA 12.5
-JSValue* IfNode::execute(ExecState* exec)
+Completion IfNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
bool b = expr->evaluateToBoolean(exec);
KJS_CHECKEXCEPTION
// no else
if (!statement2)
- return exec->setNormalCompletion();
+ return Completion(Normal);
// else
return statement2->execute(exec);
}
// ECMA 12.6.1
-JSValue* DoWhileNode::execute(ExecState* exec)
+Completion DoWhileNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
JSValue* value = 0;
while (1) {
exec->pushIteration();
- JSValue* statementValue = statement->execute(exec);
+ Completion c = statement->execute(exec);
exec->popIteration();
if (exec->dynamicGlobalObject()->timedOut())
- exec->setInterruptedCompletion();
+ return Completion(Interrupted);
- if (statementValue)
- value = statementValue;
+ if (c.isValueCompletion())
+ value = c.value();
- if (exec->completionType() != Normal) {
- if (exec->completionType() == Continue && ls.contains(exec->breakOrContinueTarget()))
- goto continueDoWhileLoop;
- if (exec->completionType() == Break && ls.contains(exec->breakOrContinueTarget()))
- break;
- return statementValue;
+ if (!((c.complType() == Continue) && ls.contains(c.target()))) {
+ if ((c.complType() == Break) && ls.contains(c.target()))
+ return Completion(Normal, value);
+ if (c.complType() != Normal)
+ return c;
}
-continueDoWhileLoop:
bool b = expr->evaluateToBoolean(exec);
KJS_CHECKEXCEPTION
if (!b)
- break;
+ return Completion(Normal, value);
}
- return exec->setNormalCompletion(value);
+ return Completion(); // work around gcc 4.0 bug
}
// ------------------------------ WhileNode ------------------------------------
}
// ECMA 12.6.2
-JSValue* WhileNode::execute(ExecState* exec)
+Completion WhileNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
JSValue* value = 0;
bool b = expr->evaluateToBoolean(exec);
KJS_CHECKEXCEPTION
if (!b)
- break;
+ return Completion(Normal, value);
exec->pushIteration();
- JSValue* statementValue = statement->execute(exec);
+ Completion c = statement->execute(exec);
exec->popIteration();
if (exec->dynamicGlobalObject()->timedOut())
- return exec->setInterruptedCompletion();
+ return Completion(Interrupted);
- if (statementValue)
- value = statementValue;
+ if (c.isValueCompletion())
+ value = c.value();
- if (exec->completionType() != Normal) {
- if (exec->completionType() == Continue && ls.contains(exec->breakOrContinueTarget()))
- continue;
- if (exec->completionType() == Break && ls.contains(exec->breakOrContinueTarget()))
- break;
- return statementValue;
- }
+ if ((c.complType() == Continue) && ls.contains(c.target()))
+ continue;
+ if ((c.complType() == Break) && ls.contains(c.target()))
+ return Completion(Normal, value);
+ if (c.complType() != Normal)
+ return c;
}
- return exec->setNormalCompletion(value);
+ return Completion(); // work around gcc 4.0 bug
}
// ------------------------------ ForNode --------------------------------------
}
// ECMA 12.6.3
-JSValue* ForNode::execute(ExecState *exec)
+Completion ForNode::execute(ExecState *exec)
{
- JSValue* value = 0;
+ JSValue* cval = 0;
if (expr1) {
expr1->evaluate(exec);
bool b = expr2->evaluateToBoolean(exec);
KJS_CHECKEXCEPTION
if (!b)
- break;
+ return Completion(Normal, cval);
}
exec->pushIteration();
- JSValue* statementValue = statement->execute(exec);
+ Completion c = statement->execute(exec);
exec->popIteration();
- if (statementValue)
- value = statementValue;
+ if (c.isValueCompletion())
+ cval = c.value();
+ if (!((c.complType() == Continue) && ls.contains(c.target()))) {
+ if ((c.complType() == Break) && ls.contains(c.target()))
+ return Completion(Normal, cval);
+ if (c.complType() != Normal)
+ return c;
+ }
if (exec->dynamicGlobalObject()->timedOut())
- return exec->setInterruptedCompletion();
-
- if (exec->completionType() != Normal) {
- if (exec->completionType() == Continue && ls.contains(exec->breakOrContinueTarget()))
- goto continueForLoop;
- if (exec->completionType() == Break && ls.contains(exec->breakOrContinueTarget()))
- break;
- return statementValue;
- }
+ return Completion(Interrupted);
-continueForLoop:
if (expr3) {
expr3->evaluate(exec);
KJS_CHECKEXCEPTION
}
}
- return exec->setNormalCompletion(value);
+ return Completion(); // work around gcc 4.0 bug
}
// ------------------------------ ForInNode ------------------------------------
}
// ECMA 12.6.4
-JSValue* ForInNode::execute(ExecState* exec)
+Completion ForInNode::execute(ExecState *exec)
{
- JSValue* value = 0;
+ JSValue *e;
+ JSValue *retval = 0;
+ JSObject *v;
+ Completion c;
+ PropertyNameArray propertyNames;
if (varDecl) {
varDecl->evaluate(exec);
KJS_CHECKEXCEPTION
}
- JSValue* e = expr->evaluate(exec);
+ e = expr->evaluate(exec);
- // For Null and Undefined, we want to make sure not to go through
- // the loop at all, because toObject will throw an exception.
+ // for Null and Undefined, we want to make sure not to go through
+ // the loop at all, because their object wrappers will have a
+ // property list but will throw an exception if you attempt to
+ // access any property.
if (e->isUndefinedOrNull())
- return exec->setNormalCompletion();
+ return Completion(Normal);
KJS_CHECKEXCEPTION
- JSObject* v = e->toObject(exec);
- PropertyNameArray propertyNames;
+ v = e->toObject(exec);
v->getPropertyNames(exec, propertyNames);
PropertyNameArray::const_iterator end = propertyNames.end();
for (PropertyNameArray::const_iterator it = propertyNames.begin(); it != end; ++it) {
- const Identifier& name = *it;
+ const Identifier &name = *it;
if (!v->hasProperty(exec, name))
continue;
KJS_CHECKEXCEPTION
exec->pushIteration();
- JSValue* statementValue = statement->execute(exec);
+ c = statement->execute(exec);
exec->popIteration();
- if (statementValue)
- value = statementValue;
+ if (c.isValueCompletion())
+ retval = c.value();
- if (exec->completionType() != Normal) {
- if (exec->completionType() == Continue && ls.contains(exec->breakOrContinueTarget()))
- continue;
- if (exec->completionType() == Break && ls.contains(exec->breakOrContinueTarget()))
- break;
- return statementValue;
+ if (!((c.complType() == Continue) && ls.contains(c.target()))) {
+ if ((c.complType() == Break) && ls.contains(c.target()))
+ break;
+ if (c.complType() != Normal) {
+ return c;
+ }
}
}
- return exec->setNormalCompletion(value);
+ return Completion(Normal, retval);
}
// ------------------------------ ContinueNode ---------------------------------
// ECMA 12.7
-JSValue* ContinueNode::execute(ExecState* exec)
+Completion ContinueNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
if (ident.isEmpty() && !exec->inIteration())
- return setErrorCompletion(exec, SyntaxError, "Invalid continue statement.");
+ return createErrorCompletion(exec, SyntaxError, "Invalid continue statement.");
if (!ident.isEmpty() && !exec->seenLabels()->contains(ident))
- return setErrorCompletion(exec, SyntaxError, "Label %s not found.", ident);
- return exec->setContinueCompletion(&ident);
+ return createErrorCompletion(exec, SyntaxError, "Label %s not found.", ident);
+ return Completion(Continue, &ident);
}
// ------------------------------ BreakNode ------------------------------------
// ECMA 12.8
-JSValue* BreakNode::execute(ExecState *exec)
+Completion BreakNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
- if (ident.isEmpty() && !exec->inIteration() && !exec->inSwitch())
- return setErrorCompletion(exec, SyntaxError, "Invalid break statement.");
+ if (ident.isEmpty() && !exec->inIteration() &&
+ !exec->inSwitch())
+ return createErrorCompletion(exec, SyntaxError, "Invalid break statement.");
if (!ident.isEmpty() && !exec->seenLabels()->contains(ident))
- return setErrorCompletion(exec, SyntaxError, "Label %s not found.");
- return exec->setBreakCompletion(&ident);
+ return createErrorCompletion(exec, SyntaxError, "Label %s not found.");
+ return Completion(Break, &ident);
}
// ------------------------------ ReturnNode -----------------------------------
}
// ECMA 12.9
-JSValue* ReturnNode::execute(ExecState* exec)
+Completion ReturnNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
CodeType codeType = exec->codeType();
if (codeType != FunctionCode)
- return setErrorCompletion(exec, SyntaxError, "Invalid return statement.");
+ return createErrorCompletion(exec, SyntaxError, "Invalid return statement.");
if (!value)
- return exec->setReturnValueCompletion(jsUndefined());
+ return Completion(ReturnValue, jsUndefined());
- JSValue* v = value->evaluate(exec);
+ JSValue *v = value->evaluate(exec);
KJS_CHECKEXCEPTION
- return exec->setReturnValueCompletion(v);
+ return Completion(ReturnValue, v);
}
// ------------------------------ WithNode -------------------------------------
}
// ECMA 12.10
-JSValue* WithNode::execute(ExecState *exec)
+Completion WithNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
JSValue *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
JSObject *o = v->toObject(exec);
KJS_CHECKEXCEPTION
exec->pushScope(o);
- JSValue* value = statement->execute(exec);
+ Completion res = statement->execute(exec);
exec->popScope();
- return value;
+ return res;
}
// ------------------------------ CaseClauseNode -------------------------------
}
// ECMA 12.11
-JSValue* CaseClauseNode::executeStatements(ExecState* exec)
+Completion CaseClauseNode::evalStatements(ExecState *exec)
{
if (m_children)
return statementListExecute(*m_children, exec);
- return exec->setNormalCompletion();
+ else
+ return Completion(Normal, jsUndefined());
}
// ------------------------------ ClauseListNode -------------------------------
}
// ECMA 12.11
-JSValue* CaseBlockNode::executeBlock(ExecState* exec, JSValue* input)
+Completion CaseBlockNode::evalBlock(ExecState *exec, JSValue *input)
{
- ClauseListNode* a = list1.get();
+ JSValue *v;
+ Completion res;
+ ClauseListNode *a = list1.get();
+ ClauseListNode *b = list2.get();
+ CaseClauseNode *clause;
+
while (a) {
- CaseClauseNode* clause = a->getClause();
+ clause = a->getClause();
a = a->getNext();
- JSValue* v = clause->evaluate(exec);
+ v = clause->evaluate(exec);
KJS_CHECKEXCEPTION
if (strictEqual(exec, input, v)) {
- JSValue* res = clause->executeStatements(exec);
- if (exec->completionType() != Normal)
+ res = clause->evalStatements(exec);
+ if (res.complType() != Normal)
return res;
- for (; a; a = a->getNext()) {
- JSValue* res = a->getClause()->executeStatements(exec);
- if (exec->completionType() != Normal)
+ while (a) {
+ res = a->getClause()->evalStatements(exec);
+ if (res.complType() != Normal)
return res;
+ a = a->getNext();
}
break;
}
}
- ClauseListNode* b = list2.get();
while (b) {
- CaseClauseNode* clause = b->getClause();
+ clause = b->getClause();
b = b->getNext();
- JSValue* v = clause->evaluate(exec);
+ v = clause->evaluate(exec);
KJS_CHECKEXCEPTION
if (strictEqual(exec, input, v)) {
- JSValue* res = clause->executeStatements(exec);
- if (exec->completionType() != Normal)
+ res = clause->evalStatements(exec);
+ if (res.complType() != Normal)
return res;
goto step18;
}
// default clause
if (def) {
- JSValue* res = def->executeStatements(exec);
- if (exec->completionType() != Normal)
+ res = def->evalStatements(exec);
+ if (res.complType() != Normal)
return res;
}
b = list2.get();
step18:
while (b) {
- CaseClauseNode* clause = b->getClause();
- JSValue* res = clause->executeStatements(exec);
- if (exec->completionType() != Normal)
+ clause = b->getClause();
+ res = clause->evalStatements(exec);
+ if (res.complType() != Normal)
return res;
b = b->getNext();
}
// bail out on error
KJS_CHECKEXCEPTION
- return exec->setNormalCompletion();
+ return Completion(Normal);
}
// ------------------------------ SwitchNode -----------------------------------
}
// ECMA 12.11
-JSValue* SwitchNode::execute(ExecState* exec)
+Completion SwitchNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
JSValue *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
exec->pushSwitch();
- JSValue* result = block->executeBlock(exec, v);
+ Completion res = block->evalBlock(exec,v);
exec->popSwitch();
- if (exec->completionType() == Break && ls.contains(exec->breakOrContinueTarget()))
- exec->setCompletionType(Normal);
- return result;
+ if ((res.complType() == Break) && ls.contains(res.target()))
+ return Completion(Normal, res.value());
+ return res;
}
// ------------------------------ LabelNode ------------------------------------
}
// ECMA 12.12
-JSValue* LabelNode::execute(ExecState *exec)
+Completion LabelNode::execute(ExecState *exec)
{
if (!exec->seenLabels()->push(label))
- return setErrorCompletion(exec, SyntaxError, "Duplicated label %s found.", label);
- JSValue* result = statement->execute(exec);
+ return createErrorCompletion(exec, SyntaxError, "Duplicated label %s found.", label);
+ Completion e = statement->execute(exec);
exec->seenLabels()->pop();
- if (exec->completionType() == Break && exec->breakOrContinueTarget() == label)
- exec->setCompletionType(Normal);
- return result;
+ if ((e.complType() == Break) && (e.target() == label))
+ return Completion(Normal, e.value());
+ return e;
}
// ------------------------------ ThrowNode ------------------------------------
}
// ECMA 12.13
-JSValue* ThrowNode::execute(ExecState* exec)
+Completion ThrowNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
JSValue *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
handleException(exec, v);
- return exec->setThrowCompletion(v);
+ return Completion(Throw, v);
}
// ------------------------------ TryNode --------------------------------------
}
// ECMA 12.14
-JSValue* TryNode::execute(ExecState *exec)
+Completion TryNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT
+ KJS_BREAKPOINT;
- JSValue* result = tryBlock->execute(exec);
+ Completion c = tryBlock->execute(exec);
if (Collector::isOutOfMemory())
- return result; // don't try to catch an out of memory exception thrown by the collector
+ return c; // don't try to catch an out of memory exception thrown by the collector
- if (catchBlock && exec->completionType() == Throw) {
- JSObject* obj = new JSObject;
- obj->put(exec, exceptionIdent, result, DontDelete);
+ if (catchBlock && c.complType() == Throw) {
+ JSObject *obj = new JSObject;
+ obj->put(exec, exceptionIdent, c.value(), DontDelete);
exec->pushScope(obj);
- result = catchBlock->execute(exec);
+ c = catchBlock->execute(exec);
exec->popScope();
}
if (finallyBlock) {
- ComplType savedCompletionType = exec->completionType();
- JSValue* finallyResult = finallyBlock->execute(exec);
- if (exec->completionType() != Normal)
- result = finallyResult;
- else
- exec->setCompletionType(savedCompletionType);
+ Completion c2 = finallyBlock->execute(exec);
+ if (c2.complType() != Normal)
+ c = c2;
}
- return result;
+ return c;
}
// ------------------------------ FunctionBodyNode -----------------------------
return s;
}
-JSValue* ProgramNode::execute(ExecState* exec)
+Completion ProgramNode::execute(ExecState* exec)
{
processDeclarations(exec);
return ScopeNode::execute(exec);
}
-JSValue* EvalNode::execute(ExecState* exec)
+Completion EvalNode::execute(ExecState* exec)
{
processDeclarations(exec);
return ScopeNode::execute(exec);
}
-JSValue* FunctionBodyNode::execute(ExecState* exec)
+Completion FunctionBodyNode::execute(ExecState* exec)
{
processDeclarations(exec);
if (Debugger* dbg = exec->dynamicGlobalObject()->debugger()) {
if (!dbg->callEvent(exec, sourceId(), lineNo(), exec->function(), *exec->arguments())) {
dbg->imp()->abort();
- return exec->setInterruptedCompletion();
+ return Completion(Interrupted, jsUndefined());
}
}
- JSValue* result = ScopeNode::execute(exec);
+ Completion completion = ScopeNode::execute(exec);
if (Debugger* dbg = exec->dynamicGlobalObject()->debugger()) {
- if (exec->completionType() == Throw)
- exec->setException(result);
+ if (completion.complType() == Throw)
+ exec->setException(completion.value());
+
if (!dbg->returnEvent(exec, sourceId(), lineNo(), exec->function())) {
dbg->imp()->abort();
- return exec->setInterruptedCompletion();
+ return Completion(Interrupted, jsUndefined());
}
}
- return result;
+ return completion;
}
// ------------------------------ FuncDeclNode ---------------------------------
return func;
}
-JSValue* FuncDeclNode::execute(ExecState* exec)
+Completion FuncDeclNode::execute(ExecState *)
{
- return exec->setNormalCompletion();
+ return Completion(Normal);
}
// ------------------------------ FuncExprNode ---------------------------------
protected:
Node(JSType) KJS_FAST_CALL; // used by ExpressionNode
+ Completion createErrorCompletion(ExecState *, ErrorType, const char *msg) KJS_FAST_CALL;
+ Completion createErrorCompletion(ExecState *, ErrorType, const char *msg, const Identifier &) KJS_FAST_CALL;
- // for use in execute()
- JSValue* setErrorCompletion(ExecState*, ErrorType, const char* msg) KJS_FAST_CALL;
- JSValue* setErrorCompletion(ExecState*, ErrorType, const char* msg, const Identifier&) KJS_FAST_CALL;
-
- // for use in evaluate()
JSValue* throwError(ExecState*, ErrorType, const char* msg) KJS_FAST_CALL;
JSValue* throwError(ExecState*, ErrorType, const char* msg, const char*) KJS_FAST_CALL;
JSValue* throwError(ExecState*, ErrorType, const char* msg, JSValue*, Node*) KJS_FAST_CALL;
void handleException(ExecState*) KJS_FAST_CALL;
void handleException(ExecState*, JSValue*) KJS_FAST_CALL;
- // for use in execute()
- JSValue* rethrowException(ExecState*) KJS_FAST_CALL;
+ Completion rethrowException(ExecState*) KJS_FAST_CALL;
int m_line : 28;
unsigned m_expectedReturnType : 3; // JSType
void setLoc(int line0, int line1) KJS_FAST_CALL;
int firstLine() const KJS_FAST_CALL { return lineNo(); }
int lastLine() const KJS_FAST_CALL { return m_lastLine; }
- virtual JSValue* execute(ExecState *exec) KJS_FAST_CALL = 0;
+ bool hitStatement(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState *exec) KJS_FAST_CALL = 0;
void pushLabel(const Identifier &id) KJS_FAST_CALL { ls.push(id); }
virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
protected:
- bool hitStatement(ExecState*) KJS_FAST_CALL;
LabelStack ls;
private:
int m_lastLine;
public:
VarStatementNode(VarDeclNode* l) KJS_FAST_CALL : next(l) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<VarDeclNode> next;
return elems;
}
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL { ASSERT_NOT_REACHED(); }
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL { ASSERT_NOT_REACHED(); return 0; }
+ virtual Completion execute(ExecState*) KJS_FAST_CALL { ASSERT_NOT_REACHED(); return Completion(); }
virtual void streamTo(SourceStream&) const KJS_FAST_CALL { ASSERT_NOT_REACHED(); }
virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
private:
public:
BlockNode(SourceElements* children) KJS_FAST_CALL;
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
protected:
OwnPtr<SourceElements> m_children;
class EmptyStatementNode : public StatementNode {
public:
EmptyStatementNode() KJS_FAST_CALL { } // debug
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
};
public:
ExprStatementNode(ExpressionNode* e) KJS_FAST_CALL : expr(e) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr;
IfNode(ExpressionNode* e, StatementNode *s1, StatementNode *s2) KJS_FAST_CALL
: expr(e), statement1(s1), statement2(s2) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr;
public:
DoWhileNode(StatementNode *s, ExpressionNode* e) KJS_FAST_CALL : statement(s), expr(e) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<StatementNode> statement;
public:
WhileNode(ExpressionNode* e, StatementNode *s) KJS_FAST_CALL : expr(e), statement(s) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr;
}
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr1;
ForInNode(ExpressionNode* l, ExpressionNode* e, StatementNode *s) KJS_FAST_CALL;
ForInNode(const Identifier &i, AssignExprNode *in, ExpressionNode* e, StatementNode *s) KJS_FAST_CALL;
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
VarDeclNode* getVarDecl() { return varDecl.get(); }
private:
public:
ContinueNode() KJS_FAST_CALL { }
ContinueNode(const Identifier &i) KJS_FAST_CALL : ident(i) { }
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
Identifier ident;
public:
BreakNode() KJS_FAST_CALL { }
BreakNode(const Identifier &i) KJS_FAST_CALL : ident(i) { }
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
Identifier ident;
public:
ReturnNode(ExpressionNode* v) KJS_FAST_CALL : value(v) {}
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> value;
public:
WithNode(ExpressionNode* e, StatementNode* s) KJS_FAST_CALL : expr(e), statement(s) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr;
public:
LabelNode(const Identifier &l, StatementNode *s) KJS_FAST_CALL : label(l), statement(s) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
Identifier label;
public:
ThrowNode(ExpressionNode* e) KJS_FAST_CALL : expr(e) {}
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr;
TryNode(StatementNode *b, const Identifier &e, StatementNode *c, StatementNode *f) KJS_FAST_CALL
: tryBlock(b), exceptionIdent(e), catchBlock(c), finallyBlock(f) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<StatementNode> tryBlock;
class ProgramNode : public ScopeNode {
public:
ProgramNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
private:
void initializeSymbolTable(ExecState*) KJS_FAST_CALL;
class EvalNode : public ScopeNode {
public:
EvalNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
private:
ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
public:
FunctionBodyNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
SymbolTable& symbolTable() KJS_FAST_CALL { return m_symbolTable; }
: ident(i), body(b) { addParams(); }
FuncDeclNode(const Identifier& i, ParameterNode* p, FunctionBodyNode* b) KJS_FAST_CALL
: ident(i), param(p), body(b) { addParams(); }
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
ALWAYS_INLINE FunctionImp* makeFunction(ExecState*) KJS_FAST_CALL;
Identifier ident;
virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
JSValue* evaluate(ExecState*) KJS_FAST_CALL;
- JSValue* executeStatements(ExecState*) KJS_FAST_CALL;
+ Completion evalStatements(ExecState*) KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr;
public:
CaseBlockNode(ClauseListNode* l1, CaseClauseNode* d, ClauseListNode* l2) KJS_FAST_CALL;
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- JSValue* executeBlock(ExecState*, JSValue *input) KJS_FAST_CALL;
+ Completion evalBlock(ExecState *exec, JSValue *input) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
private:
public:
SwitchNode(ExpressionNode* e, CaseBlockNode *b) KJS_FAST_CALL : expr(e), block(b) { }
virtual void optimizeVariableAccess(SymbolTable&, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
- virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
+ virtual Completion execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr;