| OLD | NEW | 
|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compilation-info.h" | 7 #include "src/compilation-info.h" | 
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" | 
| 9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" | 
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" | 
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1155     case kArchDebugBreak: | 1155     case kArchDebugBreak: | 
| 1156       __ stop("kArchDebugBreak"); | 1156       __ stop("kArchDebugBreak"); | 
| 1157       break; | 1157       break; | 
| 1158     case kArchNop: | 1158     case kArchNop: | 
| 1159     case kArchThrowTerminator: | 1159     case kArchThrowTerminator: | 
| 1160       // don't emit code for nops. | 1160       // don't emit code for nops. | 
| 1161       break; | 1161       break; | 
| 1162     case kArchDeoptimize: { | 1162     case kArchDeoptimize: { | 
| 1163       int deopt_state_id = | 1163       int deopt_state_id = | 
| 1164           BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 1164           BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 
| 1165       Deoptimizer::BailoutType bailout_type = | 1165       CodeGenResult result = | 
| 1166           Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 1166           AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 
| 1167       CodeGenResult result = AssembleDeoptimizerCall( |  | 
| 1168           deopt_state_id, bailout_type, current_source_position_); |  | 
| 1169       if (result != kSuccess) return result; | 1167       if (result != kSuccess) return result; | 
| 1170       break; | 1168       break; | 
| 1171     } | 1169     } | 
| 1172     case kArchRet: | 1170     case kArchRet: | 
| 1173       AssembleReturn(instr->InputAt(0)); | 1171       AssembleReturn(instr->InputAt(0)); | 
| 1174       break; | 1172       break; | 
| 1175     case kArchStackPointer: | 1173     case kArchStackPointer: | 
| 1176       __ LoadRR(i.OutputRegister(), sp); | 1174       __ LoadRR(i.OutputRegister(), sp); | 
| 1177       break; | 1175       break; | 
| 1178     case kArchFramePointer: | 1176     case kArchFramePointer: | 
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2386   Label* const table = AddJumpTable(cases, case_count); | 2384   Label* const table = AddJumpTable(cases, case_count); | 
| 2387   __ CmpLogicalP(input, Operand(case_count)); | 2385   __ CmpLogicalP(input, Operand(case_count)); | 
| 2388   __ bge(GetLabel(i.InputRpo(1))); | 2386   __ bge(GetLabel(i.InputRpo(1))); | 
| 2389   __ larl(kScratchReg, table); | 2387   __ larl(kScratchReg, table); | 
| 2390   __ ShiftLeftP(r1, input, Operand(kPointerSizeLog2)); | 2388   __ ShiftLeftP(r1, input, Operand(kPointerSizeLog2)); | 
| 2391   __ LoadP(kScratchReg, MemOperand(kScratchReg, r1)); | 2389   __ LoadP(kScratchReg, MemOperand(kScratchReg, r1)); | 
| 2392   __ Jump(kScratchReg); | 2390   __ Jump(kScratchReg); | 
| 2393 } | 2391 } | 
| 2394 | 2392 | 
| 2395 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2393 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 
| 2396     int deoptimization_id, Deoptimizer::BailoutType bailout_type, | 2394     int deoptimization_id, SourcePosition pos) { | 
| 2397     SourcePosition pos) { | 2395   DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 
|  | 2396   DeoptimizeReason deoptimization_reason = | 
|  | 2397       GetDeoptimizationReason(deoptimization_id); | 
|  | 2398   Deoptimizer::BailoutType bailout_type = | 
|  | 2399       deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | 
|  | 2400                                                    : Deoptimizer::EAGER; | 
| 2398   Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2401   Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 
| 2399       isolate(), deoptimization_id, bailout_type); | 2402       isolate(), deoptimization_id, bailout_type); | 
| 2400   // TODO(turbofan): We should be able to generate better code by sharing the | 2403   // TODO(turbofan): We should be able to generate better code by sharing the | 
| 2401   // actual final call site and just bl'ing to it here, similar to what we do | 2404   // actual final call site and just bl'ing to it here, similar to what we do | 
| 2402   // in the lithium backend. | 2405   // in the lithium backend. | 
| 2403   if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2406   if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 
| 2404   DeoptimizeReason deoptimization_reason = |  | 
| 2405       GetDeoptimizationReason(deoptimization_id); |  | 
| 2406   __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 2407   __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 
| 2407   __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2408   __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 
| 2408   return kSuccess; | 2409   return kSuccess; | 
| 2409 } | 2410 } | 
| 2410 | 2411 | 
| 2411 void CodeGenerator::FinishFrame(Frame* frame) { | 2412 void CodeGenerator::FinishFrame(Frame* frame) { | 
| 2412   CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2413   CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 
| 2413   const RegList double_saves = descriptor->CalleeSavedFPRegisters(); | 2414   const RegList double_saves = descriptor->CalleeSavedFPRegisters(); | 
| 2414 | 2415 | 
| 2415   // Save callee-saved Double registers. | 2416   // Save callee-saved Double registers. | 
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2757       padding_size -= 2; | 2758       padding_size -= 2; | 
| 2758     } | 2759     } | 
| 2759   } | 2760   } | 
| 2760 } | 2761 } | 
| 2761 | 2762 | 
| 2762 #undef __ | 2763 #undef __ | 
| 2763 | 2764 | 
| 2764 }  // namespace compiler | 2765 }  // namespace compiler | 
| 2765 }  // namespace internal | 2766 }  // namespace internal | 
| 2766 }  // namespace v8 | 2767 }  // namespace v8 | 
| OLD | NEW | 
|---|