#define KJS_BREAKPOINT \
if (Debugger::debuggersPresent > 0 && !hitStatement(exec)) \
- return Completion(Normal);
+ return 0;
#define KJS_CHECKEXCEPTION \
if (exec->hadException()) \
return exec->scopeNode()->sourceURL();
}
-Completion Node::createErrorCompletion(ExecState* exec, ErrorType e, const char *msg)
+JSValue* Node::setErrorCompletion(ExecState* exec, ErrorType e, const char* msg)
{
- return Completion(Throw, Error::create(exec, e, msg, lineNo(), currentSourceId(exec), currentSourceURL(exec)));
+ return exec->setThrowCompletion(Error::create(exec, e, msg, lineNo(), currentSourceId(exec), currentSourceURL(exec)));
}
-Completion Node::createErrorCompletion(ExecState *exec, ErrorType e, const char *msg, const Identifier &ident)
+JSValue* Node::setErrorCompletion(ExecState* exec, ErrorType e, const char* msg, const Identifier& ident)
{
UString message = msg;
substitute(message, ident.ustring());
- return Completion(Throw, Error::create(exec, e, message, lineNo(), currentSourceId(exec), currentSourceURL(exec)));
+ return exec->setThrowCompletion(Error::create(exec, e, message, lineNo(), currentSourceId(exec), currentSourceURL(exec)));
}
JSValue *Node::throwError(ExecState* exec, ErrorType e, const char *msg)
}
}
-Completion Node::rethrowException(ExecState* exec)
+JSValue* Node::rethrowException(ExecState* exec)
{
JSValue* exception = exec->exception();
exec->clearException();
handleException(exec, exception);
- return Completion(Throw, exception);
+ return exec->setThrowCompletion(exception);
}
// ------------------------------ StatementNode --------------------------------
m_lastLine = lastLine;
}
-// return true if the debugger wants us to stop at this point
+// 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"?
bool StatementNode::hitStatement(ExecState* exec)
{
- Debugger *dbg = exec->dynamicGlobalObject()->debugger();
- if (dbg)
- return dbg->atStatement(exec, currentSourceId(exec), firstLine(), lastLine());
- else
- return true; // continue
+ Debugger* debugger = exec->dynamicGlobalObject()->debugger();
+ if (!debugger || debugger->atStatement(exec, currentSourceId(exec), firstLine(), lastLine()))
+ return true;
+ exec->setCompletionType(Normal);
+ return false;
}
// ------------------------------ NullNode -------------------------------------
}
// ECMA 12.2
-Completion VarStatementNode::execute(ExecState *exec)
+JSValue* VarStatementNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
next->evaluate(exec);
KJS_CHECKEXCEPTION
- return Completion(Normal);
+ return exec->setNormalCompletion();
}
// ------------------------------ Helper functions for handling Vectors of StatementNode -------------------------------
return (*begin).get();
}
-static inline Completion statementListExecute(SourceElements& statements, ExecState* exec)
+static inline JSValue* statementListExecute(SourceElements& statements, ExecState* exec)
{
- 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;
+ 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;
}
- return c;
+ return exec->setNormalCompletion(value);
}
-
+
// ------------------------------ BlockNode ------------------------------------
BlockNode::BlockNode(SourceElements* children)
}
// ECMA 12.1
-Completion BlockNode::execute(ExecState *exec)
+JSValue* BlockNode::execute(ExecState* exec)
{
return statementListExecute(*m_children, exec);
}
// ------------------------------ EmptyStatementNode ---------------------------
// ECMA 12.3
-Completion EmptyStatementNode::execute(ExecState *)
+JSValue* EmptyStatementNode::execute(ExecState* exec)
{
- return Completion(Normal);
+ return exec->setNormalCompletion();
}
// ------------------------------ ExprStatementNode ----------------------------
}
// ECMA 12.4
-Completion ExprStatementNode::execute(ExecState *exec)
+JSValue* ExprStatementNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
- JSValue *v = expr->evaluate(exec);
- KJS_CHECKEXCEPTION
+ JSValue* value = expr->evaluate(exec);
+ KJS_CHECKEXCEPTION
- return Completion(Normal, v);
+ return exec->setNormalCompletion(value);
}
// ------------------------------ IfNode ---------------------------------------
}
// ECMA 12.5
-Completion IfNode::execute(ExecState* exec)
+JSValue* IfNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
bool b = expr->evaluateToBoolean(exec);
KJS_CHECKEXCEPTION
// no else
if (!statement2)
- return Completion(Normal);
+ return exec->setNormalCompletion();
// else
return statement2->execute(exec);
}
// ECMA 12.6.1
-Completion DoWhileNode::execute(ExecState *exec)
+JSValue* DoWhileNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
JSValue* value = 0;
while (1) {
exec->pushIteration();
- Completion c = statement->execute(exec);
+ JSValue* statementValue = statement->execute(exec);
exec->popIteration();
if (exec->dynamicGlobalObject()->timedOut())
- return Completion(Interrupted);
+ exec->setInterruptedCompletion();
- if (c.isValueCompletion())
- value = c.value();
+ if (statementValue)
+ value = 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;
+ 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;
}
+continueDoWhileLoop:
bool b = expr->evaluateToBoolean(exec);
KJS_CHECKEXCEPTION
if (!b)
- return Completion(Normal, value);
+ break;
}
- return Completion(); // work around gcc 4.0 bug
+ return exec->setNormalCompletion(value);
}
// ------------------------------ WhileNode ------------------------------------
}
// ECMA 12.6.2
-Completion WhileNode::execute(ExecState *exec)
+JSValue* WhileNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
JSValue* value = 0;
bool b = expr->evaluateToBoolean(exec);
KJS_CHECKEXCEPTION
if (!b)
- return Completion(Normal, value);
+ break;
exec->pushIteration();
- Completion c = statement->execute(exec);
+ JSValue* statementValue = statement->execute(exec);
exec->popIteration();
if (exec->dynamicGlobalObject()->timedOut())
- return Completion(Interrupted);
+ return exec->setInterruptedCompletion();
- if (c.isValueCompletion())
- value = c.value();
+ if (statementValue)
+ value = 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;
+ if (exec->completionType() != Normal) {
+ if (exec->completionType() == Continue && ls.contains(exec->breakOrContinueTarget()))
+ continue;
+ if (exec->completionType() == Break && ls.contains(exec->breakOrContinueTarget()))
+ break;
+ return statementValue;
+ }
}
- return Completion(); // work around gcc 4.0 bug
+ return exec->setNormalCompletion(value);
}
// ------------------------------ ForNode --------------------------------------
}
// ECMA 12.6.3
-Completion ForNode::execute(ExecState *exec)
+JSValue* ForNode::execute(ExecState *exec)
{
- JSValue* cval = 0;
+ JSValue* value = 0;
if (expr1) {
expr1->evaluate(exec);
bool b = expr2->evaluateToBoolean(exec);
KJS_CHECKEXCEPTION
if (!b)
- return Completion(Normal, cval);
+ break;
}
exec->pushIteration();
- Completion c = statement->execute(exec);
+ JSValue* statementValue = statement->execute(exec);
exec->popIteration();
- 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 (statementValue)
+ value = statementValue;
if (exec->dynamicGlobalObject()->timedOut())
- return Completion(Interrupted);
+ 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;
+ }
+continueForLoop:
if (expr3) {
expr3->evaluate(exec);
KJS_CHECKEXCEPTION
}
}
- return Completion(); // work around gcc 4.0 bug
+ return exec->setNormalCompletion(value);
}
// ------------------------------ ForInNode ------------------------------------
}
// ECMA 12.6.4
-Completion ForInNode::execute(ExecState *exec)
+JSValue* ForInNode::execute(ExecState* exec)
{
- JSValue *e;
- JSValue *retval = 0;
- JSObject *v;
- Completion c;
- PropertyNameArray propertyNames;
+ JSValue* value = 0;
if (varDecl) {
varDecl->evaluate(exec);
KJS_CHECKEXCEPTION
}
- e = expr->evaluate(exec);
+ JSValue* e = expr->evaluate(exec);
- // 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.
+ // For Null and Undefined, we want to make sure not to go through
+ // the loop at all, because toObject will throw an exception.
if (e->isUndefinedOrNull())
- return Completion(Normal);
+ return exec->setNormalCompletion();
KJS_CHECKEXCEPTION
- v = e->toObject(exec);
+ JSObject* v = e->toObject(exec);
+ PropertyNameArray propertyNames;
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();
- c = statement->execute(exec);
+ JSValue* statementValue = statement->execute(exec);
exec->popIteration();
- if (c.isValueCompletion())
- retval = c.value();
+ if (statementValue)
+ value = statementValue;
- if (!((c.complType() == Continue) && ls.contains(c.target()))) {
- if ((c.complType() == Break) && ls.contains(c.target()))
- break;
- if (c.complType() != Normal) {
- return c;
- }
+ if (exec->completionType() != Normal) {
+ if (exec->completionType() == Continue && ls.contains(exec->breakOrContinueTarget()))
+ continue;
+ if (exec->completionType() == Break && ls.contains(exec->breakOrContinueTarget()))
+ break;
+ return statementValue;
}
}
- return Completion(Normal, retval);
+ return exec->setNormalCompletion(value);
}
// ------------------------------ ContinueNode ---------------------------------
// ECMA 12.7
-Completion ContinueNode::execute(ExecState *exec)
+JSValue* ContinueNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
if (ident.isEmpty() && !exec->inIteration())
- return createErrorCompletion(exec, SyntaxError, "Invalid continue statement.");
+ return setErrorCompletion(exec, SyntaxError, "Invalid continue statement.");
if (!ident.isEmpty() && !exec->seenLabels()->contains(ident))
- return createErrorCompletion(exec, SyntaxError, "Label %s not found.", ident);
- return Completion(Continue, &ident);
+ return setErrorCompletion(exec, SyntaxError, "Label %s not found.", ident);
+ return exec->setContinueCompletion(&ident);
}
// ------------------------------ BreakNode ------------------------------------
// ECMA 12.8
-Completion BreakNode::execute(ExecState *exec)
+JSValue* BreakNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
- if (ident.isEmpty() && !exec->inIteration() &&
- !exec->inSwitch())
- return createErrorCompletion(exec, SyntaxError, "Invalid break statement.");
+ if (ident.isEmpty() && !exec->inIteration() && !exec->inSwitch())
+ return setErrorCompletion(exec, SyntaxError, "Invalid break statement.");
if (!ident.isEmpty() && !exec->seenLabels()->contains(ident))
- return createErrorCompletion(exec, SyntaxError, "Label %s not found.");
- return Completion(Break, &ident);
+ return setErrorCompletion(exec, SyntaxError, "Label %s not found.");
+ return exec->setBreakCompletion(&ident);
}
// ------------------------------ ReturnNode -----------------------------------
}
// ECMA 12.9
-Completion ReturnNode::execute(ExecState *exec)
+JSValue* ReturnNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
CodeType codeType = exec->codeType();
if (codeType != FunctionCode)
- return createErrorCompletion(exec, SyntaxError, "Invalid return statement.");
+ return setErrorCompletion(exec, SyntaxError, "Invalid return statement.");
if (!value)
- return Completion(ReturnValue, jsUndefined());
+ return exec->setReturnValueCompletion(jsUndefined());
- JSValue *v = value->evaluate(exec);
+ JSValue* v = value->evaluate(exec);
KJS_CHECKEXCEPTION
- return Completion(ReturnValue, v);
+ return exec->setReturnValueCompletion(v);
}
// ------------------------------ WithNode -------------------------------------
}
// ECMA 12.10
-Completion WithNode::execute(ExecState *exec)
+JSValue* 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);
- Completion res = statement->execute(exec);
+ JSValue* value = statement->execute(exec);
exec->popScope();
- return res;
+ return value;
}
// ------------------------------ CaseClauseNode -------------------------------
}
// ECMA 12.11
-Completion CaseClauseNode::evalStatements(ExecState *exec)
+JSValue* CaseClauseNode::executeStatements(ExecState* exec)
{
if (m_children)
return statementListExecute(*m_children, exec);
- else
- return Completion(Normal, jsUndefined());
+ return exec->setNormalCompletion();
}
// ------------------------------ ClauseListNode -------------------------------
}
// ECMA 12.11
-Completion CaseBlockNode::evalBlock(ExecState *exec, JSValue *input)
+JSValue* CaseBlockNode::executeBlock(ExecState* exec, JSValue* input)
{
- JSValue *v;
- Completion res;
- ClauseListNode *a = list1.get();
- ClauseListNode *b = list2.get();
- CaseClauseNode *clause;
-
+ ClauseListNode* a = list1.get();
while (a) {
- clause = a->getClause();
+ CaseClauseNode* clause = a->getClause();
a = a->getNext();
- v = clause->evaluate(exec);
+ JSValue* v = clause->evaluate(exec);
KJS_CHECKEXCEPTION
if (strictEqual(exec, input, v)) {
- res = clause->evalStatements(exec);
- if (res.complType() != Normal)
+ JSValue* res = clause->executeStatements(exec);
+ if (exec->completionType() != Normal)
return res;
- while (a) {
- res = a->getClause()->evalStatements(exec);
- if (res.complType() != Normal)
+ for (; a; a = a->getNext()) {
+ JSValue* res = a->getClause()->executeStatements(exec);
+ if (exec->completionType() != Normal)
return res;
- a = a->getNext();
}
break;
}
}
+ ClauseListNode* b = list2.get();
while (b) {
- clause = b->getClause();
+ CaseClauseNode* clause = b->getClause();
b = b->getNext();
- v = clause->evaluate(exec);
+ JSValue* v = clause->evaluate(exec);
KJS_CHECKEXCEPTION
if (strictEqual(exec, input, v)) {
- res = clause->evalStatements(exec);
- if (res.complType() != Normal)
+ JSValue* res = clause->executeStatements(exec);
+ if (exec->completionType() != Normal)
return res;
goto step18;
}
// default clause
if (def) {
- res = def->evalStatements(exec);
- if (res.complType() != Normal)
+ JSValue* res = def->executeStatements(exec);
+ if (exec->completionType() != Normal)
return res;
}
b = list2.get();
step18:
while (b) {
- clause = b->getClause();
- res = clause->evalStatements(exec);
- if (res.complType() != Normal)
+ CaseClauseNode* clause = b->getClause();
+ JSValue* res = clause->executeStatements(exec);
+ if (exec->completionType() != Normal)
return res;
b = b->getNext();
}
// bail out on error
KJS_CHECKEXCEPTION
- return Completion(Normal);
+ return exec->setNormalCompletion();
}
// ------------------------------ SwitchNode -----------------------------------
}
// ECMA 12.11
-Completion SwitchNode::execute(ExecState *exec)
+JSValue* SwitchNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
JSValue *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
exec->pushSwitch();
- Completion res = block->evalBlock(exec,v);
+ JSValue* result = block->executeBlock(exec, v);
exec->popSwitch();
- if ((res.complType() == Break) && ls.contains(res.target()))
- return Completion(Normal, res.value());
- return res;
+ if (exec->completionType() == Break && ls.contains(exec->breakOrContinueTarget()))
+ exec->setCompletionType(Normal);
+ return result;
}
// ------------------------------ LabelNode ------------------------------------
}
// ECMA 12.12
-Completion LabelNode::execute(ExecState *exec)
+JSValue* LabelNode::execute(ExecState *exec)
{
if (!exec->seenLabels()->push(label))
- return createErrorCompletion(exec, SyntaxError, "Duplicated label %s found.", label);
- Completion e = statement->execute(exec);
+ return setErrorCompletion(exec, SyntaxError, "Duplicated label %s found.", label);
+ JSValue* result = statement->execute(exec);
exec->seenLabels()->pop();
- if ((e.complType() == Break) && (e.target() == label))
- return Completion(Normal, e.value());
- return e;
+ if (exec->completionType() == Break && exec->breakOrContinueTarget() == label)
+ exec->setCompletionType(Normal);
+ return result;
}
// ------------------------------ ThrowNode ------------------------------------
}
// ECMA 12.13
-Completion ThrowNode::execute(ExecState *exec)
+JSValue* ThrowNode::execute(ExecState* exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
JSValue *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
handleException(exec, v);
- return Completion(Throw, v);
+ return exec->setThrowCompletion(v);
}
// ------------------------------ TryNode --------------------------------------
}
// ECMA 12.14
-Completion TryNode::execute(ExecState *exec)
+JSValue* TryNode::execute(ExecState *exec)
{
- KJS_BREAKPOINT;
+ KJS_BREAKPOINT
- Completion c = tryBlock->execute(exec);
+ JSValue* result = tryBlock->execute(exec);
if (Collector::isOutOfMemory())
- return c; // don't try to catch an out of memory exception thrown by the collector
+ return result; // don't try to catch an out of memory exception thrown by the collector
- if (catchBlock && c.complType() == Throw) {
- JSObject *obj = new JSObject;
- obj->put(exec, exceptionIdent, c.value(), DontDelete);
+ if (catchBlock && exec->completionType() == Throw) {
+ JSObject* obj = new JSObject;
+ obj->put(exec, exceptionIdent, result, DontDelete);
exec->pushScope(obj);
- c = catchBlock->execute(exec);
+ result = catchBlock->execute(exec);
exec->popScope();
}
if (finallyBlock) {
- Completion c2 = finallyBlock->execute(exec);
- if (c2.complType() != Normal)
- c = c2;
+ ComplType savedCompletionType = exec->completionType();
+ JSValue* finallyResult = finallyBlock->execute(exec);
+ if (exec->completionType() != Normal)
+ result = finallyResult;
+ else
+ exec->setCompletionType(savedCompletionType);
}
- return c;
+ return result;
}
// ------------------------------ FunctionBodyNode -----------------------------
return s;
}
-Completion ProgramNode::execute(ExecState* exec)
+JSValue* ProgramNode::execute(ExecState* exec)
{
processDeclarations(exec);
return ScopeNode::execute(exec);
}
-Completion EvalNode::execute(ExecState* exec)
+JSValue* EvalNode::execute(ExecState* exec)
{
processDeclarations(exec);
return ScopeNode::execute(exec);
}
-Completion FunctionBodyNode::execute(ExecState* exec)
+JSValue* 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 Completion(Interrupted, jsUndefined());
+ return exec->setInterruptedCompletion();
}
}
- Completion completion = ScopeNode::execute(exec);
+ JSValue* result = ScopeNode::execute(exec);
if (Debugger* dbg = exec->dynamicGlobalObject()->debugger()) {
- if (completion.complType() == Throw)
- exec->setException(completion.value());
-
+ if (exec->completionType() == Throw)
+ exec->setException(result);
if (!dbg->returnEvent(exec, sourceId(), lineNo(), exec->function())) {
dbg->imp()->abort();
- return Completion(Interrupted, jsUndefined());
+ return exec->setInterruptedCompletion();
}
}
- return completion;
+ return result;
}
// ------------------------------ FuncDeclNode ---------------------------------
return func;
}
-Completion FuncDeclNode::execute(ExecState *)
+JSValue* FuncDeclNode::execute(ExecState* exec)
{
- return Completion(Normal);
+ return exec->setNormalCompletion();
}
// ------------------------------ 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;
- Completion rethrowException(ExecState*) KJS_FAST_CALL;
+ // for use in execute()
+ JSValue* 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; }
- bool hitStatement(ExecState*) KJS_FAST_CALL;
- virtual Completion execute(ExecState *exec) KJS_FAST_CALL = 0;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL { ASSERT_NOT_REACHED(); return Completion(); }
+ virtual JSValue* execute(ExecState*) KJS_FAST_CALL { ASSERT_NOT_REACHED(); return 0; }
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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* 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;
- Completion evalStatements(ExecState*) KJS_FAST_CALL;
+ JSValue* executeStatements(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;
- Completion evalBlock(ExecState *exec, JSValue *input) KJS_FAST_CALL;
+ JSValue* executeBlock(ExecState*, 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 Completion execute(ExecState*) KJS_FAST_CALL;
+ virtual JSValue* execute(ExecState*) KJS_FAST_CALL;
virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
private:
RefPtr<ExpressionNode> expr;