Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: runtime/vm/flow_graph_builder.cc

Issue 51123003: VM: Fix checked mode crash (issue 13831). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/code_descriptors.h" 10 #include "vm/code_descriptors.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/flags.h" 12 #include "vm/flags.h"
13 #include "vm/flow_graph_compiler.h" 13 #include "vm/flow_graph_compiler.h"
14 #include "vm/il_printer.h" 14 #include "vm/il_printer.h"
15 #include "vm/intermediate_language.h" 15 #include "vm/intermediate_language.h"
16 #include "vm/longjump.h" 16 #include "vm/longjump.h"
17 #include "vm/object_store.h" 17 #include "vm/object_store.h"
18 #include "vm/os.h" 18 #include "vm/os.h"
19 #include "vm/parser.h" 19 #include "vm/parser.h"
20 #include "vm/resolver.h" 20 #include "vm/resolver.h"
21 #include "vm/stack_frame.h" 21 #include "vm/stack_frame.h"
22 #include "vm/stub_code.h" 22 #include "vm/stub_code.h"
23 #include "vm/symbols.h" 23 #include "vm/symbols.h"
24 24
25 namespace dart { 25 namespace dart {
26 26
27 DEFINE_FLAG(bool, eliminate_type_checks, true, 27 DEFINE_FLAG(bool, eliminate_type_checks, true,
28 "Eliminate type checks when allowed by static type analysis."); 28 "Eliminate type checks when allowed by static type analysis.");
29 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); 29 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree.");
30 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables.");
30 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); 31 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph.");
31 DEFINE_FLAG(bool, print_flow_graph_optimized, false, 32 DEFINE_FLAG(bool, print_flow_graph_optimized, false,
32 "Print the IR flow graph when optimizing."); 33 "Print the IR flow graph when optimizing.");
33 DEFINE_FLAG(bool, trace_type_check_elimination, false, 34 DEFINE_FLAG(bool, trace_type_check_elimination, false,
34 "Trace type check elimination at compile time."); 35 "Trace type check elimination at compile time.");
35 DECLARE_FLAG(bool, enable_type_checks); 36 DECLARE_FLAG(bool, enable_type_checks);
36 37
37 38
38 FlowGraphBuilder::FlowGraphBuilder(ParsedFunction* parsed_function, 39 FlowGraphBuilder::FlowGraphBuilder(ParsedFunction* parsed_function,
39 const Array& ic_data_array, 40 const Array& ic_data_array,
(...skipping 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after
3792 AppendFragment(finally_entry, for_finally_block); 3793 AppendFragment(finally_entry, for_finally_block);
3793 exit_ = for_finally_block.exit_; 3794 exit_ = for_finally_block.exit_;
3794 } 3795 }
3795 3796
3796 3797
3797 FlowGraph* FlowGraphBuilder::BuildGraph() { 3798 FlowGraph* FlowGraphBuilder::BuildGraph() {
3798 if (FLAG_print_ast) { 3799 if (FLAG_print_ast) {
3799 // Print the function ast before IL generation. 3800 // Print the function ast before IL generation.
3800 AstPrinter::PrintFunctionNodes(*parsed_function()); 3801 AstPrinter::PrintFunctionNodes(*parsed_function());
3801 } 3802 }
3803 if (FLAG_print_scopes) {
Florian Schneider 2013/10/30 17:37:26 Unrelated change: Moved scope debug printing out o
3804 AstPrinter::PrintFunctionScope(*parsed_function());
3805 }
3802 const Function& function = parsed_function()->function(); 3806 const Function& function = parsed_function()->function();
3803 TargetEntryInstr* normal_entry = 3807 TargetEntryInstr* normal_entry =
3804 new TargetEntryInstr(AllocateBlockId(), 3808 new TargetEntryInstr(AllocateBlockId(),
3805 CatchClauseNode::kInvalidTryIndex); 3809 CatchClauseNode::kInvalidTryIndex);
3806 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry, osr_id_); 3810 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry, osr_id_);
3807 EffectGraphVisitor for_effect(this, 0); 3811 EffectGraphVisitor for_effect(this, 0);
3808 // This check may be deleted if the generated code is leaf. 3812 // This check may be deleted if the generated code is leaf.
3809 // Native functions don't need a stack check at entry. 3813 // Native functions don't need a stack check at entry.
3810 if (!function.is_native()) { 3814 if (!function.is_native()) {
3811 CheckStackOverflowInstr* check = 3815 CheckStackOverflowInstr* check =
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3849 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3853 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3850 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3854 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3851 OS::SNPrint(chars, len, kFormat, function_name, reason); 3855 OS::SNPrint(chars, len, kFormat, function_name, reason);
3852 const Error& error = Error::Handle( 3856 const Error& error = Error::Handle(
3853 LanguageError::New(String::Handle(String::New(chars)))); 3857 LanguageError::New(String::Handle(String::New(chars))));
3854 Isolate::Current()->long_jump_base()->Jump(1, error); 3858 Isolate::Current()->long_jump_base()->Jump(1, error);
3855 } 3859 }
3856 3860
3857 3861
3858 } // namespace dart 3862 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698