OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 BAILOUT("empty function body"); | 61 BAILOUT("empty function body"); |
62 } | 62 } |
63 | 63 |
64 Cfg::Reset(fun); | 64 Cfg::Reset(fun); |
65 StatementBuilder builder; | 65 StatementBuilder builder; |
66 builder.VisitStatements(body); | 66 builder.VisitStatements(body); |
67 Cfg* cfg = builder.cfg(); | 67 Cfg* cfg = builder.cfg(); |
68 if (cfg == NULL) { | 68 if (cfg == NULL) { |
69 BAILOUT("unsupported statement type"); | 69 BAILOUT("unsupported statement type"); |
70 } | 70 } |
71 | 71 if (cfg->has_exit()) { |
72 ASSERT(!cfg->has_exit()); // Return on all paths. | 72 BAILOUT("control path without explicit return"); |
| 73 } |
73 cfg->PrependEntryNode(fun); | 74 cfg->PrependEntryNode(fun); |
74 return cfg; | 75 return cfg; |
75 } | 76 } |
76 | 77 |
77 #undef BAILOUT | 78 #undef BAILOUT |
78 | 79 |
79 | 80 |
80 void Cfg::PrependEntryNode(FunctionLiteral* fun) { | 81 void Cfg::PrependEntryNode(FunctionLiteral* fun) { |
81 ASSERT(!is_empty()); | 82 ASSERT(!is_empty()); |
82 entry_ = new EntryNode(fun, InstructionBlock::cast(entry())); | 83 entry_ = new EntryNode(fun, InstructionBlock::cast(entry())); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 void ExitNode::Print() { | 454 void ExitNode::Print() { |
454 if (!is_marked_) { | 455 if (!is_marked_) { |
455 is_marked_ = true; | 456 is_marked_ = true; |
456 PrintF("L%d:\nExit\n\n", number()); | 457 PrintF("L%d:\nExit\n\n", number()); |
457 } | 458 } |
458 } | 459 } |
459 | 460 |
460 #endif // DEBUG | 461 #endif // DEBUG |
461 | 462 |
462 } } // namespace v8::internal | 463 } } // namespace v8::internal |
OLD | NEW |