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

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

Issue 744853003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix clang and win build Created 6 years 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/flow_graph.h ('k') | runtime/vm/flow_graph_optimizer.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/cha.h" 10 #include "vm/cha.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/debugger.h" 12 #include "vm/debugger.h"
13 #include "vm/deopt_instructions.h" 13 #include "vm/deopt_instructions.h"
14 #include "vm/exceptions.h" 14 #include "vm/exceptions.h"
15 #include "vm/flow_graph_allocator.h" 15 #include "vm/flow_graph_allocator.h"
16 #include "vm/il_printer.h" 16 #include "vm/il_printer.h"
17 #include "vm/intrinsifier.h" 17 #include "vm/intrinsifier.h"
18 #include "vm/locations.h" 18 #include "vm/locations.h"
19 #include "vm/longjump.h" 19 #include "vm/longjump.h"
20 #include "vm/object_store.h" 20 #include "vm/object_store.h"
21 #include "vm/parser.h" 21 #include "vm/parser.h"
22 #include "vm/raw_object.h"
22 #include "vm/stack_frame.h" 23 #include "vm/stack_frame.h"
23 #include "vm/stub_code.h" 24 #include "vm/stub_code.h"
24 #include "vm/symbols.h" 25 #include "vm/symbols.h"
25 26
26 namespace dart { 27 namespace dart {
27 28
28 DECLARE_FLAG(bool, code_comments); 29 DECLARE_FLAG(bool, code_comments);
29 DECLARE_FLAG(bool, disassemble); 30 DECLARE_FLAG(bool, disassemble);
30 DECLARE_FLAG(bool, disassemble_optimized); 31 DECLARE_FLAG(bool, disassemble_optimized);
31 DECLARE_FLAG(bool, emit_edge_counters); 32 DECLARE_FLAG(bool, emit_edge_counters);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return true; 222 return true;
222 } 223 }
223 return false; 224 return false;
224 } 225 }
225 226
226 227
227 static bool IsEmptyBlock(BlockEntryInstr* block) { 228 static bool IsEmptyBlock(BlockEntryInstr* block) {
228 return !block->IsCatchBlockEntry() && 229 return !block->IsCatchBlockEntry() &&
229 !block->HasNonRedundantParallelMove() && 230 !block->HasNonRedundantParallelMove() &&
230 block->next()->IsGoto() && 231 block->next()->IsGoto() &&
231 !block->next()->AsGoto()->HasNonRedundantParallelMove(); 232 !block->next()->AsGoto()->HasNonRedundantParallelMove() &&
233 !block->IsIndirectEntry();
232 } 234 }
233 235
234 236
235 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) { 237 void FlowGraphCompiler::CompactBlock(BlockEntryInstr* block) {
236 BlockInfo* block_info = block_info_[block->postorder_number()]; 238 BlockInfo* block_info = block_info_[block->postorder_number()];
237 239
238 // Break out of cycles in the control flow graph. 240 // Break out of cycles in the control flow graph.
239 if (block_info->is_marked()) { 241 if (block_info->is_marked()) {
240 return; 242 return;
241 } 243 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 BlockEntryInstr* entry = block_order()[i]; 350 BlockEntryInstr* entry = block_order()[i];
349 assembler()->Comment("B%" Pd "", entry->block_id()); 351 assembler()->Comment("B%" Pd "", entry->block_id());
350 set_current_block(entry); 352 set_current_block(entry);
351 353
352 if (WasCompacted(entry)) { 354 if (WasCompacted(entry)) {
353 continue; 355 continue;
354 } 356 }
355 357
356 LoopInfoComment(assembler(), *entry, *loop_headers); 358 LoopInfoComment(assembler(), *entry, *loop_headers);
357 359
360 entry->set_offset(assembler()->CodeSize());
358 entry->EmitNativeCode(this); 361 entry->EmitNativeCode(this);
359 // Compile all successors until an exit, branch, or a block entry. 362 // Compile all successors until an exit, branch, or a block entry.
360 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { 363 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
361 Instruction* instr = it.Current(); 364 Instruction* instr = it.Current();
362 if (FLAG_code_comments || 365 if (FLAG_code_comments ||
363 FLAG_disassemble || 366 FLAG_disassemble ||
364 FLAG_disassemble_optimized) { 367 FLAG_disassemble_optimized) {
365 if (FLAG_source_lines) { 368 if (FLAG_source_lines) {
366 EmitSourceLine(instr); 369 EmitSourceLine(instr);
367 } 370 }
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } else { 823 } else {
821 // Finalize the stack map array and add it to the code object. 824 // Finalize the stack map array and add it to the code object.
822 ASSERT(is_optimizing()); 825 ASSERT(is_optimizing());
823 code.set_stackmaps( 826 code.set_stackmaps(
824 Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code))); 827 Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code)));
825 } 828 }
826 } 829 }
827 830
828 831
829 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) { 832 void FlowGraphCompiler::FinalizeVarDescriptors(const Code& code) {
830 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( 833 LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle();
831 parsed_function_.node_sequence()->scope()->GetVarDescriptors( 834 if (parsed_function().node_sequence() == NULL) {
832 parsed_function_.function())); 835 ASSERT(flow_graph().IsIrregexpFunction());
836 var_descs = LocalVarDescriptors::New(1);
837 RawLocalVarDescriptors::VarInfo info;
838 info.set_kind(RawLocalVarDescriptors::kSavedCurrentContext);
839 info.scope_id = 0;
840 info.begin_pos = 0;
841 info.end_pos = 0;
842 info.set_index(parsed_function().current_context_var()->index());
843 var_descs.SetVar(0, Symbols::CurrentContextVar(), &info);
844 } else {
845 var_descs =
846 parsed_function_.node_sequence()->scope()->GetVarDescriptors(
847 parsed_function_.function());
848 }
833 code.set_var_descriptors(var_descs); 849 code.set_var_descriptors(var_descs);
834 } 850 }
835 851
836 852
837 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { 853 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) {
838 ASSERT(code.static_calls_target_table() == Array::null()); 854 ASSERT(code.static_calls_target_table() == Array::null());
839 code.set_static_calls_target_table( 855 code.set_static_calls_target_table(
840 Array::Handle(Array::MakeArray(static_calls_target_table_))); 856 Array::Handle(Array::MakeArray(static_calls_target_table_)));
841 } 857 }
842 858
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 case kUnboxedMint: 1526 case kUnboxedMint:
1511 return mint_class(); 1527 return mint_class();
1512 default: 1528 default:
1513 UNREACHABLE(); 1529 UNREACHABLE();
1514 return Class::ZoneHandle(); 1530 return Class::ZoneHandle();
1515 } 1531 }
1516 } 1532 }
1517 1533
1518 1534
1519 } // namespace dart 1535 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698