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

Unified Diff: src/ast.cc

Issue 1567007: Move the AstVisitor stack check from Accept to Visit. (Closed)
Patch Set: Created 10 years, 9 months 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/ast.h ('k') | src/flow-graph.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index e63ebdc09a6edee005d1e9fb902b44ea14d1dc42..8835fbb25bb01f96713a7d288e9c1bce5fdd308a 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -47,11 +47,8 @@ Call Call::sentinel_(NULL, NULL, 0);
// ----------------------------------------------------------------------------
// All the Accept member functions for each syntax tree node type.
-#define DECL_ACCEPT(type) \
- void type::Accept(AstVisitor* v) { \
- if (v->CheckStackOverflow()) return; \
- v->Visit##type(this); \
- }
+#define DECL_ACCEPT(type) \
+ void type::Accept(AstVisitor* v) { v->Visit##type(this); }
AST_NODE_LIST(DECL_ACCEPT)
#undef DECL_ACCEPT
@@ -241,6 +238,13 @@ bool Expression::GuaranteedSmiResult() {
// ----------------------------------------------------------------------------
// Implementation of AstVisitor
+bool AstVisitor::CheckStackOverflow() {
+ if (stack_overflow_) return true;
+ StackLimitCheck check;
+ if (!check.HasOverflowed()) return false;
+ return (stack_overflow_ = true);
+}
+
void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) {
for (int i = 0; i < declarations->length(); i++) {
« no previous file with comments | « src/ast.h ('k') | src/flow-graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698