OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 CodeGenerator::CodeGenerator(InstructionSequence* code) | 15 CodeGenerator::CodeGenerator(InstructionSequence* code) |
16 : code_(code), | 16 : code_(code), |
17 current_block_(NULL), | 17 current_block_(BasicBlock::RpoNumber::Invalid()), |
18 current_source_position_(SourcePosition::Invalid()), | 18 current_source_position_(SourcePosition::Invalid()), |
19 masm_(code->zone()->isolate(), NULL, 0), | 19 masm_(code->zone()->isolate(), NULL, 0), |
20 resolver_(this), | 20 resolver_(this), |
21 safepoints_(code->zone()), | 21 safepoints_(code->zone()), |
22 deoptimization_states_(code->zone()), | 22 deoptimization_states_(code->zone()), |
23 deoptimization_literals_(code->zone()), | 23 deoptimization_literals_(code->zone()), |
24 translations_(code->zone()), | 24 translations_(code->zone()), |
25 last_lazy_deopt_pc_(0) {} | 25 last_lazy_deopt_pc_(0) {} |
26 | 26 |
27 | 27 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 safepoint.DefinePointerRegister(reg, zone()); | 96 safepoint.DefinePointerRegister(reg, zone()); |
97 } | 97 } |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 | 101 |
102 void CodeGenerator::AssembleInstruction(Instruction* instr) { | 102 void CodeGenerator::AssembleInstruction(Instruction* instr) { |
103 if (instr->IsBlockStart()) { | 103 if (instr->IsBlockStart()) { |
104 // Bind a label for a block start and handle parallel moves. | 104 // Bind a label for a block start and handle parallel moves. |
105 BlockStartInstruction* block_start = BlockStartInstruction::cast(instr); | 105 BlockStartInstruction* block_start = BlockStartInstruction::cast(instr); |
106 current_block_ = block_start->block(); | 106 current_block_ = block_start->rpo_number(); |
107 if (FLAG_code_comments) { | 107 if (FLAG_code_comments) { |
108 // TODO(titzer): these code comments are a giant memory leak. | 108 // TODO(titzer): these code comments are a giant memory leak. |
109 Vector<char> buffer = Vector<char>::New(32); | 109 Vector<char> buffer = Vector<char>::New(32); |
110 SNPrintF(buffer, "-- B%d start --", block_start->block()->id().ToInt()); | 110 // TODO(dcarney): should not be rpo number there |
| 111 SNPrintF(buffer, "-- B%d (rpo) start --", current_block_.ToInt()); |
111 masm()->RecordComment(buffer.start()); | 112 masm()->RecordComment(buffer.start()); |
112 } | 113 } |
113 masm()->bind(block_start->label()); | 114 masm()->bind(block_start->label()); |
114 } | 115 } |
115 if (instr->IsGapMoves()) { | 116 if (instr->IsGapMoves()) { |
116 // Handle parallel moves associated with the gap instruction. | 117 // Handle parallel moves associated with the gap instruction. |
117 AssembleGap(GapInstruction::cast(instr)); | 118 AssembleGap(GapInstruction::cast(instr)); |
118 } else if (instr->IsSourcePosition()) { | 119 } else if (instr->IsSourcePosition()) { |
119 AssembleSourcePosition(SourcePositionInstruction::cast(instr)); | 120 AssembleSourcePosition(SourcePositionInstruction::cast(instr)); |
120 } else { | 121 } else { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 } | 506 } |
506 | 507 |
507 | 508 |
508 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } | 509 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } |
509 | 510 |
510 #endif // !V8_TURBOFAN_BACKEND | 511 #endif // !V8_TURBOFAN_BACKEND |
511 | 512 |
512 } // namespace compiler | 513 } // namespace compiler |
513 } // namespace internal | 514 } // namespace internal |
514 } // namespace v8 | 515 } // namespace v8 |
OLD | NEW |