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

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

Issue 12304009: Trust declared type of the receiver to compute its initial compile type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
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/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 3201 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 FlowGraph* FlowGraphBuilder::BuildGraph() { 3212 FlowGraph* FlowGraphBuilder::BuildGraph() {
3213 if (FLAG_print_ast) { 3213 if (FLAG_print_ast) {
3214 // Print the function ast before IL generation. 3214 // Print the function ast before IL generation.
3215 AstPrinter::PrintFunctionNodes(parsed_function()); 3215 AstPrinter::PrintFunctionNodes(parsed_function());
3216 } 3216 }
3217 // Compilation can be nested, preserve the computation-id. 3217 // Compilation can be nested, preserve the computation-id.
3218 const Function& function = parsed_function().function(); 3218 const Function& function = parsed_function().function();
3219 TargetEntryInstr* normal_entry = 3219 TargetEntryInstr* normal_entry =
3220 new TargetEntryInstr(AllocateBlockId(), 3220 new TargetEntryInstr(AllocateBlockId(),
3221 CatchClauseNode::kInvalidTryIndex); 3221 CatchClauseNode::kInvalidTryIndex);
3222 graph_entry_ = new GraphEntryInstr(normal_entry); 3222 graph_entry_ = new GraphEntryInstr(parsed_function(), normal_entry);
3223 EffectGraphVisitor for_effect(this, 0); 3223 EffectGraphVisitor for_effect(this, 0);
3224 // TODO(kmillikin): We can eliminate stack checks in some cases (e.g., the 3224 // TODO(kmillikin): We can eliminate stack checks in some cases (e.g., the
3225 // stack check on entry for leaf routines). 3225 // stack check on entry for leaf routines).
3226 Instruction* check = new CheckStackOverflowInstr(function.token_pos()); 3226 Instruction* check = new CheckStackOverflowInstr(function.token_pos());
3227 // If we are inlining don't actually attach the stack check. We must still 3227 // If we are inlining don't actually attach the stack check. We must still
3228 // create the stack check inorder to allocate a deopt id. 3228 // create the stack check inorder to allocate a deopt id.
3229 if (!InInliningContext()) for_effect.AddInstruction(check); 3229 if (!InInliningContext()) for_effect.AddInstruction(check);
3230 parsed_function().node_sequence()->Visit(&for_effect); 3230 parsed_function().node_sequence()->Visit(&for_effect);
3231 AppendFragment(normal_entry, for_effect); 3231 AppendFragment(normal_entry, for_effect);
3232 // Check that the graph is properly terminated. 3232 // Check that the graph is properly terminated.
3233 ASSERT(!for_effect.is_open()); 3233 ASSERT(!for_effect.is_open());
3234 FlowGraph* graph = new FlowGraph(*this, graph_entry_, last_used_block_id_); 3234 FlowGraph* graph = new FlowGraph(*this, graph_entry_, last_used_block_id_);
3235 return graph; 3235 return graph;
3236 } 3236 }
3237 3237
3238 3238
3239 void FlowGraphBuilder::Bailout(const char* reason) { 3239 void FlowGraphBuilder::Bailout(const char* reason) {
3240 const char* kFormat = "FlowGraphBuilder Bailout: %s %s"; 3240 const char* kFormat = "FlowGraphBuilder Bailout: %s %s";
3241 const char* function_name = parsed_function_.function().ToCString(); 3241 const char* function_name = parsed_function_.function().ToCString();
3242 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 3242 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
3243 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 3243 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
3244 OS::SNPrint(chars, len, kFormat, function_name, reason); 3244 OS::SNPrint(chars, len, kFormat, function_name, reason);
3245 const Error& error = Error::Handle( 3245 const Error& error = Error::Handle(
3246 LanguageError::New(String::Handle(String::New(chars)))); 3246 LanguageError::New(String::Handle(String::New(chars))));
3247 Isolate::Current()->long_jump_base()->Jump(1, error); 3247 Isolate::Current()->long_jump_base()->Jump(1, error);
3248 } 3248 }
3249 3249
3250 3250
3251 } // namespace dart 3251 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_type_propagator.cc » ('j') | runtime/vm/flow_graph_type_propagator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698