| 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 #include "src/compilation-info.h" | 6 #include "src/compilation-info.h" |
| 7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 __ RecordComment(reinterpret_cast<const char*>(comment_string)); | 725 __ RecordComment(reinterpret_cast<const char*>(comment_string)); |
| 726 break; | 726 break; |
| 727 } | 727 } |
| 728 case kArchNop: | 728 case kArchNop: |
| 729 case kArchThrowTerminator: | 729 case kArchThrowTerminator: |
| 730 // don't emit code for nops. | 730 // don't emit code for nops. |
| 731 break; | 731 break; |
| 732 case kArchDeoptimize: { | 732 case kArchDeoptimize: { |
| 733 int deopt_state_id = | 733 int deopt_state_id = |
| 734 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 734 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
| 735 CodeGenResult result = | 735 Deoptimizer::BailoutType bailout_type = |
| 736 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 736 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 737 CodeGenResult result = AssembleDeoptimizerCall( |
| 738 deopt_state_id, bailout_type, current_source_position_); |
| 737 if (result != kSuccess) return result; | 739 if (result != kSuccess) return result; |
| 738 break; | 740 break; |
| 739 } | 741 } |
| 740 case kArchRet: | 742 case kArchRet: |
| 741 AssembleReturn(instr->InputAt(0)); | 743 AssembleReturn(instr->InputAt(0)); |
| 742 break; | 744 break; |
| 743 case kArchStackPointer: | 745 case kArchStackPointer: |
| 744 __ mov(i.OutputRegister(), sp); | 746 __ mov(i.OutputRegister(), sp); |
| 745 break; | 747 break; |
| 746 case kArchFramePointer: | 748 case kArchFramePointer: |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 MipsOperandConverter i(this, instr); | 1979 MipsOperandConverter i(this, instr); |
| 1978 Register input = i.InputRegister(0); | 1980 Register input = i.InputRegister(0); |
| 1979 size_t const case_count = instr->InputCount() - 2; | 1981 size_t const case_count = instr->InputCount() - 2; |
| 1980 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); | 1982 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); |
| 1981 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { | 1983 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { |
| 1982 return GetLabel(i.InputRpo(index + 2)); | 1984 return GetLabel(i.InputRpo(index + 2)); |
| 1983 }); | 1985 }); |
| 1984 } | 1986 } |
| 1985 | 1987 |
| 1986 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 1988 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
| 1987 int deoptimization_id, SourcePosition pos) { | 1989 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
| 1988 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 1990 SourcePosition pos) { |
| 1989 DeoptimizeReason deoptimization_reason = | |
| 1990 GetDeoptimizationReason(deoptimization_id); | |
| 1991 Deoptimizer::BailoutType bailout_type = | |
| 1992 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | |
| 1993 : Deoptimizer::EAGER; | |
| 1994 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1991 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
| 1995 isolate(), deoptimization_id, bailout_type); | 1992 isolate(), deoptimization_id, bailout_type); |
| 1996 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 1993 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 1994 DeoptimizeReason deoptimization_reason = |
| 1995 GetDeoptimizationReason(deoptimization_id); |
| 1997 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 1996 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
| 1998 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1997 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 1999 return kSuccess; | 1998 return kSuccess; |
| 2000 } | 1999 } |
| 2001 | 2000 |
| 2002 void CodeGenerator::FinishFrame(Frame* frame) { | 2001 void CodeGenerator::FinishFrame(Frame* frame) { |
| 2003 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2002 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 2004 | 2003 |
| 2005 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); | 2004 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); |
| 2006 if (saves_fpu != 0) { | 2005 if (saves_fpu != 0) { |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2374 padding_size -= v8::internal::Assembler::kInstrSize; | 2373 padding_size -= v8::internal::Assembler::kInstrSize; |
| 2375 } | 2374 } |
| 2376 } | 2375 } |
| 2377 } | 2376 } |
| 2378 | 2377 |
| 2379 #undef __ | 2378 #undef __ |
| 2380 | 2379 |
| 2381 } // namespace compiler | 2380 } // namespace compiler |
| 2382 } // namespace internal | 2381 } // namespace internal |
| 2383 } // namespace v8 | 2382 } // namespace v8 |
| OLD | NEW |