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

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

Issue 10389023: Fixed compilation time measurement, restructure some code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_compiler_arm.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/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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 values, 1175 values,
1176 element_type); 1176 element_type);
1177 ReturnComputation(create); 1177 ReturnComputation(create);
1178 } 1178 }
1179 1179
1180 1180
1181 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) { 1181 void EffectGraphVisitor::VisitClosureNode(ClosureNode* node) {
1182 const Function& function = node->function(); 1182 const Function& function = node->function();
1183 1183
1184 if (function.IsNonImplicitClosureFunction()) { 1184 if (function.IsNonImplicitClosureFunction()) {
1185 // The context scope may have already been set by the new non-optimizing 1185 // The context scope may have already been set by the non-optimizing
1186 // compiler. If it was not, set it here. 1186 // compiler. If it was not, set it here.
1187 if (function.context_scope() == ContextScope::null()) { 1187 if (function.context_scope() == ContextScope::null()) {
1188 const ContextScope& context_scope = ContextScope::ZoneHandle( 1188 const ContextScope& context_scope = ContextScope::ZoneHandle(
1189 node->scope()->PreserveOuterScope(owner()->context_level())); 1189 node->scope()->PreserveOuterScope(owner()->context_level()));
1190 ASSERT(!function.HasCode()); 1190 ASSERT(!function.HasCode());
1191 ASSERT(function.context_scope() == ContextScope::null()); 1191 ASSERT(function.context_scope() == ContextScope::null());
1192 function.set_context_scope(context_scope); 1192 function.set_context_scope(context_scope);
1193 } 1193 }
1194 } else if (function.IsImplicitInstanceClosureFunction()) { 1194 } else if (function.IsImplicitInstanceClosureFunction()) {
1195 ValueGraphVisitor for_receiver(owner(), temp_index()); 1195 ValueGraphVisitor for_receiver(owner(), temp_index());
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 reverse_index(instr->true_successor()->postorder_number()), 2449 reverse_index(instr->true_successor()->postorder_number()),
2450 reverse_index(instr->false_successor()->postorder_number())); 2450 reverse_index(instr->false_successor()->postorder_number()));
2451 } 2451 }
2452 2452
2453 2453
2454 void FlowGraphBuilder::BuildGraph(bool for_optimized) { 2454 void FlowGraphBuilder::BuildGraph(bool for_optimized) {
2455 if (FLAG_print_ast) { 2455 if (FLAG_print_ast) {
2456 // Print the function ast before IL generation. 2456 // Print the function ast before IL generation.
2457 AstPrinter::PrintFunctionNodes(parsed_function()); 2457 AstPrinter::PrintFunctionNodes(parsed_function());
2458 } 2458 }
2459 TimerScope timer(FLAG_compiler_stats, &CompilerStats::graphbuilder_timer);
2460 // Compilation can be nested, preserve the computation-id. 2459 // Compilation can be nested, preserve the computation-id.
2461 Isolate* isolate = Isolate::Current(); 2460 Isolate* isolate = Isolate::Current();
2462 const intptr_t prev_cid = isolate->computation_id(); 2461 const intptr_t prev_cid = isolate->computation_id();
2463 isolate->set_computation_id(0); 2462 isolate->set_computation_id(0);
2464 const Function& function = parsed_function().function(); 2463 const Function& function = parsed_function().function();
2465 EffectGraphVisitor for_effect(this, 0); 2464 EffectGraphVisitor for_effect(this, 0);
2466 for_effect.AddInstruction(new TargetEntryInstr()); 2465 for_effect.AddInstruction(new TargetEntryInstr());
2467 parsed_function().node_sequence()->Visit(&for_effect); 2466 parsed_function().node_sequence()->Visit(&for_effect);
2468 // Check that the graph is properly terminated. 2467 // Check that the graph is properly terminated.
2469 ASSERT(!for_effect.is_open()); 2468 ASSERT(!for_effect.is_open());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 char* chars = reinterpret_cast<char*>( 2595 char* chars = reinterpret_cast<char*>(
2597 Isolate::Current()->current_zone()->Allocate(len)); 2596 Isolate::Current()->current_zone()->Allocate(len));
2598 OS::SNPrint(chars, len, kFormat, function_name, reason); 2597 OS::SNPrint(chars, len, kFormat, function_name, reason);
2599 const Error& error = Error::Handle( 2598 const Error& error = Error::Handle(
2600 LanguageError::New(String::Handle(String::New(chars)))); 2599 LanguageError::New(String::Handle(String::New(chars))));
2601 Isolate::Current()->long_jump_base()->Jump(1, error); 2600 Isolate::Current()->long_jump_base()->Jump(1, error);
2602 } 2601 }
2603 2602
2604 2603
2605 } // namespace dart 2604 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698