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/ast/scopes.h" | 8 #include "src/ast/scopes.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 return ToFloat64Register(instr_->InputAt(index)); | 47 return ToFloat64Register(instr_->InputAt(index)); |
48 } | 48 } |
49 | 49 |
50 LowDwVfpRegister ToFloat64Register(InstructionOperand* op) { | 50 LowDwVfpRegister ToFloat64Register(InstructionOperand* op) { |
51 return LowDwVfpRegister::from_code(ToDoubleRegister(op).code()); | 51 return LowDwVfpRegister::from_code(ToDoubleRegister(op).code()); |
52 } | 52 } |
53 | 53 |
54 SBit OutputSBit() const { | 54 SBit OutputSBit() const { |
55 switch (instr_->flags_mode()) { | 55 switch (instr_->flags_mode()) { |
56 case kFlags_branch: | 56 case kFlags_branch: |
| 57 case kFlags_deoptimize: |
57 case kFlags_set: | 58 case kFlags_set: |
58 return SetCC; | 59 return SetCC; |
59 case kFlags_none: | 60 case kFlags_none: |
60 return LeaveCC; | 61 return LeaveCC; |
61 } | 62 } |
62 UNREACHABLE(); | 63 UNREACHABLE(); |
63 return LeaveCC; | 64 return LeaveCC; |
64 } | 65 } |
65 | 66 |
66 Operand InputImmediate(size_t index) { | 67 Operand InputImmediate(size_t index) { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 403 __ ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
403 } | 404 } |
404 frame_access_state()->SetFrameAccessToSP(); | 405 frame_access_state()->SetFrameAccessToSP(); |
405 } | 406 } |
406 | 407 |
407 | 408 |
408 // Assembles an instruction after register allocation, producing machine code. | 409 // Assembles an instruction after register allocation, producing machine code. |
409 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 410 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
410 ArmOperandConverter i(this, instr); | 411 ArmOperandConverter i(this, instr); |
411 | 412 |
412 masm()->MaybeCheckConstPool(); | 413 __ MaybeCheckConstPool(); |
413 | 414 |
414 switch (ArchOpcodeField::decode(instr->opcode())) { | 415 switch (ArchOpcodeField::decode(instr->opcode())) { |
415 case kArchCallCodeObject: { | 416 case kArchCallCodeObject: { |
416 EnsureSpaceForLazyDeopt(); | 417 EnsureSpaceForLazyDeopt(); |
417 if (instr->InputAt(0)->IsImmediate()) { | 418 if (instr->InputAt(0)->IsImmediate()) { |
418 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), | 419 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), |
419 RelocInfo::CODE_TARGET); | 420 RelocInfo::CODE_TARGET); |
420 } else { | 421 } else { |
421 __ add(ip, i.InputRegister(0), | 422 __ add(ip, i.InputRegister(0), |
422 Operand(Code::kHeaderSize - kHeapObjectTag)); | 423 Operand(Code::kHeaderSize - kHeapObjectTag)); |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 for (size_t index = 0; index < case_count; ++index) { | 1149 for (size_t index = 0; index < case_count; ++index) { |
1149 __ b(GetLabel(i.InputRpo(index + 2))); | 1150 __ b(GetLabel(i.InputRpo(index + 2))); |
1150 } | 1151 } |
1151 } | 1152 } |
1152 | 1153 |
1153 | 1154 |
1154 void CodeGenerator::AssembleDeoptimizerCall( | 1155 void CodeGenerator::AssembleDeoptimizerCall( |
1155 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 1156 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { |
1156 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1157 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
1157 isolate(), deoptimization_id, bailout_type); | 1158 isolate(), deoptimization_id, bailout_type); |
| 1159 // TODO(turbofan): We should be able to generate better code by sharing the |
| 1160 // actual final call site and just bl'ing to it here, similar to what we do |
| 1161 // in the lithium backend. |
1158 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1162 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 1163 __ CheckConstPool(false, false); |
1159 } | 1164 } |
1160 | 1165 |
1161 | 1166 |
1162 void CodeGenerator::AssemblePrologue() { | 1167 void CodeGenerator::AssemblePrologue() { |
1163 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1168 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1164 if (descriptor->IsCFunctionCall()) { | 1169 if (descriptor->IsCFunctionCall()) { |
1165 if (FLAG_enable_embedded_constant_pool) { | 1170 if (FLAG_enable_embedded_constant_pool) { |
1166 __ Push(lr, fp, pp); | 1171 __ Push(lr, fp, pp); |
1167 // Adjust FP to point to saved FP. | 1172 // Adjust FP to point to saved FP. |
1168 __ sub(fp, sp, Operand(StandardFrameConstants::kConstantPoolOffset)); | 1173 __ sub(fp, sp, Operand(StandardFrameConstants::kConstantPoolOffset)); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 padding_size -= v8::internal::Assembler::kInstrSize; | 1472 padding_size -= v8::internal::Assembler::kInstrSize; |
1468 } | 1473 } |
1469 } | 1474 } |
1470 } | 1475 } |
1471 | 1476 |
1472 #undef __ | 1477 #undef __ |
1473 | 1478 |
1474 } // namespace compiler | 1479 } // namespace compiler |
1475 } // namespace internal | 1480 } // namespace internal |
1476 } // namespace v8 | 1481 } // namespace v8 |
OLD | NEW |