| 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 "src/crankshaft/arm64/lithium-arm64.h" | 5 #include "src/crankshaft/arm64/lithium-arm64.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/crankshaft/arm64/lithium-codegen-arm64.h" | 9 #include "src/crankshaft/arm64/lithium-codegen-arm64.h" |
| 10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 | 708 |
| 709 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 709 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 710 instr = AssignPointerMap(instr); | 710 instr = AssignPointerMap(instr); |
| 711 } | 711 } |
| 712 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 712 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 713 instr = AssignEnvironment(instr); | 713 instr = AssignEnvironment(instr); |
| 714 } | 714 } |
| 715 chunk_->AddInstruction(instr, current_block_); | 715 chunk_->AddInstruction(instr, current_block_); |
| 716 | 716 |
| 717 if (instr->IsCall() || instr->IsPrologue()) { | 717 if (instr->IsCall() || instr->IsPrologue()) { |
| 718 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 718 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 719 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
| 719 if (hydrogen_val->HasObservableSideEffects()) { | 720 DCHECK_NOT_NULL(hydrogen_env); |
| 720 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | 721 if (instr->IsTailCall()) { |
| 721 sim->ReplayEnvironment(current_block_->last_environment()); | 722 hydrogen_env = hydrogen_env->outer(); |
| 722 hydrogen_value_for_lazy_bailout = sim; | 723 if (hydrogen_env != nullptr && |
| 724 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) { |
| 725 hydrogen_env = hydrogen_env->outer(); |
| 726 } |
| 727 } else { |
| 728 if (hydrogen_val->HasObservableSideEffects()) { |
| 729 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 730 sim->ReplayEnvironment(hydrogen_env); |
| 731 hydrogen_value_for_lazy_bailout = sim; |
| 732 } |
| 723 } | 733 } |
| 724 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 734 if (hydrogen_env != nullptr) { |
| 725 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 735 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( |
| 726 chunk_->AddInstruction(bailout, current_block_); | 736 new (zone()) LLazyBailout(), hydrogen_env); |
| 737 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 738 chunk_->AddInstruction(bailout, current_block_); |
| 739 } |
| 727 } | 740 } |
| 728 } | 741 } |
| 729 | 742 |
| 730 | 743 |
| 731 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 744 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 732 HEnvironment* hydrogen_env = current_block_->last_environment(); | 745 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 733 int argument_index_accumulator = 0; | 746 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); |
| 734 ZoneList<HValue*> objects_to_materialize(0, zone()); | |
| 735 instr->set_environment(CreateEnvironment(hydrogen_env, | |
| 736 &argument_index_accumulator, | |
| 737 &objects_to_materialize)); | |
| 738 return instr; | |
| 739 } | 747 } |
| 740 | 748 |
| 741 | 749 |
| 742 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 750 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
| 743 return new (zone()) LPrologue(); | 751 return new (zone()) LPrologue(); |
| 744 } | 752 } |
| 745 | 753 |
| 746 | 754 |
| 747 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 755 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
| 748 // The control instruction marking the end of a block that completed | 756 // The control instruction marking the end of a block that completed |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 op = | 1015 op = |
| 1008 UseFixed(instr->OperandAt(i), | 1016 UseFixed(instr->OperandAt(i), |
| 1009 descriptor.GetRegisterParameter( | 1017 descriptor.GetRegisterParameter( |
| 1010 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); | 1018 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); |
| 1011 ops.Add(op, zone()); | 1019 ops.Add(op, zone()); |
| 1012 } | 1020 } |
| 1013 | 1021 |
| 1014 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor(descriptor, | 1022 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor(descriptor, |
| 1015 ops, | 1023 ops, |
| 1016 zone()); | 1024 zone()); |
| 1025 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1026 result->MarkAsTailCall(); |
| 1027 } |
| 1017 return MarkAsCall(DefineFixed(result, x0), instr); | 1028 return MarkAsCall(DefineFixed(result, x0), instr); |
| 1018 } | 1029 } |
| 1019 | 1030 |
| 1020 | 1031 |
| 1021 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1032 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
| 1022 LOperand* context = UseFixed(instr->context(), cp); | 1033 LOperand* context = UseFixed(instr->context(), cp); |
| 1023 // The call to ArrayConstructCode will expect the constructor to be in x1. | 1034 // The call to ArrayConstructCode will expect the constructor to be in x1. |
| 1024 LOperand* constructor = UseFixed(instr->constructor(), x1); | 1035 LOperand* constructor = UseFixed(instr->constructor(), x1); |
| 1025 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); | 1036 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
| 1026 return MarkAsCall(DefineFixed(result, x0), instr); | 1037 return MarkAsCall(DefineFixed(result, x0), instr); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 LHasInPrototypeChainAndBranch(object, prototype, scratch1, scratch2); | 1510 LHasInPrototypeChainAndBranch(object, prototype, scratch1, scratch2); |
| 1500 return AssignEnvironment(result); | 1511 return AssignEnvironment(result); |
| 1501 } | 1512 } |
| 1502 | 1513 |
| 1503 | 1514 |
| 1504 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1515 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1505 LOperand* context = UseFixed(instr->context(), cp); | 1516 LOperand* context = UseFixed(instr->context(), cp); |
| 1506 // The function is required (by MacroAssembler::InvokeFunction) to be in x1. | 1517 // The function is required (by MacroAssembler::InvokeFunction) to be in x1. |
| 1507 LOperand* function = UseFixed(instr->function(), x1); | 1518 LOperand* function = UseFixed(instr->function(), x1); |
| 1508 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1519 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1520 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1521 result->MarkAsTailCall(); |
| 1522 } |
| 1509 return MarkAsCall(DefineFixed(result, x0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1523 return MarkAsCall(DefineFixed(result, x0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1510 } | 1524 } |
| 1511 | 1525 |
| 1512 | 1526 |
| 1513 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { | 1527 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { |
| 1514 DCHECK(instr->value()->representation().IsTagged()); | 1528 DCHECK(instr->value()->representation().IsTagged()); |
| 1515 LOperand* value = UseRegisterAtStart(instr->value()); | 1529 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1516 LOperand* temp = TempRegister(); | 1530 LOperand* temp = TempRegister(); |
| 1517 return new(zone()) LIsStringAndBranch(value, temp); | 1531 return new(zone()) LIsStringAndBranch(value, temp); |
| 1518 } | 1532 } |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2636 | 2650 |
| 2637 | 2651 |
| 2638 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2652 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
| 2639 LOperand* context = UseRegisterAtStart(instr->context()); | 2653 LOperand* context = UseRegisterAtStart(instr->context()); |
| 2640 return new(zone()) LStoreFrameContext(context); | 2654 return new(zone()) LStoreFrameContext(context); |
| 2641 } | 2655 } |
| 2642 | 2656 |
| 2643 | 2657 |
| 2644 } // namespace internal | 2658 } // namespace internal |
| 2645 } // namespace v8 | 2659 } // namespace v8 |
| OLD | NEW |