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

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

Issue 10665038: Remove old code generator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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/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/dart_entry.h"
9 #include "vm/debugger.h" 10 #include "vm/debugger.h"
10 #include "vm/il_printer.h" 11 #include "vm/il_printer.h"
11 #include "vm/intrinsifier.h" 12 #include "vm/intrinsifier.h"
12 #include "vm/locations.h" 13 #include "vm/locations.h"
13 #include "vm/longjump.h" 14 #include "vm/longjump.h"
14 #include "vm/object_store.h" 15 #include "vm/object_store.h"
15 #include "vm/parser.h" 16 #include "vm/parser.h"
16 #include "vm/stub_code.h" 17 #include "vm/stub_code.h"
17 18
18 namespace dart { 19 namespace dart {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 void FlowGraphCompiler::InitCompiler() { 65 void FlowGraphCompiler::InitCompiler() {
65 pc_descriptors_list_ = new DescriptorList(); 66 pc_descriptors_list_ = new DescriptorList();
66 exception_handlers_list_ = new ExceptionHandlerList(); 67 exception_handlers_list_ = new ExceptionHandlerList();
67 block_info_.Clear(); 68 block_info_.Clear();
68 for (int i = 0; i < block_order_.length(); ++i) { 69 for (int i = 0; i < block_order_.length(); ++i) {
69 block_info_.Add(new BlockInfo()); 70 block_info_.Add(new BlockInfo());
70 } 71 }
71 } 72 }
72 73
73 74
75 bool FlowGraphCompiler::CanOptimize() {
76 return !FLAG_report_usage_count &&
77 (FLAG_optimization_counter_threshold >= 0) &&
78 !Isolate::Current()->debugger()->IsActive();
79 }
80
81
74 void FlowGraphCompiler::VisitBlocks() { 82 void FlowGraphCompiler::VisitBlocks() {
75 for (intptr_t i = 0; i < block_order().length(); ++i) { 83 for (intptr_t i = 0; i < block_order().length(); ++i) {
76 ASSERT(frame_register_allocator()->IsSpilled()); 84 ASSERT(frame_register_allocator()->IsSpilled());
77 assembler()->Comment("B%d", i); 85 assembler()->Comment("B%d", i);
78 // Compile the block entry. 86 // Compile the block entry.
79 set_current_block(block_order()[i]); 87 set_current_block(block_order()[i]);
80 current_block()->PrepareEntry(this); 88 current_block()->PrepareEntry(this);
81 Instruction* instr = current_block()->StraightLineSuccessor(); 89 Instruction* instr = current_block()->StraightLineSuccessor();
82 // Compile all successors until an exit, branch, or a block entry. 90 // Compile all successors until an exit, branch, or a block entry.
83 while ((instr != NULL) && !instr->IsBlockEntry()) { 91 while ((instr != NULL) && !instr->IsBlockEntry()) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 parsed_function_.function())); 223 parsed_function_.function()));
216 code.set_var_descriptors(var_descs); 224 code.set_var_descriptors(var_descs);
217 } 225 }
218 226
219 227
220 void FlowGraphCompiler::FinalizeComments(const Code& code) { 228 void FlowGraphCompiler::FinalizeComments(const Code& code) {
221 code.set_comments(assembler()->GetCodeComments()); 229 code.set_comments(assembler()->GetCodeComments());
222 } 230 }
223 231
224 232
225 static bool CanOptimize() {
226 return !FLAG_report_usage_count &&
227 (FLAG_optimization_counter_threshold >= 0) &&
228 !Isolate::Current()->debugger()->IsActive();
229 }
230
231
232 // Returns 'true' if code generation for this function is complete, i.e., 233 // Returns 'true' if code generation for this function is complete, i.e.,
233 // no fall-through to regular code is needed. 234 // no fall-through to regular code is needed.
234 bool FlowGraphCompiler::TryIntrinsify() { 235 bool FlowGraphCompiler::TryIntrinsify() {
235 if (!CanOptimize()) return false;
236 // Intrinsification skips arguments checks, therefore disable if in checked 236 // Intrinsification skips arguments checks, therefore disable if in checked
237 // mode. 237 // mode.
238 if (FLAG_intrinsify && !FLAG_trace_functions && !FLAG_enable_type_checks) { 238 if (FLAG_intrinsify && !FLAG_trace_functions && !FLAG_enable_type_checks) {
239 if ((parsed_function().function().kind() == RawFunction::kImplicitGetter)) { 239 if ((parsed_function().function().kind() == RawFunction::kImplicitGetter)) {
240 // An implicit getter must have a specific AST structure. 240 // An implicit getter must have a specific AST structure.
241 const SequenceNode& sequence_node = *parsed_function().node_sequence(); 241 const SequenceNode& sequence_node = *parsed_function().node_sequence();
242 ASSERT(sequence_node.length() == 1); 242 ASSERT(sequence_node.length() == 1);
243 ASSERT(sequence_node.NodeAt(0)->IsReturnNode()); 243 ASSERT(sequence_node.NodeAt(0)->IsReturnNode());
244 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode(); 244 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode();
245 ASSERT(return_node.value()->IsLoadInstanceFieldNode()); 245 ASSERT(return_node.value()->IsLoadInstanceFieldNode());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 intptr_t argument_count, 278 intptr_t argument_count,
279 const Array& argument_names, 279 const Array& argument_names,
280 intptr_t checked_argument_count) { 280 intptr_t checked_argument_count) {
281 ASSERT(frame_register_allocator()->IsSpilled()); 281 ASSERT(frame_register_allocator()->IsSpilled());
282 ICData& ic_data = 282 ICData& ic_data =
283 ICData::ZoneHandle(ICData::New(parsed_function().function(), 283 ICData::ZoneHandle(ICData::New(parsed_function().function(),
284 function_name, 284 function_name,
285 cid, 285 cid,
286 checked_argument_count)); 286 checked_argument_count));
287 const Array& arguments_descriptor = 287 const Array& arguments_descriptor =
288 CodeGenerator::ArgumentsDescriptor(argument_count, argument_names); 288 DartEntry::ArgumentsDescriptor(argument_count, argument_names);
289 uword label_address = 0; 289 uword label_address = 0;
290 switch (checked_argument_count) { 290 switch (checked_argument_count) {
291 case 1: 291 case 1:
292 label_address = StubCode::OneArgCheckInlineCacheEntryPoint(); 292 label_address = StubCode::OneArgCheckInlineCacheEntryPoint();
293 break; 293 break;
294 case 2: 294 case 2:
295 label_address = StubCode::TwoArgsCheckInlineCacheEntryPoint(); 295 label_address = StubCode::TwoArgsCheckInlineCacheEntryPoint();
296 break; 296 break;
297 default: 297 default:
298 UNIMPLEMENTED(); 298 UNIMPLEMENTED();
(...skipping 14 matching lines...) Expand all
313 313
314 void FlowGraphCompiler::GenerateStaticCall(intptr_t cid, 314 void FlowGraphCompiler::GenerateStaticCall(intptr_t cid,
315 intptr_t token_pos, 315 intptr_t token_pos,
316 intptr_t try_index, 316 intptr_t try_index,
317 const Function& function, 317 const Function& function,
318 intptr_t argument_count, 318 intptr_t argument_count,
319 const Array& argument_names) { 319 const Array& argument_names) {
320 ASSERT(frame_register_allocator()->IsSpilled()); 320 ASSERT(frame_register_allocator()->IsSpilled());
321 321
322 const Array& arguments_descriptor = 322 const Array& arguments_descriptor =
323 CodeGenerator::ArgumentsDescriptor(argument_count, argument_names); 323 DartEntry::ArgumentsDescriptor(argument_count, argument_names);
324 const intptr_t descr_offset = EmitStaticCall(function, 324 const intptr_t descr_offset = EmitStaticCall(function,
325 arguments_descriptor, 325 arguments_descriptor,
326 argument_count); 326 argument_count);
327 pc_descriptors_list()->AddDescriptor(PcDescriptors::kFuncCall, 327 pc_descriptors_list()->AddDescriptor(PcDescriptors::kFuncCall,
328 descr_offset, 328 descr_offset,
329 cid, 329 cid,
330 token_pos, 330 token_pos,
331 try_index); 331 try_index);
332 } 332 }
333 333
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 611
612 612
613 void FrameRegisterAllocator::SpillInDeoptStub(DeoptimizationStub* stub) { 613 void FrameRegisterAllocator::SpillInDeoptStub(DeoptimizationStub* stub) {
614 for (int i = 0; i < stack_.length(); i++) { 614 for (int i = 0; i < stack_.length(); i++) {
615 stub->Push(stack_[i]); 615 stub->Push(stack_[i]);
616 } 616 }
617 } 617 }
618 618
619 619
620 } // namespace dart 620 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698