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

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

Issue 10855019: Add a function's initial stack check to the IL instruction stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 void FlowGraphBuilder::BuildGraph(bool for_optimized, bool use_ssa) { 2291 void FlowGraphBuilder::BuildGraph(bool for_optimized, bool use_ssa) {
2292 if (FLAG_print_ast) { 2292 if (FLAG_print_ast) {
2293 // Print the function ast before IL generation. 2293 // Print the function ast before IL generation.
2294 AstPrinter::PrintFunctionNodes(parsed_function()); 2294 AstPrinter::PrintFunctionNodes(parsed_function());
2295 } 2295 }
2296 // Compilation can be nested, preserve the computation-id. 2296 // Compilation can be nested, preserve the computation-id.
2297 const Function& function = parsed_function().function(); 2297 const Function& function = parsed_function().function();
2298 TargetEntryInstr* normal_entry = new TargetEntryInstr(); 2298 TargetEntryInstr* normal_entry = new TargetEntryInstr();
2299 graph_entry_ = new GraphEntryInstr(normal_entry); 2299 graph_entry_ = new GraphEntryInstr(normal_entry);
2300 EffectGraphVisitor for_effect(this, 0); 2300 EffectGraphVisitor for_effect(this, 0);
2301 // TODO(kmillikin): We can eliminate stack checks in some cases (e.g., the
2302 // stack check on entry for leaf routines).
srdjan 2012/08/07 19:04:30 Yes. Why not skip it if IsLeaf()?
2303 for_effect.Do(new CheckStackOverflowComp(function.token_pos(),
2304 CatchClauseNode::kInvalidTryIndex));
2301 parsed_function().node_sequence()->Visit(&for_effect); 2305 parsed_function().node_sequence()->Visit(&for_effect);
2302 AppendFragment(normal_entry, for_effect); 2306 AppendFragment(normal_entry, for_effect);
2303 // Check that the graph is properly terminated. 2307 // Check that the graph is properly terminated.
2304 ASSERT(!for_effect.is_open()); 2308 ASSERT(!for_effect.is_open());
2305 GrowableArray<intptr_t> parent; 2309 GrowableArray<intptr_t> parent;
2306 GrowableArray<BitVector*> assigned_vars; 2310 GrowableArray<BitVector*> assigned_vars;
2307 2311
2308 // Perform a depth-first traversal of the graph to build preorder and 2312 // Perform a depth-first traversal of the graph to build preorder and
2309 // postorder block orders. 2313 // postorder block orders.
2310 graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor. 2314 graph_entry_->DiscoverBlocks(NULL, // Entry block predecessor.
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 2717 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
2714 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 2718 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
2715 OS::SNPrint(chars, len, kFormat, function_name, reason); 2719 OS::SNPrint(chars, len, kFormat, function_name, reason);
2716 const Error& error = Error::Handle( 2720 const Error& error = Error::Handle(
2717 LanguageError::New(String::Handle(String::New(chars)))); 2721 LanguageError::New(String::Handle(String::New(chars))));
2718 Isolate::Current()->long_jump_base()->Jump(1, error); 2722 Isolate::Current()->long_jump_base()->Jump(1, error);
2719 } 2723 }
2720 2724
2721 2725
2722 } // namespace dart 2726 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698