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/crankshaft/s390/lithium-s390.h" | 5 #include "src/crankshaft/s390/lithium-s390.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
10 #include "src/crankshaft/lithium-inl.h" | 10 #include "src/crankshaft/lithium-inl.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 return Define(instr, ToUnallocated(reg)); | 492 return Define(instr, ToUnallocated(reg)); |
493 } | 493 } |
494 | 494 |
495 LInstruction* LChunkBuilder::DefineFixedDouble( | 495 LInstruction* LChunkBuilder::DefineFixedDouble( |
496 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { | 496 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { |
497 return Define(instr, ToUnallocated(reg)); | 497 return Define(instr, ToUnallocated(reg)); |
498 } | 498 } |
499 | 499 |
500 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 500 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
501 HEnvironment* hydrogen_env = current_block_->last_environment(); | 501 HEnvironment* hydrogen_env = current_block_->last_environment(); |
502 int argument_index_accumulator = 0; | 502 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); |
503 ZoneList<HValue*> objects_to_materialize(0, zone()); | |
504 instr->set_environment(CreateEnvironment( | |
505 hydrogen_env, &argument_index_accumulator, &objects_to_materialize)); | |
506 return instr; | |
507 } | 503 } |
508 | 504 |
509 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 505 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
510 HInstruction* hinstr, | 506 HInstruction* hinstr, |
511 CanDeoptimize can_deoptimize) { | 507 CanDeoptimize can_deoptimize) { |
512 info()->MarkAsNonDeferredCalling(); | 508 info()->MarkAsNonDeferredCalling(); |
513 #ifdef DEBUG | 509 #ifdef DEBUG |
514 instr->VerifyCall(); | 510 instr->VerifyCall(); |
515 #endif | 511 #endif |
516 instr->MarkAsCall(); | 512 instr->MarkAsCall(); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 804 |
809 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 805 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
810 instr = AssignPointerMap(instr); | 806 instr = AssignPointerMap(instr); |
811 } | 807 } |
812 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 808 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
813 instr = AssignEnvironment(instr); | 809 instr = AssignEnvironment(instr); |
814 } | 810 } |
815 chunk_->AddInstruction(instr, current_block_); | 811 chunk_->AddInstruction(instr, current_block_); |
816 | 812 |
817 if (instr->IsCall()) { | 813 if (instr->IsCall()) { |
| 814 HEnvironment* hydrogen_env = current_block_->last_environment(); |
818 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 815 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
819 if (hydrogen_val->HasObservableSideEffects()) { | 816 DCHECK_NOT_NULL(hydrogen_env); |
820 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | 817 if (instr->IsSyntacticTailCall()) { |
821 sim->ReplayEnvironment(current_block_->last_environment()); | 818 // If it was a syntactic tail call we need to drop the current frame and |
822 hydrogen_value_for_lazy_bailout = sim; | 819 // an arguments adaptor frame on top of it (if the latter is present). |
| 820 hydrogen_env = hydrogen_env->outer(); |
| 821 if (hydrogen_env != nullptr && |
| 822 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) { |
| 823 hydrogen_env = hydrogen_env->outer(); |
| 824 } |
| 825 if (hydrogen_env != nullptr) { |
| 826 // Push return value on top of outer environment. |
| 827 hydrogen_env = hydrogen_env->Copy(); |
| 828 hydrogen_env->Push(hydrogen_val); |
| 829 } else { |
| 830 // Although we don't need this lazy bailout for normal execution |
| 831 // (because when we tail call from the outermost function we should pop |
| 832 // its frame) we still need it when debugger is on. |
| 833 hydrogen_env = current_block_->last_environment(); |
| 834 } |
| 835 } else { |
| 836 if (hydrogen_val->HasObservableSideEffects()) { |
| 837 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 838 sim->ReplayEnvironment(hydrogen_env); |
| 839 hydrogen_value_for_lazy_bailout = sim; |
| 840 } |
823 } | 841 } |
824 LInstruction* bailout = AssignEnvironment(new (zone()) LLazyBailout()); | 842 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( |
| 843 new (zone()) LLazyBailout(), hydrogen_env); |
825 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 844 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
826 chunk_->AddInstruction(bailout, current_block_); | 845 chunk_->AddInstruction(bailout, current_block_); |
827 } | 846 } |
828 } | 847 } |
829 | 848 |
830 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 849 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
831 LInstruction* result = new (zone()) LPrologue(); | 850 LInstruction* result = new (zone()) LPrologue(); |
832 if (info_->num_heap_slots() > 0) { | 851 if (info_->num_heap_slots() > 0) { |
833 result = MarkAsCall(result, instr); | 852 result = MarkAsCall(result, instr); |
834 } | 853 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 i < instr->OperandCount(); i++) { | 993 i < instr->OperandCount(); i++) { |
975 op = | 994 op = |
976 UseFixed(instr->OperandAt(i), | 995 UseFixed(instr->OperandAt(i), |
977 descriptor.GetRegisterParameter( | 996 descriptor.GetRegisterParameter( |
978 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); | 997 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); |
979 ops.Add(op, zone()); | 998 ops.Add(op, zone()); |
980 } | 999 } |
981 | 1000 |
982 LCallWithDescriptor* result = | 1001 LCallWithDescriptor* result = |
983 new (zone()) LCallWithDescriptor(descriptor, ops, zone()); | 1002 new (zone()) LCallWithDescriptor(descriptor, ops, zone()); |
| 1003 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1004 result->MarkAsSyntacticTailCall(); |
| 1005 } |
984 return MarkAsCall(DefineFixed(result, r2), instr); | 1006 return MarkAsCall(DefineFixed(result, r2), instr); |
985 } | 1007 } |
986 | 1008 |
987 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1009 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
988 LOperand* context = UseFixed(instr->context(), cp); | 1010 LOperand* context = UseFixed(instr->context(), cp); |
989 LOperand* function = UseFixed(instr->function(), r3); | 1011 LOperand* function = UseFixed(instr->function(), r3); |
990 LInvokeFunction* result = new (zone()) LInvokeFunction(context, function); | 1012 LInvokeFunction* result = new (zone()) LInvokeFunction(context, function); |
| 1013 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1014 result->MarkAsSyntacticTailCall(); |
| 1015 } |
991 return MarkAsCall(DefineFixed(result, r2), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1016 return MarkAsCall(DefineFixed(result, r2), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
992 } | 1017 } |
993 | 1018 |
994 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1019 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
995 switch (instr->op()) { | 1020 switch (instr->op()) { |
996 case kMathFloor: | 1021 case kMathFloor: |
997 return DoMathFloor(instr); | 1022 return DoMathFloor(instr); |
998 case kMathRound: | 1023 case kMathRound: |
999 return DoMathRound(instr); | 1024 return DoMathRound(instr); |
1000 case kMathFround: | 1025 case kMathFround: |
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 return AssignPointerMap(result); | 2324 return AssignPointerMap(result); |
2300 } | 2325 } |
2301 | 2326 |
2302 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2327 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
2303 LOperand* context = UseRegisterAtStart(instr->context()); | 2328 LOperand* context = UseRegisterAtStart(instr->context()); |
2304 return new (zone()) LStoreFrameContext(context); | 2329 return new (zone()) LStoreFrameContext(context); |
2305 } | 2330 } |
2306 | 2331 |
2307 } // namespace internal | 2332 } // namespace internal |
2308 } // namespace v8 | 2333 } // namespace v8 |
OLD | NEW |