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

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

Issue 11780005: Allow optimized code when debugger is active (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/debugger.cc ('k') | runtime/vm/flow_graph_compiler_arm.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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 exception_handlers_list_ = new ExceptionHandlerList(); 177 exception_handlers_list_ = new ExceptionHandlerList();
178 block_info_.Clear(); 178 block_info_.Clear();
179 for (int i = 0; i < block_order_.length(); ++i) { 179 for (int i = 0; i < block_order_.length(); ++i) {
180 block_info_.Add(new BlockInfo()); 180 block_info_.Add(new BlockInfo());
181 } 181 }
182 } 182 }
183 183
184 184
185 bool FlowGraphCompiler::CanOptimize() { 185 bool FlowGraphCompiler::CanOptimize() {
186 return !FLAG_report_usage_count && 186 return !FLAG_report_usage_count &&
187 (FLAG_optimization_counter_threshold >= 0) && 187 (FLAG_optimization_counter_threshold >= 0);
188 !Isolate::Current()->debugger()->IsActive(); 188 }
189
190
191 bool FlowGraphCompiler::CanOptimizeFunction() const {
192 return CanOptimize() && !parsed_function().function().HasBreakpoint();
189 } 193 }
190 194
191 195
192 void FlowGraphCompiler::VisitBlocks() { 196 void FlowGraphCompiler::VisitBlocks() {
193 for (intptr_t i = 0; i < block_order().length(); ++i) { 197 for (intptr_t i = 0; i < block_order().length(); ++i) {
194 // Compile the block entry. 198 // Compile the block entry.
195 BlockEntryInstr* entry = block_order()[i]; 199 BlockEntryInstr* entry = block_order()[i];
196 assembler()->Comment("B%"Pd"", entry->block_id()); 200 assembler()->Comment("B%"Pd"", entry->block_id());
197 set_current_block(entry); 201 set_current_block(entry);
198 entry->PrepareEntry(this); 202 entry->PrepareEntry(this);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { 448 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) {
445 ASSERT(code.static_calls_target_table() == Array::null()); 449 ASSERT(code.static_calls_target_table() == Array::null());
446 code.set_static_calls_target_table( 450 code.set_static_calls_target_table(
447 Array::Handle(Array::MakeArray(static_calls_target_table_))); 451 Array::Handle(Array::MakeArray(static_calls_target_table_)));
448 } 452 }
449 453
450 454
451 // Returns 'true' if code generation for this function is complete, i.e., 455 // Returns 'true' if code generation for this function is complete, i.e.,
452 // no fall-through to regular code is needed. 456 // no fall-through to regular code is needed.
453 bool FlowGraphCompiler::TryIntrinsify() { 457 bool FlowGraphCompiler::TryIntrinsify() {
454 if (!CanOptimize()) return false; 458 if (!CanOptimizeFunction()) return false;
455 // Intrinsification skips arguments checks, therefore disable if in checked 459 // Intrinsification skips arguments checks, therefore disable if in checked
456 // mode. 460 // mode.
457 if (FLAG_intrinsify && !FLAG_enable_type_checks) { 461 if (FLAG_intrinsify && !FLAG_enable_type_checks) {
458 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) { 462 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) {
459 // An implicit getter must have a specific AST structure. 463 // An implicit getter must have a specific AST structure.
460 const SequenceNode& sequence_node = *parsed_function().node_sequence(); 464 const SequenceNode& sequence_node = *parsed_function().node_sequence();
461 ASSERT(sequence_node.length() == 1); 465 ASSERT(sequence_node.length() == 1);
462 ASSERT(sequence_node.NodeAt(0)->IsReturnNode()); 466 ASSERT(sequence_node.NodeAt(0)->IsReturnNode());
463 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode(); 467 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode();
464 ASSERT(return_node.value()->IsLoadInstanceFieldNode()); 468 ASSERT(return_node.value()->IsLoadInstanceFieldNode());
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 const AbstractTypeArguments& type_arguments = 1085 const AbstractTypeArguments& type_arguments =
1082 AbstractTypeArguments::Handle(type.arguments()); 1086 AbstractTypeArguments::Handle(type.arguments());
1083 const bool is_raw_type = type_arguments.IsNull() || 1087 const bool is_raw_type = type_arguments.IsNull() ||
1084 type_arguments.IsRaw(type_arguments.Length()); 1088 type_arguments.IsRaw(type_arguments.Length());
1085 return is_raw_type; 1089 return is_raw_type;
1086 } 1090 }
1087 return true; 1091 return true;
1088 } 1092 }
1089 1093
1090 } // namespace dart 1094 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/flow_graph_compiler_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698