| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // the frame (that is done in GeneratePrologue). | 76 // the frame (that is done in GeneratePrologue). |
| 77 FrameScope frame_scope(masm_, StackFrame::NONE); | 77 FrameScope frame_scope(masm_, StackFrame::NONE); |
| 78 | 78 |
| 79 return GeneratePrologue() && GenerateBody() && GenerateDeferredCode() && | 79 return GeneratePrologue() && GenerateBody() && GenerateDeferredCode() && |
| 80 GenerateJumpTable() && GenerateSafepointTable(); | 80 GenerateJumpTable() && GenerateSafepointTable(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 void LCodeGen::FinishCode(Handle<Code> code) { | 84 void LCodeGen::FinishCode(Handle<Code> code) { |
| 85 DCHECK(is_done()); | 85 DCHECK(is_done()); |
| 86 code->set_stack_slots(GetStackSlotCount()); | 86 code->set_stack_slots(GetTotalFrameSlotCount()); |
| 87 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 87 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 88 PopulateDeoptimizationData(code); | 88 PopulateDeoptimizationData(code); |
| 89 } | 89 } |
| 90 | 90 |
| 91 | 91 |
| 92 void LCodeGen::SaveCallerDoubles() { | 92 void LCodeGen::SaveCallerDoubles() { |
| 93 DCHECK(info()->saves_caller_doubles()); | 93 DCHECK(info()->saves_caller_doubles()); |
| 94 DCHECK(NeedsEagerFrame()); | 94 DCHECK(NeedsEagerFrame()); |
| 95 Comment(";;; Save clobbered callee double registers"); | 95 Comment(";;; Save clobbered callee double registers"); |
| 96 int count = 0; | 96 int count = 0; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 365 |
| 366 // The deoptimization jump table is the last part of the instruction | 366 // The deoptimization jump table is the last part of the instruction |
| 367 // sequence. Mark the generated code as done unless we bailed out. | 367 // sequence. Mark the generated code as done unless we bailed out. |
| 368 if (!is_aborted()) status_ = DONE; | 368 if (!is_aborted()) status_ = DONE; |
| 369 return !is_aborted(); | 369 return !is_aborted(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 | 372 |
| 373 bool LCodeGen::GenerateSafepointTable() { | 373 bool LCodeGen::GenerateSafepointTable() { |
| 374 DCHECK(is_done()); | 374 DCHECK(is_done()); |
| 375 safepoints_.Emit(masm(), GetStackSlotCount()); | 375 safepoints_.Emit(masm(), GetTotalFrameSlotCount()); |
| 376 return !is_aborted(); | 376 return !is_aborted(); |
| 377 } | 377 } |
| 378 | 378 |
| 379 | 379 |
| 380 Register LCodeGen::ToRegister(int index) const { | 380 Register LCodeGen::ToRegister(int index) const { |
| 381 return Register::from_code(index); | 381 return Register::from_code(index); |
| 382 } | 382 } |
| 383 | 383 |
| 384 | 384 |
| 385 DoubleRegister LCodeGen::ToDoubleRegister(int index) const { | 385 DoubleRegister LCodeGen::ToDoubleRegister(int index) const { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 DCHECK(index < 0); | 538 DCHECK(index < 0); |
| 539 return -(index + 1) * kPointerSize; | 539 return -(index + 1) * kPointerSize; |
| 540 } | 540 } |
| 541 | 541 |
| 542 | 542 |
| 543 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { | 543 MemOperand LCodeGen::ToMemOperand(LOperand* op) const { |
| 544 DCHECK(!op->IsRegister()); | 544 DCHECK(!op->IsRegister()); |
| 545 DCHECK(!op->IsDoubleRegister()); | 545 DCHECK(!op->IsDoubleRegister()); |
| 546 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 546 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
| 547 if (NeedsEagerFrame()) { | 547 if (NeedsEagerFrame()) { |
| 548 return MemOperand(fp, StackSlotOffset(op->index())); | 548 return MemOperand(fp, FrameSlotToFPOffset(op->index())); |
| 549 } else { | 549 } else { |
| 550 // Retrieve parameter without eager stack-frame relative to the | 550 // Retrieve parameter without eager stack-frame relative to the |
| 551 // stack-pointer. | 551 // stack-pointer. |
| 552 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); | 552 return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index())); |
| 553 } | 553 } |
| 554 } | 554 } |
| 555 | 555 |
| 556 | 556 |
| 557 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { | 557 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { |
| 558 DCHECK(op->IsDoubleStackSlot()); | 558 DCHECK(op->IsDoubleStackSlot()); |
| 559 if (NeedsEagerFrame()) { | 559 if (NeedsEagerFrame()) { |
| 560 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); | 560 return MemOperand(fp, FrameSlotToFPOffset(op->index()) + kPointerSize); |
| 561 } else { | 561 } else { |
| 562 // Retrieve parameter without eager stack-frame relative to the | 562 // Retrieve parameter without eager stack-frame relative to the |
| 563 // stack-pointer. | 563 // stack-pointer. |
| 564 return MemOperand( | 564 return MemOperand( |
| 565 sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); | 565 sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize); |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 | 568 |
| 569 | 569 |
| 570 void LCodeGen::WriteTranslation(LEnvironment* environment, | 570 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 environment->HasTaggedValueAt(env_offset + i), | 619 environment->HasTaggedValueAt(env_offset + i), |
| 620 environment->HasUint32ValueAt(env_offset + i), | 620 environment->HasUint32ValueAt(env_offset + i), |
| 621 object_index_pointer, | 621 object_index_pointer, |
| 622 dematerialized_index_pointer); | 622 dematerialized_index_pointer); |
| 623 } | 623 } |
| 624 return; | 624 return; |
| 625 } | 625 } |
| 626 | 626 |
| 627 if (op->IsStackSlot()) { | 627 if (op->IsStackSlot()) { |
| 628 int index = op->index(); | 628 int index = op->index(); |
| 629 if (index >= 0) { | |
| 630 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 631 } | |
| 632 if (is_tagged) { | 629 if (is_tagged) { |
| 633 translation->StoreStackSlot(index); | 630 translation->StoreStackSlot(index); |
| 634 } else if (is_uint32) { | 631 } else if (is_uint32) { |
| 635 translation->StoreUint32StackSlot(index); | 632 translation->StoreUint32StackSlot(index); |
| 636 } else { | 633 } else { |
| 637 translation->StoreInt32StackSlot(index); | 634 translation->StoreInt32StackSlot(index); |
| 638 } | 635 } |
| 639 } else if (op->IsDoubleStackSlot()) { | 636 } else if (op->IsDoubleStackSlot()) { |
| 640 int index = op->index(); | 637 int index = op->index(); |
| 641 if (index >= 0) { | |
| 642 index += StandardFrameConstants::kFixedFrameSize / kPointerSize; | |
| 643 } | |
| 644 translation->StoreDoubleStackSlot(index); | 638 translation->StoreDoubleStackSlot(index); |
| 645 } else if (op->IsRegister()) { | 639 } else if (op->IsRegister()) { |
| 646 Register reg = ToRegister(op); | 640 Register reg = ToRegister(op); |
| 647 if (is_tagged) { | 641 if (is_tagged) { |
| 648 translation->StoreRegister(reg); | 642 translation->StoreRegister(reg); |
| 649 } else if (is_uint32) { | 643 } else if (is_uint32) { |
| 650 translation->StoreUint32Register(reg); | 644 translation->StoreUint32Register(reg); |
| 651 } else { | 645 } else { |
| 652 translation->StoreInt32Register(reg); | 646 translation->StoreInt32Register(reg); |
| 653 } | 647 } |
| (...skipping 4919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5573 __ Push(at, ToRegister(instr->function())); | 5567 __ Push(at, ToRegister(instr->function())); |
| 5574 CallRuntime(Runtime::kPushBlockContext, instr); | 5568 CallRuntime(Runtime::kPushBlockContext, instr); |
| 5575 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5569 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5576 } | 5570 } |
| 5577 | 5571 |
| 5578 | 5572 |
| 5579 #undef __ | 5573 #undef __ |
| 5580 | 5574 |
| 5581 } // namespace internal | 5575 } // namespace internal |
| 5582 } // namespace v8 | 5576 } // namespace v8 |
| OLD | NEW |