| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.h" |
| 8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
| 9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
| 10 #include "src/compiler/gap-resolver.h" | 10 #include "src/compiler/gap-resolver.h" |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 case kArchNop: | 746 case kArchNop: |
| 747 case kArchThrowTerminator: | 747 case kArchThrowTerminator: |
| 748 // don't emit code for nops. | 748 // don't emit code for nops. |
| 749 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 749 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
| 750 break; | 750 break; |
| 751 case kArchDeoptimize: { | 751 case kArchDeoptimize: { |
| 752 int deopt_state_id = | 752 int deopt_state_id = |
| 753 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 753 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
| 754 Deoptimizer::BailoutType bailout_type = | 754 Deoptimizer::BailoutType bailout_type = |
| 755 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 755 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 756 CodeGenResult result = | 756 CodeGenResult result = AssembleDeoptimizerCall( |
| 757 AssembleDeoptimizerCall(deopt_state_id, bailout_type); | 757 deopt_state_id, bailout_type, current_source_position_); |
| 758 if (result != kSuccess) return result; | 758 if (result != kSuccess) return result; |
| 759 break; | 759 break; |
| 760 } | 760 } |
| 761 case kArchRet: | 761 case kArchRet: |
| 762 AssembleReturn(); | 762 AssembleReturn(); |
| 763 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 763 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
| 764 break; | 764 break; |
| 765 case kArchStackPointer: | 765 case kArchStackPointer: |
| 766 __ mov(i.OutputRegister(), sp); | 766 __ mov(i.OutputRegister(), sp); |
| 767 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 767 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 __ cmp(input, Operand(case_count)); | 1614 __ cmp(input, Operand(case_count)); |
| 1615 __ BlockConstPoolFor(case_count + 2); | 1615 __ BlockConstPoolFor(case_count + 2); |
| 1616 __ add(pc, pc, Operand(input, LSL, 2), LeaveCC, lo); | 1616 __ add(pc, pc, Operand(input, LSL, 2), LeaveCC, lo); |
| 1617 __ b(GetLabel(i.InputRpo(1))); | 1617 __ b(GetLabel(i.InputRpo(1))); |
| 1618 for (size_t index = 0; index < case_count; ++index) { | 1618 for (size_t index = 0; index < case_count; ++index) { |
| 1619 __ b(GetLabel(i.InputRpo(index + 2))); | 1619 __ b(GetLabel(i.InputRpo(index + 2))); |
| 1620 } | 1620 } |
| 1621 } | 1621 } |
| 1622 | 1622 |
| 1623 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 1623 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
| 1624 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 1624 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
| 1625 SourcePosition pos) { |
| 1625 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1626 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
| 1626 isolate(), deoptimization_id, bailout_type); | 1627 isolate(), deoptimization_id, bailout_type); |
| 1627 // TODO(turbofan): We should be able to generate better code by sharing the | 1628 // TODO(turbofan): We should be able to generate better code by sharing the |
| 1628 // actual final call site and just bl'ing to it here, similar to what we do | 1629 // actual final call site and just bl'ing to it here, similar to what we do |
| 1629 // in the lithium backend. | 1630 // in the lithium backend. |
| 1630 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 1631 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 1631 DeoptimizeReason deoptimization_reason = | 1632 DeoptimizeReason deoptimization_reason = |
| 1632 GetDeoptimizationReason(deoptimization_id); | 1633 GetDeoptimizationReason(deoptimization_id); |
| 1633 __ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id); | 1634 __ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id); |
| 1634 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1635 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 1635 __ CheckConstPool(false, false); | 1636 __ CheckConstPool(false, false); |
| 1636 return kSuccess; | 1637 return kSuccess; |
| 1637 } | 1638 } |
| 1638 | 1639 |
| 1639 void CodeGenerator::FinishFrame(Frame* frame) { | 1640 void CodeGenerator::FinishFrame(Frame* frame) { |
| 1640 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1641 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 1641 | 1642 |
| 1642 const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); | 1643 const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); |
| 1643 if (saves_fp != 0) { | 1644 if (saves_fp != 0) { |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 padding_size -= v8::internal::Assembler::kInstrSize; | 1970 padding_size -= v8::internal::Assembler::kInstrSize; |
| 1970 } | 1971 } |
| 1971 } | 1972 } |
| 1972 } | 1973 } |
| 1973 | 1974 |
| 1974 #undef __ | 1975 #undef __ |
| 1975 | 1976 |
| 1976 } // namespace compiler | 1977 } // namespace compiler |
| 1977 } // namespace internal | 1978 } // namespace internal |
| 1978 } // namespace v8 | 1979 } // namespace v8 |
| OLD | NEW |