| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 __ B(code_->GetLabel(i.InputBlock(0))); | 135 __ B(code_->GetLabel(i.InputBlock(0))); |
| 136 break; | 136 break; |
| 137 case kArchNop: | 137 case kArchNop: |
| 138 // don't emit code for nops. | 138 // don't emit code for nops. |
| 139 break; | 139 break; |
| 140 case kArchRet: | 140 case kArchRet: |
| 141 AssembleReturn(); | 141 AssembleReturn(); |
| 142 break; | 142 break; |
| 143 case kArchDeoptimize: { | 143 case kArchDeoptimize: { |
| 144 int deoptimization_id = MiscField::decode(instr->opcode()); | 144 int deoptimization_id = MiscField::decode(instr->opcode()); |
| 145 BuildTranslation(instr, deoptimization_id); | 145 BuildTranslation(instr, 0, deoptimization_id); |
| 146 | 146 |
| 147 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 147 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
| 148 isolate(), deoptimization_id, Deoptimizer::LAZY); | 148 isolate(), deoptimization_id, Deoptimizer::LAZY); |
| 149 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 149 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 150 break; | 150 break; |
| 151 } | 151 } |
| 152 case kArchTruncateDoubleToI: | 152 case kArchTruncateDoubleToI: |
| 153 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); | 153 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); |
| 154 break; | 154 break; |
| 155 case kArm64Add: | 155 case kArm64Add: |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 case kArm64Mov32: | 280 case kArm64Mov32: |
| 281 __ Mov(i.OutputRegister32(), i.InputRegister32(0)); | 281 __ Mov(i.OutputRegister32(), i.InputRegister32(0)); |
| 282 break; | 282 break; |
| 283 case kArm64Sxtw: | 283 case kArm64Sxtw: |
| 284 __ Sxtw(i.OutputRegister(), i.InputRegister32(0)); | 284 __ Sxtw(i.OutputRegister(), i.InputRegister32(0)); |
| 285 break; | 285 break; |
| 286 case kArm64CallCodeObject: { | 286 case kArm64CallCodeObject: { |
| 287 if (instr->InputAt(0)->IsImmediate()) { | 287 if (instr->InputAt(0)->IsImmediate()) { |
| 288 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); | 288 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); |
| 289 __ Call(code, RelocInfo::CODE_TARGET); | 289 __ Call(code, RelocInfo::CODE_TARGET); |
| 290 RecordSafepoint(instr->pointer_map(), Safepoint::kSimple, 0, | |
| 291 Safepoint::kNoLazyDeopt); | |
| 292 } else { | 290 } else { |
| 293 Register reg = i.InputRegister(0); | 291 Register reg = i.InputRegister(0); |
| 294 int entry = Code::kHeaderSize - kHeapObjectTag; | 292 int entry = Code::kHeaderSize - kHeapObjectTag; |
| 295 __ Ldr(reg, MemOperand(reg, entry)); | 293 __ Ldr(reg, MemOperand(reg, entry)); |
| 296 __ Call(reg); | 294 __ Call(reg); |
| 297 RecordSafepoint(instr->pointer_map(), Safepoint::kSimple, 0, | |
| 298 Safepoint::kNoLazyDeopt); | |
| 299 } | 295 } |
| 300 bool lazy_deopt = (MiscField::decode(instr->opcode()) == 1); | 296 |
| 301 if (lazy_deopt) { | 297 AddSafepointAndDeopt(instr); |
| 302 RecordLazyDeoptimizationEntry(instr); | |
| 303 } | |
| 304 // Meaningless instruction for ICs to overwrite. | 298 // Meaningless instruction for ICs to overwrite. |
| 305 AddNopForSmiCodeInlining(); | 299 AddNopForSmiCodeInlining(); |
| 306 break; | 300 break; |
| 307 } | 301 } |
| 308 case kArm64CallJSFunction: { | 302 case kArm64CallJSFunction: { |
| 309 Register func = i.InputRegister(0); | 303 Register func = i.InputRegister(0); |
| 310 | 304 |
| 311 // TODO(jarin) The load of the context should be separated from the call. | 305 // TODO(jarin) The load of the context should be separated from the call. |
| 312 __ Ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset)); | 306 __ Ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset)); |
| 313 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 307 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
| 314 __ Call(x10); | 308 __ Call(x10); |
| 315 | 309 |
| 316 RecordSafepoint(instr->pointer_map(), Safepoint::kSimple, 0, | 310 AddSafepointAndDeopt(instr); |
| 317 Safepoint::kNoLazyDeopt); | |
| 318 RecordLazyDeoptimizationEntry(instr); | |
| 319 break; | 311 break; |
| 320 } | 312 } |
| 321 case kArm64CallAddress: { | 313 case kArm64CallAddress: { |
| 322 DirectCEntryStub stub(isolate()); | 314 DirectCEntryStub stub(isolate()); |
| 323 stub.GenerateCall(masm(), i.InputRegister(0)); | 315 stub.GenerateCall(masm(), i.InputRegister(0)); |
| 324 break; | 316 break; |
| 325 } | 317 } |
| 326 case kArm64Claim: { | 318 case kArm64Claim: { |
| 327 int words = MiscField::decode(instr->opcode()); | 319 int words = MiscField::decode(instr->opcode()); |
| 328 __ Claim(words); | 320 __ Claim(words); |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 } | 827 } |
| 836 | 828 |
| 837 | 829 |
| 838 void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); } | 830 void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); } |
| 839 | 831 |
| 840 #undef __ | 832 #undef __ |
| 841 | 833 |
| 842 } // namespace compiler | 834 } // namespace compiler |
| 843 } // namespace internal | 835 } // namespace internal |
| 844 } // namespace v8 | 836 } // namespace v8 |
| OLD | NEW |