| 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 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 safepoint.DefinePointerSlot(pointer->index(), zone()); | 179 safepoint.DefinePointerSlot(pointer->index(), zone()); |
| 180 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { | 180 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { |
| 181 Register reg = Register::FromAllocationIndex(pointer->index()); | 181 Register reg = Register::FromAllocationIndex(pointer->index()); |
| 182 safepoint.DefinePointerRegister(reg, zone()); | 182 safepoint.DefinePointerRegister(reg, zone()); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 | 187 |
| 188 void CodeGenerator::AssembleInstruction(Instruction* instr) { | 188 void CodeGenerator::AssembleInstruction(Instruction* instr) { |
| 189 if (instr->IsGapMoves()) { | 189 AssembleGaps(instr); |
| 190 // Handle parallel moves associated with the gap instruction. | 190 if (instr->IsSourcePosition()) { |
| 191 AssembleGap(GapInstruction::cast(instr)); | |
| 192 } else if (instr->IsSourcePosition()) { | |
| 193 AssembleSourcePosition(SourcePositionInstruction::cast(instr)); | 191 AssembleSourcePosition(SourcePositionInstruction::cast(instr)); |
| 194 } else { | 192 } else { |
| 195 // Assemble architecture-specific code for the instruction. | 193 // Assemble architecture-specific code for the instruction. |
| 196 AssembleArchInstruction(instr); | 194 AssembleArchInstruction(instr); |
| 197 | 195 |
| 198 FlagsMode mode = FlagsModeField::decode(instr->opcode()); | 196 FlagsMode mode = FlagsModeField::decode(instr->opcode()); |
| 199 FlagsCondition condition = FlagsConditionField::decode(instr->opcode()); | 197 FlagsCondition condition = FlagsConditionField::decode(instr->opcode()); |
| 200 if (mode == kFlags_branch) { | 198 if (mode == kFlags_branch) { |
| 201 // Assemble a branch after this instruction. | 199 // Assemble a branch after this instruction. |
| 202 InstructionOperandConverter i(this, instr); | 200 InstructionOperandConverter i(this, instr); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 base::OS::SNPrintF(buffer.start(), buffer.length(), | 249 base::OS::SNPrintF(buffer.start(), buffer.length(), |
| 252 "-- <unknown>:%d:%d --", ln, cn); | 250 "-- <unknown>:%d:%d --", ln, cn); |
| 253 } | 251 } |
| 254 masm()->RecordComment(buffer.start()); | 252 masm()->RecordComment(buffer.start()); |
| 255 } | 253 } |
| 256 } | 254 } |
| 257 current_source_position_ = source_position; | 255 current_source_position_ = source_position; |
| 258 } | 256 } |
| 259 | 257 |
| 260 | 258 |
| 261 void CodeGenerator::AssembleGap(GapInstruction* instr) { | 259 void CodeGenerator::AssembleGaps(Instruction* instr) { |
| 262 for (int i = GapInstruction::FIRST_INNER_POSITION; | 260 for (int i = Instruction::FIRST_GAP_POSITION; |
| 263 i <= GapInstruction::LAST_INNER_POSITION; i++) { | 261 i <= Instruction::LAST_GAP_POSITION; i++) { |
| 264 GapInstruction::InnerPosition inner_pos = | 262 Instruction::GapPosition inner_pos = |
| 265 static_cast<GapInstruction::InnerPosition>(i); | 263 static_cast<Instruction::GapPosition>(i); |
| 266 ParallelMove* move = instr->GetParallelMove(inner_pos); | 264 ParallelMove* move = instr->GetParallelMove(inner_pos); |
| 267 if (move != NULL) resolver()->Resolve(move); | 265 if (move != nullptr) resolver()->Resolve(move); |
| 268 } | 266 } |
| 269 } | 267 } |
| 270 | 268 |
| 271 | 269 |
| 272 void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) { | 270 void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) { |
| 273 CompilationInfo* info = this->info(); | 271 CompilationInfo* info = this->info(); |
| 274 int deopt_count = static_cast<int>(deoptimization_states_.size()); | 272 int deopt_count = static_cast<int>(deoptimization_states_.size()); |
| 275 if (deopt_count == 0 && !info->is_osr()) return; | 273 if (deopt_count == 0 && !info->is_osr()) return; |
| 276 Handle<DeoptimizationInputData> data = | 274 Handle<DeoptimizationInputData> data = |
| 277 DeoptimizationInputData::New(isolate(), deopt_count, TENURED); | 275 DeoptimizationInputData::New(isolate(), deopt_count, TENURED); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 : masm_(gen->masm()), next_(gen->ools_) { | 638 : masm_(gen->masm()), next_(gen->ools_) { |
| 641 gen->ools_ = this; | 639 gen->ools_ = this; |
| 642 } | 640 } |
| 643 | 641 |
| 644 | 642 |
| 645 OutOfLineCode::~OutOfLineCode() {} | 643 OutOfLineCode::~OutOfLineCode() {} |
| 646 | 644 |
| 647 } // namespace compiler | 645 } // namespace compiler |
| 648 } // namespace internal | 646 } // namespace internal |
| 649 } // namespace v8 | 647 } // namespace v8 |
| OLD | NEW |