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

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

Issue 14308009: Detect leaf optimized methods and skip stack check overflow test in those, unless it is in a loop (… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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.h » ('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 "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/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 3365 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 // Print the function ast before IL generation. 3376 // Print the function ast before IL generation.
3377 AstPrinter::PrintFunctionNodes(parsed_function()); 3377 AstPrinter::PrintFunctionNodes(parsed_function());
3378 } 3378 }
3379 // Compilation can be nested, preserve the computation-id. 3379 // Compilation can be nested, preserve the computation-id.
3380 const Function& function = parsed_function().function(); 3380 const Function& function = parsed_function().function();
3381 TargetEntryInstr* normal_entry = 3381 TargetEntryInstr* normal_entry =
3382 new TargetEntryInstr(AllocateBlockId(), 3382 new TargetEntryInstr(AllocateBlockId(),
3383 CatchClauseNode::kInvalidTryIndex); 3383 CatchClauseNode::kInvalidTryIndex);
3384 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry); 3384 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry);
3385 EffectGraphVisitor for_effect(this, 0); 3385 EffectGraphVisitor for_effect(this, 0);
3386 // TODO(kmillikin): We can eliminate stack checks in some cases (e.g., the 3386 // This check may be deleted if the generated code is leaf.
3387 // stack check on entry for leaf routines). 3387 CheckStackOverflowInstr* check =
3388 Instruction* check = new CheckStackOverflowInstr(function.token_pos()); 3388 new CheckStackOverflowInstr(function.token_pos());
3389 // If we are inlining don't actually attach the stack check. We must still 3389 // If we are inlining don't actually attach the stack check. We must still
3390 // create the stack check in order to allocate a deopt id. 3390 // create the stack check in order to allocate a deopt id.
3391 if (!IsInlining()) for_effect.AddInstruction(check); 3391 if (!IsInlining()) for_effect.AddInstruction(check);
3392 parsed_function().node_sequence()->Visit(&for_effect); 3392 parsed_function().node_sequence()->Visit(&for_effect);
3393 AppendFragment(normal_entry, for_effect); 3393 AppendFragment(normal_entry, for_effect);
3394 // Check that the graph is properly terminated. 3394 // Check that the graph is properly terminated.
3395 ASSERT(!for_effect.is_open()); 3395 ASSERT(!for_effect.is_open());
3396 FlowGraph* graph = new FlowGraph(*this, graph_entry_, last_used_block_id_); 3396 FlowGraph* graph = new FlowGraph(*this, graph_entry_, last_used_block_id_);
3397 return graph; 3397 return graph;
3398 } 3398 }
3399 3399
3400 3400
3401 void FlowGraphBuilder::Bailout(const char* reason) { 3401 void FlowGraphBuilder::Bailout(const char* reason) {
3402 const char* kFormat = "FlowGraphBuilder Bailout: %s %s"; 3402 const char* kFormat = "FlowGraphBuilder Bailout: %s %s";
3403 const char* function_name = parsed_function_.function().ToCString(); 3403 const char* function_name = parsed_function_.function().ToCString();
3404 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3404 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3405 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3405 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3406 OS::SNPrint(chars, len, kFormat, function_name, reason); 3406 OS::SNPrint(chars, len, kFormat, function_name, reason);
3407 const Error& error = Error::Handle( 3407 const Error& error = Error::Handle(
3408 LanguageError::New(String::Handle(String::New(chars)))); 3408 LanguageError::New(String::Handle(String::New(chars))));
3409 Isolate::Current()->long_jump_base()->Jump(1, error); 3409 Isolate::Current()->long_jump_base()->Jump(1, error);
3410 } 3410 }
3411 3411
3412 3412
3413 } // namespace dart 3413 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698