Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2598 const Function& function = parsed_function().function(); | 2598 const Function& function = parsed_function().function(); |
| 2599 TargetEntryInstr* normal_entry = new TargetEntryInstr( | 2599 TargetEntryInstr* normal_entry = new TargetEntryInstr( |
| 2600 CatchClauseNode::kInvalidTryIndex); | 2600 CatchClauseNode::kInvalidTryIndex); |
| 2601 graph_entry_ = new GraphEntryInstr(normal_entry); | 2601 graph_entry_ = new GraphEntryInstr(normal_entry); |
| 2602 EffectGraphVisitor for_effect(this, 0); | 2602 EffectGraphVisitor for_effect(this, 0); |
| 2603 if (InInliningContext()) { | 2603 if (InInliningContext()) { |
| 2604 exits_ = new ZoneGrowableArray<ReturnInstr*>(); | 2604 exits_ = new ZoneGrowableArray<ReturnInstr*>(); |
| 2605 } | 2605 } |
| 2606 // TODO(kmillikin): We can eliminate stack checks in some cases (e.g., the | 2606 // TODO(kmillikin): We can eliminate stack checks in some cases (e.g., the |
| 2607 // stack check on entry for leaf routines). | 2607 // stack check on entry for leaf routines). |
| 2608 for_effect.Do(new CheckStackOverflowInstr(function.token_pos())); | 2608 Definition* check = new CheckStackOverflowInstr(function.token_pos()); |
|
Kevin Millikin (Google)
2012/09/19 12:01:17
Please add a comment that we allocate the instruct
| |
| 2609 if (!InInliningContext()) for_effect.Do(check); | |
| 2609 parsed_function().node_sequence()->Visit(&for_effect); | 2610 parsed_function().node_sequence()->Visit(&for_effect); |
| 2610 AppendFragment(normal_entry, for_effect); | 2611 AppendFragment(normal_entry, for_effect); |
| 2611 // Check that the graph is properly terminated. | 2612 // Check that the graph is properly terminated. |
| 2612 ASSERT(!for_effect.is_open()); | 2613 ASSERT(!for_effect.is_open()); |
| 2613 FlowGraph* graph = new FlowGraph(*this, graph_entry_); | 2614 FlowGraph* graph = new FlowGraph(*this, graph_entry_); |
| 2614 if (InInliningContext()) graph->set_exits(exits_); | 2615 if (InInliningContext()) graph->set_exits(exits_); |
| 2615 return graph; | 2616 return graph; |
| 2616 } | 2617 } |
| 2617 | 2618 |
| 2618 | 2619 |
| 2619 void FlowGraphBuilder::Bailout(const char* reason) { | 2620 void FlowGraphBuilder::Bailout(const char* reason) { |
| 2620 const char* kFormat = "FlowGraphBuilder Bailout: %s %s"; | 2621 const char* kFormat = "FlowGraphBuilder Bailout: %s %s"; |
| 2621 const char* function_name = parsed_function_.function().ToCString(); | 2622 const char* function_name = parsed_function_.function().ToCString(); |
| 2622 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 2623 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 2623 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 2624 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 2624 OS::SNPrint(chars, len, kFormat, function_name, reason); | 2625 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 2625 const Error& error = Error::Handle( | 2626 const Error& error = Error::Handle( |
| 2626 LanguageError::New(String::Handle(String::New(chars)))); | 2627 LanguageError::New(String::Handle(String::New(chars)))); |
| 2627 Isolate::Current()->long_jump_base()->Jump(1, error); | 2628 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2628 } | 2629 } |
| 2629 | 2630 |
| 2630 | 2631 |
| 2631 } // namespace dart | 2632 } // namespace dart |
| OLD | NEW |