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