| 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/address-map.h" | 7 #include "src/address-map.h" |
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 base::OS::SNPrintF(buffer.start(), buffer.length(), "-- %s:%d:%d --", | 415 base::OS::SNPrintF(buffer.start(), buffer.length(), "-- %s:%d:%d --", |
| 416 file->ToCString().get(), ln, cn); | 416 file->ToCString().get(), ln, cn); |
| 417 } else { | 417 } else { |
| 418 base::OS::SNPrintF(buffer.start(), buffer.length(), | 418 base::OS::SNPrintF(buffer.start(), buffer.length(), |
| 419 "-- <unknown>:%d:%d --", ln, cn); | 419 "-- <unknown>:%d:%d --", ln, cn); |
| 420 } | 420 } |
| 421 masm()->RecordComment(buffer.start()); | 421 masm()->RecordComment(buffer.start()); |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 | 424 |
| 425 bool CodeGenerator::GetSlotAboveSPAfterGap(Instruction* instr, int* slot) { |
| 426 if (instr->IsTailCall()) { |
| 427 InstructionOperandConverter g(this, instr); |
| 428 *slot = g.InputInt32(instr->InputCount() - 1); |
| 429 return true; |
| 430 } else { |
| 431 return false; |
| 432 } |
| 433 } |
| 425 | 434 |
| 426 void CodeGenerator::AssembleGaps(Instruction* instr) { | 435 void CodeGenerator::AssembleGaps(Instruction* instr) { |
| 436 AssemblePreGaps(instr); |
| 427 for (int i = Instruction::FIRST_GAP_POSITION; | 437 for (int i = Instruction::FIRST_GAP_POSITION; |
| 428 i <= Instruction::LAST_GAP_POSITION; i++) { | 438 i <= Instruction::LAST_GAP_POSITION; i++) { |
| 429 Instruction::GapPosition inner_pos = | 439 Instruction::GapPosition inner_pos = |
| 430 static_cast<Instruction::GapPosition>(i); | 440 static_cast<Instruction::GapPosition>(i); |
| 431 ParallelMove* move = instr->GetParallelMove(inner_pos); | 441 ParallelMove* move = instr->GetParallelMove(inner_pos); |
| 432 if (move != nullptr) resolver()->Resolve(move); | 442 if (move != nullptr) resolver()->Resolve(move); |
| 433 } | 443 } |
| 444 AssemblePostGaps(instr); |
| 434 } | 445 } |
| 435 | 446 |
| 436 | 447 |
| 437 void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) { | 448 void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) { |
| 438 CompilationInfo* info = this->info(); | 449 CompilationInfo* info = this->info(); |
| 439 int deopt_count = static_cast<int>(deoptimization_states_.size()); | 450 int deopt_count = static_cast<int>(deoptimization_states_.size()); |
| 440 if (deopt_count == 0 && !info->is_osr()) return; | 451 if (deopt_count == 0 && !info->is_osr()) return; |
| 441 Handle<DeoptimizationInputData> data = | 452 Handle<DeoptimizationInputData> data = |
| 442 DeoptimizationInputData::New(isolate(), deopt_count, TENURED); | 453 DeoptimizationInputData::New(isolate(), deopt_count, TENURED); |
| 443 | 454 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 DeoptimizationExit* CodeGenerator::AddDeoptimizationExit( | 808 DeoptimizationExit* CodeGenerator::AddDeoptimizationExit( |
| 798 Instruction* instr, size_t frame_state_offset) { | 809 Instruction* instr, size_t frame_state_offset) { |
| 799 int const deoptimization_id = BuildTranslation( | 810 int const deoptimization_id = BuildTranslation( |
| 800 instr, -1, frame_state_offset, OutputFrameStateCombine::Ignore()); | 811 instr, -1, frame_state_offset, OutputFrameStateCombine::Ignore()); |
| 801 DeoptimizationExit* const exit = | 812 DeoptimizationExit* const exit = |
| 802 new (zone()) DeoptimizationExit(deoptimization_id); | 813 new (zone()) DeoptimizationExit(deoptimization_id); |
| 803 deoptimization_exits_.push_back(exit); | 814 deoptimization_exits_.push_back(exit); |
| 804 return exit; | 815 return exit; |
| 805 } | 816 } |
| 806 | 817 |
| 807 int CodeGenerator::TailCallFrameStackSlotDelta(int stack_param_delta) { | |
| 808 // Leave the PC on the stack on platforms that have that as part of their ABI | |
| 809 int pc_slots = V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK ? 1 : 0; | |
| 810 int sp_slot_delta = frame_access_state()->has_frame() | |
| 811 ? (frame()->GetTotalFrameSlotCount() - pc_slots) | |
| 812 : 0; | |
| 813 // Discard only slots that won't be used by new parameters. | |
| 814 sp_slot_delta += stack_param_delta; | |
| 815 return sp_slot_delta; | |
| 816 } | |
| 817 | |
| 818 | |
| 819 OutOfLineCode::OutOfLineCode(CodeGenerator* gen) | 818 OutOfLineCode::OutOfLineCode(CodeGenerator* gen) |
| 820 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 819 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
| 821 gen->ools_ = this; | 820 gen->ools_ = this; |
| 822 } | 821 } |
| 823 | 822 |
| 824 | 823 |
| 825 OutOfLineCode::~OutOfLineCode() {} | 824 OutOfLineCode::~OutOfLineCode() {} |
| 826 | 825 |
| 827 } // namespace compiler | 826 } // namespace compiler |
| 828 } // namespace internal | 827 } // namespace internal |
| 829 } // namespace v8 | 828 } // namespace v8 |
| OLD | NEW |