Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: src/ast.h

Issue 11498006: Revert 13157, 13145 and 13140: Crankshaft code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index a0a7a7320649fdff523c509f9f49e7760b4b3618..d299f19a23511a818b01c5e703e6626fc1df42ac 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -2492,51 +2492,40 @@ inline ModuleVariable::ModuleVariable(VariableProxy* proxy)
class AstVisitor BASE_EMBEDDED {
public:
- AstVisitor() {}
+ AstVisitor() : isolate_(Isolate::Current()), stack_overflow_(false) { }
virtual ~AstVisitor() { }
// Stack overflow check and dynamic dispatch.
- virtual void Visit(AstNode* node) = 0;
+ void Visit(AstNode* node) { if (!CheckStackOverflow()) node->Accept(this); }
// Iteration left-to-right.
virtual void VisitDeclarations(ZoneList<Declaration*>* declarations);
virtual void VisitStatements(ZoneList<Statement*>* statements);
virtual void VisitExpressions(ZoneList<Expression*>* expressions);
+ // Stack overflow tracking support.
+ bool HasStackOverflow() const { return stack_overflow_; }
+ bool CheckStackOverflow();
+
+ // If a stack-overflow exception is encountered when visiting a
+ // node, calling SetStackOverflow will make sure that the visitor
+ // bails out without visiting more nodes.
+ void SetStackOverflow() { stack_overflow_ = true; }
+ void ClearStackOverflow() { stack_overflow_ = false; }
+
// Individual AST nodes.
#define DEF_VISIT(type) \
virtual void Visit##type(type* node) = 0;
AST_NODE_LIST(DEF_VISIT)
#undef DEF_VISIT
-};
+ protected:
+ Isolate* isolate() { return isolate_; }
-#define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \
-public: \
- virtual void Visit(AstNode* node) { \
- if (!CheckStackOverflow()) node->Accept(this); \
- } \
- \
- void SetStackOverflow() { stack_overflow_ = true; } \
- void ClearStackOverflow() { stack_overflow_ = false; } \
- bool HasStackOverflow() const { return stack_overflow_; } \
- \
- bool CheckStackOverflow() { \
- if (stack_overflow_) return true; \
- StackLimitCheck check(isolate_); \
- if (!check.HasOverflowed()) return false; \
- return (stack_overflow_ = true); \
- } \
- \
-private: \
- void InitializeAstVisitor() { \
- isolate_ = Isolate::Current(); \
- stack_overflow_ = false; \
- } \
- Isolate* isolate() { return isolate_; } \
- \
- Isolate* isolate_; \
- bool stack_overflow_
+ private:
+ Isolate* isolate_;
+ bool stack_overflow_;
+};
// ----------------------------------------------------------------------------
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698