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 #include <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/hydrogen-osr.h" | 8 #include "src/hydrogen-osr.h" |
9 #include "src/lithium-inl.h" | 9 #include "src/lithium-inl.h" |
10 | 10 |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 758 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
759 instr = AssignPointerMap(instr); | 759 instr = AssignPointerMap(instr); |
760 } | 760 } |
761 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 761 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
762 instr = AssignEnvironment(instr); | 762 instr = AssignEnvironment(instr); |
763 } | 763 } |
764 chunk_->AddInstruction(instr, current_block_); | 764 chunk_->AddInstruction(instr, current_block_); |
765 | 765 |
766 if (instr->IsCall()) { | 766 if (instr->IsCall()) { |
767 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 767 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
768 LInstruction* instruction_needing_environment = NULL; | |
769 if (hydrogen_val->HasObservableSideEffects()) { | 768 if (hydrogen_val->HasObservableSideEffects()) { |
770 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | 769 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
771 instruction_needing_environment = instr; | |
772 sim->ReplayEnvironment(current_block_->last_environment()); | 770 sim->ReplayEnvironment(current_block_->last_environment()); |
773 hydrogen_value_for_lazy_bailout = sim; | 771 hydrogen_value_for_lazy_bailout = sim; |
774 } | 772 } |
775 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 773 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
776 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 774 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
777 chunk_->AddInstruction(bailout, current_block_); | 775 chunk_->AddInstruction(bailout, current_block_); |
778 if (instruction_needing_environment != NULL) { | |
779 // Store the lazy deopt environment with the instruction if needed. | |
780 // Right now it is only used for LInstanceOfKnownGlobal. | |
781 instruction_needing_environment-> | |
782 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); | |
783 } | |
784 } | 776 } |
785 } | 777 } |
786 | 778 |
787 | 779 |
788 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 780 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
789 HEnvironment* hydrogen_env = current_block_->last_environment(); | 781 HEnvironment* hydrogen_env = current_block_->last_environment(); |
790 int argument_index_accumulator = 0; | 782 int argument_index_accumulator = 0; |
791 ZoneList<HValue*> objects_to_materialize(0, zone()); | 783 ZoneList<HValue*> objects_to_materialize(0, zone()); |
792 instr->set_environment(CreateEnvironment(hydrogen_env, | 784 instr->set_environment(CreateEnvironment(hydrogen_env, |
793 &argument_index_accumulator, | 785 &argument_index_accumulator, |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 LInstruction* LChunkBuilder::DoInnerAllocatedObject( | 1571 LInstruction* LChunkBuilder::DoInnerAllocatedObject( |
1580 HInnerAllocatedObject* instr) { | 1572 HInnerAllocatedObject* instr) { |
1581 LOperand* base_object = UseRegisterAtStart(instr->base_object()); | 1573 LOperand* base_object = UseRegisterAtStart(instr->base_object()); |
1582 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset()); | 1574 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset()); |
1583 return DefineAsRegister( | 1575 return DefineAsRegister( |
1584 new(zone()) LInnerAllocatedObject(base_object, offset)); | 1576 new(zone()) LInnerAllocatedObject(base_object, offset)); |
1585 } | 1577 } |
1586 | 1578 |
1587 | 1579 |
1588 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { | 1580 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { |
| 1581 LOperand* left = |
| 1582 UseFixed(instr->left(), InstanceOfDescriptor::LeftRegister()); |
| 1583 LOperand* right = |
| 1584 UseFixed(instr->right(), InstanceOfDescriptor::RightRegister()); |
1589 LOperand* context = UseFixed(instr->context(), cp); | 1585 LOperand* context = UseFixed(instr->context(), cp); |
1590 LInstanceOf* result = new(zone()) LInstanceOf( | 1586 LInstanceOf* result = new (zone()) LInstanceOf(context, left, right); |
1591 context, | |
1592 UseFixed(instr->left(), InstanceofStub::left()), | |
1593 UseFixed(instr->right(), InstanceofStub::right())); | |
1594 return MarkAsCall(DefineFixed(result, x0), instr); | 1587 return MarkAsCall(DefineFixed(result, x0), instr); |
1595 } | 1588 } |
1596 | 1589 |
1597 | 1590 |
1598 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( | 1591 LInstruction* LChunkBuilder::DoHasInPrototypeChainAndBranch( |
1599 HInstanceOfKnownGlobal* instr) { | 1592 HHasInPrototypeChainAndBranch* instr) { |
1600 LInstanceOfKnownGlobal* result = new(zone()) LInstanceOfKnownGlobal( | 1593 LOperand* object = UseRegister(instr->object()); |
1601 UseFixed(instr->context(), cp), | 1594 LOperand* prototype = UseRegister(instr->prototype()); |
1602 UseFixed(instr->left(), InstanceofStub::left())); | 1595 LOperand* scratch = TempRegister(); |
1603 return MarkAsCall(DefineFixed(result, x0), instr); | 1596 return new (zone()) LHasInPrototypeChainAndBranch(object, prototype, scratch); |
1604 } | 1597 } |
1605 | 1598 |
1606 | 1599 |
1607 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1600 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
1608 LOperand* context = UseFixed(instr->context(), cp); | 1601 LOperand* context = UseFixed(instr->context(), cp); |
1609 // The function is required (by MacroAssembler::InvokeFunction) to be in x1. | 1602 // The function is required (by MacroAssembler::InvokeFunction) to be in x1. |
1610 LOperand* function = UseFixed(instr->function(), x1); | 1603 LOperand* function = UseFixed(instr->function(), x1); |
1611 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1604 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
1612 return MarkAsCall(DefineFixed(result, x0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1605 return MarkAsCall(DefineFixed(result, x0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1613 } | 1606 } |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2809 LOperand* context = UseFixed(instr->context(), cp); | 2802 LOperand* context = UseFixed(instr->context(), cp); |
2810 LOperand* function = UseRegisterAtStart(instr->function()); | 2803 LOperand* function = UseRegisterAtStart(instr->function()); |
2811 LAllocateBlockContext* result = | 2804 LAllocateBlockContext* result = |
2812 new(zone()) LAllocateBlockContext(context, function); | 2805 new(zone()) LAllocateBlockContext(context, function); |
2813 return MarkAsCall(DefineFixed(result, cp), instr); | 2806 return MarkAsCall(DefineFixed(result, cp), instr); |
2814 } | 2807 } |
2815 | 2808 |
2816 | 2809 |
2817 } // namespace internal | 2810 } // namespace internal |
2818 } // namespace v8 | 2811 } // namespace v8 |
OLD | NEW |