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

Side by Side Diff: src/ast.h

Issue 6688066: Clean up Isolate usages in ast visitor and hydrogen. (Closed)
Patch Set: Created 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 static RegExpEmpty kInstance; 2173 static RegExpEmpty kInstance;
2174 }; 2174 };
2175 2175
2176 2176
2177 // ---------------------------------------------------------------------------- 2177 // ----------------------------------------------------------------------------
2178 // Basic visitor 2178 // Basic visitor
2179 // - leaf node visitors are abstract. 2179 // - leaf node visitors are abstract.
2180 2180
2181 class AstVisitor BASE_EMBEDDED { 2181 class AstVisitor BASE_EMBEDDED {
2182 public: 2182 public:
2183 AstVisitor() : stack_overflow_(false) { } 2183 AstVisitor() : isolate_(Isolate::Current()), stack_overflow_(false) { }
2184 virtual ~AstVisitor() { } 2184 virtual ~AstVisitor() { }
2185 2185
2186 // Stack overflow check and dynamic dispatch. 2186 // Stack overflow check and dynamic dispatch.
2187 void Visit(AstNode* node) { if (!CheckStackOverflow()) node->Accept(this); } 2187 void Visit(AstNode* node) { if (!CheckStackOverflow()) node->Accept(this); }
2188 2188
2189 // Iteration left-to-right. 2189 // Iteration left-to-right.
2190 virtual void VisitDeclarations(ZoneList<Declaration*>* declarations); 2190 virtual void VisitDeclarations(ZoneList<Declaration*>* declarations);
2191 virtual void VisitStatements(ZoneList<Statement*>* statements); 2191 virtual void VisitStatements(ZoneList<Statement*>* statements);
2192 virtual void VisitExpressions(ZoneList<Expression*>* expressions); 2192 virtual void VisitExpressions(ZoneList<Expression*>* expressions);
2193 2193
2194 // Stack overflow tracking support. 2194 // Stack overflow tracking support.
2195 bool HasStackOverflow() const { return stack_overflow_; } 2195 bool HasStackOverflow() const { return stack_overflow_; }
2196 bool CheckStackOverflow(); 2196 bool CheckStackOverflow();
2197 2197
2198 // If a stack-overflow exception is encountered when visiting a 2198 // If a stack-overflow exception is encountered when visiting a
2199 // node, calling SetStackOverflow will make sure that the visitor 2199 // node, calling SetStackOverflow will make sure that the visitor
2200 // bails out without visiting more nodes. 2200 // bails out without visiting more nodes.
2201 void SetStackOverflow() { stack_overflow_ = true; } 2201 void SetStackOverflow() { stack_overflow_ = true; }
2202 void ClearStackOverflow() { stack_overflow_ = false; } 2202 void ClearStackOverflow() { stack_overflow_ = false; }
2203 2203
2204 // Nodes not appearing in the AST, including slots. 2204 // Nodes not appearing in the AST, including slots.
2205 virtual void VisitSlot(Slot* node) { UNREACHABLE(); } 2205 virtual void VisitSlot(Slot* node) { UNREACHABLE(); }
2206 2206
2207 // Individual AST nodes. 2207 // Individual AST nodes.
2208 #define DEF_VISIT(type) \ 2208 #define DEF_VISIT(type) \
2209 virtual void Visit##type(type* node) = 0; 2209 virtual void Visit##type(type* node) = 0;
2210 AST_NODE_LIST(DEF_VISIT) 2210 AST_NODE_LIST(DEF_VISIT)
2211 #undef DEF_VISIT 2211 #undef DEF_VISIT
2212 2212
2213 protected:
2214 Isolate* isolate() { return isolate_; }
2215
2213 private: 2216 private:
2217 Isolate* isolate_;
2214 bool stack_overflow_; 2218 bool stack_overflow_;
2215 }; 2219 };
2216 2220
2217 2221
2218 } } // namespace v8::internal 2222 } } // namespace v8::internal
2219 2223
2220 #endif // V8_AST_H_ 2224 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698