| 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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 3830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3841 CatchClauseNode::kInvalidTryIndex); | 3841 CatchClauseNode::kInvalidTryIndex); |
| 3842 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry, osr_id_); | 3842 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry, osr_id_); |
| 3843 EffectGraphVisitor for_effect(this); | 3843 EffectGraphVisitor for_effect(this); |
| 3844 // This check may be deleted if the generated code is leaf. | 3844 // This check may be deleted if the generated code is leaf. |
| 3845 // Native functions don't need a stack check at entry. | 3845 // Native functions don't need a stack check at entry. |
| 3846 if (!function.is_native()) { | 3846 if (!function.is_native()) { |
| 3847 CheckStackOverflowInstr* check = | 3847 CheckStackOverflowInstr* check = |
| 3848 new CheckStackOverflowInstr(function.token_pos(), 0); | 3848 new CheckStackOverflowInstr(function.token_pos(), 0); |
| 3849 // If we are inlining don't actually attach the stack check. We must still | 3849 // If we are inlining don't actually attach the stack check. We must still |
| 3850 // create the stack check in order to allocate a deopt id. | 3850 // create the stack check in order to allocate a deopt id. |
| 3851 if (!IsInlining()) for_effect.AddInstruction(check); | 3851 if (!IsInlining()) { |
| 3852 for_effect.AddInstruction(check); |
| 3853 } |
| 3852 } | 3854 } |
| 3853 parsed_function()->node_sequence()->Visit(&for_effect); | 3855 parsed_function()->node_sequence()->Visit(&for_effect); |
| 3854 AppendFragment(normal_entry, for_effect); | 3856 AppendFragment(normal_entry, for_effect); |
| 3855 // Check that the graph is properly terminated. | 3857 // Check that the graph is properly terminated. |
| 3856 ASSERT(!for_effect.is_open()); | 3858 ASSERT(!for_effect.is_open()); |
| 3857 | 3859 |
| 3858 // When compiling for OSR, use a depth first search to prune instructions | 3860 // When compiling for OSR, use a depth first search to prune instructions |
| 3859 // unreachable from the OSR entry. Catch entries are not (yet) properly | 3861 // unreachable from the OSR entry. Catch entries are not (yet) properly |
| 3860 // recognized as reachable. | 3862 // recognized as reachable. |
| 3861 if (osr_id_ != Isolate::kNoDeoptId) { | 3863 if (osr_id_ != Isolate::kNoDeoptId) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3885 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3887 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3886 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3888 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3887 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3889 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3888 const Error& error = Error::Handle( | 3890 const Error& error = Error::Handle( |
| 3889 LanguageError::New(String::Handle(String::New(chars)))); | 3891 LanguageError::New(String::Handle(String::New(chars)))); |
| 3890 Isolate::Current()->long_jump_base()->Jump(1, error); | 3892 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3891 } | 3893 } |
| 3892 | 3894 |
| 3893 | 3895 |
| 3894 } // namespace dart | 3896 } // namespace dart |
| OLD | NEW |