| 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/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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } else { \ | 348 } else { \ |
| 349 __ cmp(offset, i.InputImmediate(1)); \ | 349 __ cmp(offset, i.InputImmediate(1)); \ |
| 350 } \ | 350 } \ |
| 351 auto value = i.InputRegister(2); \ | 351 auto value = i.InputRegister(2); \ |
| 352 __ asm_instr(value, i.InputOffset(3), lo); \ | 352 __ asm_instr(value, i.InputOffset(3), lo); \ |
| 353 DCHECK_EQ(LeaveCC, i.OutputSBit()); \ | 353 DCHECK_EQ(LeaveCC, i.OutputSBit()); \ |
| 354 } while (0) | 354 } while (0) |
| 355 | 355 |
| 356 | 356 |
| 357 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { | 357 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
| 358 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
| 359 if (sp_slot_delta > 0) { |
| 360 __ add(sp, sp, Operand(sp_slot_delta * kPointerSize)); |
| 361 } |
| 358 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 362 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 359 int stack_slots = frame()->GetSpillSlotCount(); | 363 int spill_slots = frame()->GetSpillSlotCount(); |
| 360 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { | 364 bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0; |
| 361 __ LeaveFrame(StackFrame::MANUAL); | 365 if (has_frame) { |
| 362 } | 366 if (FLAG_enable_embedded_constant_pool) { |
| 363 if (stack_param_delta < 0) { | 367 __ ldm(ia_w, sp, pp.bit() | fp.bit() | lr.bit()); |
| 364 int offset = -stack_param_delta * kPointerSize; | 368 } else { |
| 365 __ add(sp, sp, Operand(offset)); | 369 __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
| 370 } |
| 366 } | 371 } |
| 367 } | 372 } |
| 368 | 373 |
| 374 |
| 375 void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) { |
| 376 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
| 377 if (sp_slot_delta < 0) { |
| 378 __ sub(sp, sp, Operand(-sp_slot_delta * kPointerSize)); |
| 379 } |
| 380 } |
| 381 |
| 369 | 382 |
| 370 // Assembles an instruction after register allocation, producing machine code. | 383 // Assembles an instruction after register allocation, producing machine code. |
| 371 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 384 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
| 372 ArmOperandConverter i(this, instr); | 385 ArmOperandConverter i(this, instr); |
| 373 | 386 |
| 374 masm()->MaybeCheckConstPool(); | 387 masm()->MaybeCheckConstPool(); |
| 375 | 388 |
| 376 switch (ArchOpcodeField::decode(instr->opcode())) { | 389 switch (ArchOpcodeField::decode(instr->opcode())) { |
| 377 case kArchCallCodeObject: { | 390 case kArchCallCodeObject: { |
| 378 EnsureSpaceForLazyDeopt(); | 391 EnsureSpaceForLazyDeopt(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 case kArchLazyBailout: { | 448 case kArchLazyBailout: { |
| 436 EnsureSpaceForLazyDeopt(); | 449 EnsureSpaceForLazyDeopt(); |
| 437 RecordCallPosition(instr); | 450 RecordCallPosition(instr); |
| 438 break; | 451 break; |
| 439 } | 452 } |
| 440 case kArchPrepareCallCFunction: { | 453 case kArchPrepareCallCFunction: { |
| 441 int const num_parameters = MiscField::decode(instr->opcode()); | 454 int const num_parameters = MiscField::decode(instr->opcode()); |
| 442 __ PrepareCallCFunction(num_parameters, kScratchReg); | 455 __ PrepareCallCFunction(num_parameters, kScratchReg); |
| 443 break; | 456 break; |
| 444 } | 457 } |
| 458 case kArchPrepareTailCall: |
| 459 AssemblePrepareTailCall(i.InputInt32(instr->InputCount() - 1)); |
| 460 break; |
| 445 case kArchCallCFunction: { | 461 case kArchCallCFunction: { |
| 446 int const num_parameters = MiscField::decode(instr->opcode()); | 462 int const num_parameters = MiscField::decode(instr->opcode()); |
| 447 if (instr->InputAt(0)->IsImmediate()) { | 463 if (instr->InputAt(0)->IsImmediate()) { |
| 448 ExternalReference ref = i.InputExternalReference(0); | 464 ExternalReference ref = i.InputExternalReference(0); |
| 449 __ CallCFunction(ref, num_parameters); | 465 __ CallCFunction(ref, num_parameters); |
| 450 } else { | 466 } else { |
| 451 Register func = i.InputRegister(0); | 467 Register func = i.InputRegister(0); |
| 452 __ CallCFunction(func, num_parameters); | 468 __ CallCFunction(func, num_parameters); |
| 453 } | 469 } |
| 454 break; | 470 break; |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 padding_size -= v8::internal::Assembler::kInstrSize; | 1352 padding_size -= v8::internal::Assembler::kInstrSize; |
| 1337 } | 1353 } |
| 1338 } | 1354 } |
| 1339 } | 1355 } |
| 1340 | 1356 |
| 1341 #undef __ | 1357 #undef __ |
| 1342 | 1358 |
| 1343 } // namespace compiler | 1359 } // namespace compiler |
| 1344 } // namespace internal | 1360 } // namespace internal |
| 1345 } // namespace v8 | 1361 } // namespace v8 |
| OLD | NEW |