| OLD | NEW |
| 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 29 matching lines...) Expand all Loading... |
| 40 VariableProxySentinel VariableProxySentinel::this_proxy_(true); | 40 VariableProxySentinel VariableProxySentinel::this_proxy_(true); |
| 41 VariableProxySentinel VariableProxySentinel::identifier_proxy_(false); | 41 VariableProxySentinel VariableProxySentinel::identifier_proxy_(false); |
| 42 ValidLeftHandSideSentinel ValidLeftHandSideSentinel::instance_; | 42 ValidLeftHandSideSentinel ValidLeftHandSideSentinel::instance_; |
| 43 Property Property::this_property_(VariableProxySentinel::this_proxy(), NULL, 0); | 43 Property Property::this_property_(VariableProxySentinel::this_proxy(), NULL, 0); |
| 44 Call Call::sentinel_(NULL, NULL, 0); | 44 Call Call::sentinel_(NULL, NULL, 0); |
| 45 | 45 |
| 46 | 46 |
| 47 // ---------------------------------------------------------------------------- | 47 // ---------------------------------------------------------------------------- |
| 48 // All the Accept member functions for each syntax tree node type. | 48 // All the Accept member functions for each syntax tree node type. |
| 49 | 49 |
| 50 #define DECL_ACCEPT(type) \ | 50 #define DECL_ACCEPT(type) \ |
| 51 void type::Accept(AstVisitor* v) { \ | 51 void type::Accept(AstVisitor* v) { v->Visit##type(this); } |
| 52 if (v->CheckStackOverflow()) return; \ | |
| 53 v->Visit##type(this); \ | |
| 54 } | |
| 55 AST_NODE_LIST(DECL_ACCEPT) | 52 AST_NODE_LIST(DECL_ACCEPT) |
| 56 #undef DECL_ACCEPT | 53 #undef DECL_ACCEPT |
| 57 | 54 |
| 58 | 55 |
| 59 // ---------------------------------------------------------------------------- | 56 // ---------------------------------------------------------------------------- |
| 60 // Implementation of other node functionality. | 57 // Implementation of other node functionality. |
| 61 | 58 |
| 62 Assignment* ExpressionStatement::StatementAsSimpleAssignment() { | 59 Assignment* ExpressionStatement::StatementAsSimpleAssignment() { |
| 63 return (expression()->AsAssignment() != NULL && | 60 return (expression()->AsAssignment() != NULL && |
| 64 !expression()->AsAssignment()->is_compound()) | 61 !expression()->AsAssignment()->is_compound()) |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 default: | 231 default: |
| 235 UNREACHABLE(); | 232 UNREACHABLE(); |
| 236 break; | 233 break; |
| 237 } | 234 } |
| 238 return false; | 235 return false; |
| 239 } | 236 } |
| 240 | 237 |
| 241 // ---------------------------------------------------------------------------- | 238 // ---------------------------------------------------------------------------- |
| 242 // Implementation of AstVisitor | 239 // Implementation of AstVisitor |
| 243 | 240 |
| 241 bool AstVisitor::CheckStackOverflow() { |
| 242 if (stack_overflow_) return true; |
| 243 StackLimitCheck check; |
| 244 if (!check.HasOverflowed()) return false; |
| 245 return (stack_overflow_ = true); |
| 246 } |
| 247 |
| 244 | 248 |
| 245 void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) { | 249 void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) { |
| 246 for (int i = 0; i < declarations->length(); i++) { | 250 for (int i = 0; i < declarations->length(); i++) { |
| 247 Visit(declarations->at(i)); | 251 Visit(declarations->at(i)); |
| 248 } | 252 } |
| 249 } | 253 } |
| 250 | 254 |
| 251 | 255 |
| 252 void AstVisitor::VisitStatements(ZoneList<Statement*>* statements) { | 256 void AstVisitor::VisitStatements(ZoneList<Statement*>* statements) { |
| 253 for (int i = 0; i < statements->length(); i++) { | 257 for (int i = 0; i < statements->length(); i++) { |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 SetStackOverflow(); | 1130 SetStackOverflow(); |
| 1127 } | 1131 } |
| 1128 | 1132 |
| 1129 | 1133 |
| 1130 void CopyAstVisitor::VisitDeclaration(Declaration* decl) { | 1134 void CopyAstVisitor::VisitDeclaration(Declaration* decl) { |
| 1131 UNREACHABLE(); | 1135 UNREACHABLE(); |
| 1132 } | 1136 } |
| 1133 | 1137 |
| 1134 | 1138 |
| 1135 } } // namespace v8::internal | 1139 } } // namespace v8::internal |
| OLD | NEW |