| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/typing.h" | 5 #include "src/crankshaft/typing.h" |
| 6 | 6 |
| 7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/ast/variables.h" | 9 #include "src/ast/variables.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 call; \ | 107 call; \ |
| 108 if (HasStackOverflow()) return; \ | 108 if (HasStackOverflow()) return; \ |
| 109 } while (false) | 109 } while (false) |
| 110 | 110 |
| 111 | 111 |
| 112 void AstTyper::Run() { | 112 void AstTyper::Run() { |
| 113 RECURSE(VisitDeclarations(scope_->declarations())); | 113 RECURSE(VisitDeclarations(scope_->declarations())); |
| 114 RECURSE(VisitStatements(root_->body())); | 114 RECURSE(VisitStatements(root_->body())); |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 void AstTyper::VisitStatements(ZoneChunkList<Statement*>* statements) { |
| 118 void AstTyper::VisitStatements(ZoneList<Statement*>* stmts) { | 118 for (auto statement : *statements) { |
| 119 for (int i = 0; i < stmts->length(); ++i) { | 119 RECURSE(Visit(statement)); |
| 120 Statement* stmt = stmts->at(i); | 120 if (statement->IsJump()) break; |
| 121 RECURSE(Visit(stmt)); | |
| 122 if (stmt->IsJump()) break; | |
| 123 } | 121 } |
| 124 } | 122 } |
| 125 | 123 |
| 126 | 124 |
| 127 void AstTyper::VisitBlock(Block* stmt) { | 125 void AstTyper::VisitBlock(Block* stmt) { |
| 128 RECURSE(VisitStatements(stmt->statements())); | 126 RECURSE(VisitStatements(stmt->statements())); |
| 129 if (stmt->labels() != NULL) { | 127 if (stmt->labels() != NULL) { |
| 130 store_.Forget(); // Control may transfer here via 'break l'. | 128 store_.Forget(); // Control may transfer here via 'break l'. |
| 131 } | 129 } |
| 132 } | 130 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 clause->CompareOperationFeedbackSlot(), &tag_type, | 212 clause->CompareOperationFeedbackSlot(), &tag_type, |
| 215 &label_type, &combined_type); | 213 &label_type, &combined_type); |
| 216 NarrowLowerType(stmt->tag(), tag_type); | 214 NarrowLowerType(stmt->tag(), tag_type); |
| 217 NarrowLowerType(label, label_type); | 215 NarrowLowerType(label, label_type); |
| 218 clause->set_compare_type(combined_type); | 216 clause->set_compare_type(combined_type); |
| 219 | 217 |
| 220 RECURSE(Visit(label)); | 218 RECURSE(Visit(label)); |
| 221 if (!clause_effects.IsEmpty()) complex_effects = true; | 219 if (!clause_effects.IsEmpty()) complex_effects = true; |
| 222 } | 220 } |
| 223 | 221 |
| 224 ZoneList<Statement*>* stmts = clause->statements(); | 222 ZoneChunkList<Statement*>* stmts = clause->statements(); |
| 225 RECURSE(VisitStatements(stmts)); | 223 RECURSE(VisitStatements(stmts)); |
| 226 ExitEffects(); | 224 ExitEffects(); |
| 227 if (stmts->is_empty() || stmts->last()->IsJump()) { | 225 if (stmts->size() == 0 || stmts->back()->IsJump()) { |
| 228 local_effects.Alt(clause_effects); | 226 local_effects.Alt(clause_effects); |
| 229 } else { | 227 } else { |
| 230 complex_effects = true; | 228 complex_effects = true; |
| 231 } | 229 } |
| 232 } | 230 } |
| 233 | 231 |
| 234 if (complex_effects) { | 232 if (complex_effects) { |
| 235 store_.Forget(); // Reached this in unknown state. | 233 store_.Forget(); // Reached this in unknown state. |
| 236 } else { | 234 } else { |
| 237 store_.Seq(local_effects); | 235 store_.Seq(local_effects); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 } | 791 } |
| 794 | 792 |
| 795 | 793 |
| 796 void AstTyper::VisitFunctionDeclaration(FunctionDeclaration* declaration) { | 794 void AstTyper::VisitFunctionDeclaration(FunctionDeclaration* declaration) { |
| 797 RECURSE(Visit(declaration->fun())); | 795 RECURSE(Visit(declaration->fun())); |
| 798 } | 796 } |
| 799 | 797 |
| 800 | 798 |
| 801 } // namespace internal | 799 } // namespace internal |
| 802 } // namespace v8 | 800 } // namespace v8 |
| OLD | NEW |