| 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/arm64/macro-assembler-arm64.h" | 7 #include "src/arm64/macro-assembler-arm64.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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), imm); \ | 124 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), imm); \ |
| 125 } \ | 125 } \ |
| 126 } while (0); | 126 } while (0); |
| 127 | 127 |
| 128 | 128 |
| 129 // Assembles an instruction after register allocation, producing machine code. | 129 // Assembles an instruction after register allocation, producing machine code. |
| 130 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 130 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
| 131 Arm64OperandConverter i(this, instr); | 131 Arm64OperandConverter i(this, instr); |
| 132 InstructionCode opcode = instr->opcode(); | 132 InstructionCode opcode = instr->opcode(); |
| 133 switch (ArchOpcodeField::decode(opcode)) { | 133 switch (ArchOpcodeField::decode(opcode)) { |
| 134 case kArchCallAddress: { | |
| 135 DirectCEntryStub stub(isolate()); | |
| 136 stub.GenerateCall(masm(), i.InputRegister(0)); | |
| 137 break; | |
| 138 } | |
| 139 case kArchCallCodeObject: { | 134 case kArchCallCodeObject: { |
| 140 if (instr->InputAt(0)->IsImmediate()) { | 135 if (instr->InputAt(0)->IsImmediate()) { |
| 141 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), | 136 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), |
| 142 RelocInfo::CODE_TARGET); | 137 RelocInfo::CODE_TARGET); |
| 143 } else { | 138 } else { |
| 144 Register target = i.InputRegister(0); | 139 Register target = i.InputRegister(0); |
| 145 __ Add(target, target, Code::kHeaderSize - kHeapObjectTag); | 140 __ Add(target, target, Code::kHeaderSize - kHeapObjectTag); |
| 146 __ Call(target); | 141 __ Call(target); |
| 147 } | 142 } |
| 148 AddSafepointAndDeopt(instr); | 143 AddSafepointAndDeopt(instr); |
| 149 break; | 144 break; |
| 150 } | 145 } |
| 151 case kArchCallJSFunction: { | 146 case kArchCallJSFunction: { |
| 152 Register func = i.InputRegister(0); | 147 Register func = i.InputRegister(0); |
| 153 if (FLAG_debug_code) { | 148 if (FLAG_debug_code) { |
| 154 // Check the function's context matches the context argument. | 149 // Check the function's context matches the context argument. |
| 155 UseScratchRegisterScope scope(masm()); | 150 UseScratchRegisterScope scope(masm()); |
| 156 Register temp = scope.AcquireX(); | 151 Register temp = scope.AcquireX(); |
| 157 __ Ldr(temp, FieldMemOperand(func, JSFunction::kContextOffset)); | 152 __ Ldr(temp, FieldMemOperand(func, JSFunction::kContextOffset)); |
| 158 __ cmp(cp, temp); | 153 __ cmp(cp, temp); |
| 159 __ Assert(eq, kWrongFunctionContext); | 154 __ Assert(eq, kWrongFunctionContext); |
| 160 } | 155 } |
| 161 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 156 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
| 162 __ Call(x10); | 157 __ Call(x10); |
| 163 AddSafepointAndDeopt(instr); | 158 AddSafepointAndDeopt(instr); |
| 164 break; | 159 break; |
| 165 } | 160 } |
| 166 case kArchDrop: { | |
| 167 int words = MiscField::decode(instr->opcode()); | |
| 168 __ Drop(words); | |
| 169 break; | |
| 170 } | |
| 171 case kArchJmp: | 161 case kArchJmp: |
| 172 __ B(code_->GetLabel(i.InputBlock(0))); | 162 __ B(code_->GetLabel(i.InputBlock(0))); |
| 173 break; | 163 break; |
| 174 case kArchNop: | 164 case kArchNop: |
| 175 // don't emit code for nops. | 165 // don't emit code for nops. |
| 176 break; | 166 break; |
| 177 case kArchRet: | 167 case kArchRet: |
| 178 AssembleReturn(); | 168 AssembleReturn(); |
| 179 break; | 169 break; |
| 180 case kArchTruncateDoubleToI: | 170 case kArchTruncateDoubleToI: |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 } | 842 } |
| 853 | 843 |
| 854 | 844 |
| 855 void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); } | 845 void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); } |
| 856 | 846 |
| 857 #undef __ | 847 #undef __ |
| 858 | 848 |
| 859 } // namespace compiler | 849 } // namespace compiler |
| 860 } // namespace internal | 850 } // namespace internal |
| 861 } // namespace v8 | 851 } // namespace v8 |
| OLD | NEW |