| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return GeneratePrologue() && | 58 return GeneratePrologue() && |
| 59 GenerateBody() && | 59 GenerateBody() && |
| 60 GenerateDeferredCode() && | 60 GenerateDeferredCode() && |
| 61 GenerateJumpTable() && | 61 GenerateJumpTable() && |
| 62 GenerateSafepointTable(); | 62 GenerateSafepointTable(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 void LCodeGen::FinishCode(Handle<Code> code) { | 66 void LCodeGen::FinishCode(Handle<Code> code) { |
| 67 DCHECK(is_done()); | 67 DCHECK(is_done()); |
| 68 code->set_stack_slots(GetStackSlotCount()); | 68 code->set_stack_slots(GetTotalFrameSlotCount()); |
| 69 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 69 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 70 PopulateDeoptimizationData(code); | 70 PopulateDeoptimizationData(code); |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 #ifdef _MSC_VER | 74 #ifdef _MSC_VER |
| 75 void LCodeGen::MakeSureStackPagesMapped(int offset) { | 75 void LCodeGen::MakeSureStackPagesMapped(int offset) { |
| 76 const int kPageSize = 4 * KB; | 76 const int kPageSize = 4 * KB; |
| 77 for (offset -= kPageSize; offset > 0; offset -= kPageSize) { | 77 for (offset -= kPageSize; offset > 0; offset -= kPageSize) { |
| 78 __ movp(Operand(rsp, offset), rax); | 78 __ movp(Operand(rsp, offset), rax); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 399 |
| 400 // Deferred code is the last part of the instruction sequence. Mark | 400 // Deferred code is the last part of the instruction sequence. Mark |
| 401 // the generated code as done unless we bailed out. | 401 // the generated code as done unless we bailed out. |
| 402 if (!is_aborted()) status_ = DONE; | 402 if (!is_aborted()) status_ = DONE; |
| 403 return !is_aborted(); | 403 return !is_aborted(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 | 406 |
| 407 bool LCodeGen::GenerateSafepointTable() { | 407 bool LCodeGen::GenerateSafepointTable() { |
| 408 DCHECK(is_done()); | 408 DCHECK(is_done()); |
| 409 safepoints_.Emit(masm(), GetStackSlotCount()); | 409 safepoints_.Emit(masm(), GetTotalFrameSlotCount()); |
| 410 return !is_aborted(); | 410 return !is_aborted(); |
| 411 } | 411 } |
| 412 | 412 |
| 413 | 413 |
| 414 Register LCodeGen::ToRegister(int index) const { | 414 Register LCodeGen::ToRegister(int index) const { |
| 415 return Register::from_code(index); | 415 return Register::from_code(index); |
| 416 } | 416 } |
| 417 | 417 |
| 418 | 418 |
| 419 XMMRegister LCodeGen::ToDoubleRegister(int index) const { | 419 XMMRegister LCodeGen::ToDoubleRegister(int index) const { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 DCHECK(index < 0); | 500 DCHECK(index < 0); |
| 501 return -(index + 1) * kPointerSize + kPCOnStackSize; | 501 return -(index + 1) * kPointerSize + kPCOnStackSize; |
| 502 } | 502 } |
| 503 | 503 |
| 504 | 504 |
| 505 Operand LCodeGen::ToOperand(LOperand* op) const { | 505 Operand LCodeGen::ToOperand(LOperand* op) const { |
| 506 // Does not handle registers. In X64 assembler, plain registers are not | 506 // Does not handle registers. In X64 assembler, plain registers are not |
| 507 // representable as an Operand. | 507 // representable as an Operand. |
| 508 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 508 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 509 if (NeedsEagerFrame()) { | 509 if (NeedsEagerFrame()) { |
| 510 return Operand(rbp, StackSlotOffset(op->index())); | 510 return Operand(rbp, FrameSlotToFPOffset(op->index())); |
| 511 } else { | 511 } else { |
| 512 // Retrieve parameter without eager stack-frame relative to the | 512 // Retrieve parameter without eager stack-frame relative to the |
| 513 // stack-pointer. | 513 // stack-pointer. |
| 514 return Operand(rsp, ArgumentsOffsetWithoutFrame(op->index())); | 514 return Operand(rsp, ArgumentsOffsetWithoutFrame(op->index())); |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 | 517 |
| 518 | 518 |
| 519 void LCodeGen::WriteTranslation(LEnvironment* environment, | 519 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 520 Translation* translation) { | 520 Translation* translation) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 environment->HasTaggedValueAt(env_offset + i), | 568 environment->HasTaggedValueAt(env_offset + i), |
| 569 environment->HasUint32ValueAt(env_offset + i), | 569 environment->HasUint32ValueAt(env_offset + i), |
| 570 object_index_pointer, | 570 object_index_pointer, |
| 571 dematerialized_index_pointer); | 571 dematerialized_index_pointer); |
| 572 } | 572 } |
| 573 return; | 573 return; |
| 574 } | 574 } |
| 575 | 575 |
| 576 if (op->IsStackSlot()) { | 576 if (op->IsStackSlot()) { |
| 577 int index = op->index(); | 577 int index = op->index(); |
| 578 if (index >= 0) { | |
| 579 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 580 } | |
| 581 if (is_tagged) { | 578 if (is_tagged) { |
| 582 translation->StoreStackSlot(index); | 579 translation->StoreStackSlot(index); |
| 583 } else if (is_uint32) { | 580 } else if (is_uint32) { |
| 584 translation->StoreUint32StackSlot(index); | 581 translation->StoreUint32StackSlot(index); |
| 585 } else { | 582 } else { |
| 586 translation->StoreInt32StackSlot(index); | 583 translation->StoreInt32StackSlot(index); |
| 587 } | 584 } |
| 588 } else if (op->IsDoubleStackSlot()) { | 585 } else if (op->IsDoubleStackSlot()) { |
| 589 int index = op->index(); | 586 int index = op->index(); |
| 590 if (index >= 0) { | |
| 591 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 592 } | |
| 593 translation->StoreDoubleStackSlot(index); | 587 translation->StoreDoubleStackSlot(index); |
| 594 } else if (op->IsRegister()) { | 588 } else if (op->IsRegister()) { |
| 595 Register reg = ToRegister(op); | 589 Register reg = ToRegister(op); |
| 596 if (is_tagged) { | 590 if (is_tagged) { |
| 597 translation->StoreRegister(reg); | 591 translation->StoreRegister(reg); |
| 598 } else if (is_uint32) { | 592 } else if (is_uint32) { |
| 599 translation->StoreUint32Register(reg); | 593 translation->StoreUint32Register(reg); |
| 600 } else { | 594 } else { |
| 601 translation->StoreInt32Register(reg); | 595 translation->StoreInt32Register(reg); |
| 602 } | 596 } |
| (...skipping 5011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5614 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5608 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5615 } | 5609 } |
| 5616 | 5610 |
| 5617 | 5611 |
| 5618 #undef __ | 5612 #undef __ |
| 5619 | 5613 |
| 5620 } // namespace internal | 5614 } // namespace internal |
| 5621 } // namespace v8 | 5615 } // namespace v8 |
| 5622 | 5616 |
| 5623 #endif // V8_TARGET_ARCH_X64 | 5617 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |