OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/arm/lithium-arm.h" | 5 #include "src/crankshaft/arm/lithium-arm.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/crankshaft/arm/lithium-codegen-arm.h" | 9 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 539 |
540 | 540 |
541 LInstruction* LChunkBuilder::DefineFixedDouble( | 541 LInstruction* LChunkBuilder::DefineFixedDouble( |
542 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { | 542 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { |
543 return Define(instr, ToUnallocated(reg)); | 543 return Define(instr, ToUnallocated(reg)); |
544 } | 544 } |
545 | 545 |
546 | 546 |
547 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 547 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
548 HEnvironment* hydrogen_env = current_block_->last_environment(); | 548 HEnvironment* hydrogen_env = current_block_->last_environment(); |
549 int argument_index_accumulator = 0; | 549 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); |
550 ZoneList<HValue*> objects_to_materialize(0, zone()); | |
551 instr->set_environment(CreateEnvironment(hydrogen_env, | |
552 &argument_index_accumulator, | |
553 &objects_to_materialize)); | |
554 return instr; | |
555 } | 550 } |
556 | 551 |
557 | 552 |
558 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 553 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
559 HInstruction* hinstr, | 554 HInstruction* hinstr, |
560 CanDeoptimize can_deoptimize) { | 555 CanDeoptimize can_deoptimize) { |
561 info()->MarkAsNonDeferredCalling(); | 556 info()->MarkAsNonDeferredCalling(); |
562 #ifdef DEBUG | 557 #ifdef DEBUG |
563 instr->VerifyCall(); | 558 instr->VerifyCall(); |
564 #endif | 559 #endif |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 | 865 |
871 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 866 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
872 instr = AssignPointerMap(instr); | 867 instr = AssignPointerMap(instr); |
873 } | 868 } |
874 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 869 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
875 instr = AssignEnvironment(instr); | 870 instr = AssignEnvironment(instr); |
876 } | 871 } |
877 chunk_->AddInstruction(instr, current_block_); | 872 chunk_->AddInstruction(instr, current_block_); |
878 | 873 |
879 if (instr->IsCall() || instr->IsPrologue()) { | 874 if (instr->IsCall() || instr->IsPrologue()) { |
| 875 HEnvironment* hydrogen_env = current_block_->last_environment(); |
880 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 876 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
881 if (hydrogen_val->HasObservableSideEffects()) { | 877 DCHECK_NOT_NULL(hydrogen_env); |
882 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | 878 if (instr->IsTailCall()) { |
883 sim->ReplayEnvironment(current_block_->last_environment()); | 879 hydrogen_env = hydrogen_env->outer(); |
884 hydrogen_value_for_lazy_bailout = sim; | 880 if (hydrogen_env != nullptr && |
| 881 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) { |
| 882 hydrogen_env = hydrogen_env->outer(); |
| 883 } |
| 884 } else { |
| 885 if (hydrogen_val->HasObservableSideEffects()) { |
| 886 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 887 sim->ReplayEnvironment(hydrogen_env); |
| 888 hydrogen_value_for_lazy_bailout = sim; |
| 889 } |
885 } | 890 } |
886 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 891 if (hydrogen_env != nullptr) { |
887 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 892 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( |
888 chunk_->AddInstruction(bailout, current_block_); | 893 new (zone()) LLazyBailout(), hydrogen_env); |
| 894 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 895 chunk_->AddInstruction(bailout, current_block_); |
| 896 } |
889 } | 897 } |
890 } | 898 } |
891 | 899 |
892 | 900 |
893 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 901 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
894 return new (zone()) LPrologue(); | 902 return new (zone()) LPrologue(); |
895 } | 903 } |
896 | 904 |
897 | 905 |
898 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 906 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 i < instr->OperandCount(); i++) { | 1062 i < instr->OperandCount(); i++) { |
1055 op = | 1063 op = |
1056 UseFixed(instr->OperandAt(i), | 1064 UseFixed(instr->OperandAt(i), |
1057 descriptor.GetRegisterParameter( | 1065 descriptor.GetRegisterParameter( |
1058 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); | 1066 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); |
1059 ops.Add(op, zone()); | 1067 ops.Add(op, zone()); |
1060 } | 1068 } |
1061 | 1069 |
1062 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( | 1070 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( |
1063 descriptor, ops, zone()); | 1071 descriptor, ops, zone()); |
| 1072 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1073 result->MarkAsTailCall(); |
| 1074 } |
1064 return MarkAsCall(DefineFixed(result, r0), instr); | 1075 return MarkAsCall(DefineFixed(result, r0), instr); |
1065 } | 1076 } |
1066 | 1077 |
1067 | 1078 |
1068 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1079 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
1069 LOperand* context = UseFixed(instr->context(), cp); | 1080 LOperand* context = UseFixed(instr->context(), cp); |
1070 LOperand* function = UseFixed(instr->function(), r1); | 1081 LOperand* function = UseFixed(instr->function(), r1); |
1071 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1082 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1083 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1084 result->MarkAsTailCall(); |
| 1085 } |
1072 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1086 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1073 } | 1087 } |
1074 | 1088 |
1075 | 1089 |
1076 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1090 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1077 switch (instr->op()) { | 1091 switch (instr->op()) { |
1078 case kMathFloor: | 1092 case kMathFloor: |
1079 return DoMathFloor(instr); | 1093 return DoMathFloor(instr); |
1080 case kMathRound: | 1094 case kMathRound: |
1081 return DoMathRound(instr); | 1095 return DoMathRound(instr); |
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2543 } | 2557 } |
2544 | 2558 |
2545 | 2559 |
2546 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2560 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
2547 LOperand* context = UseRegisterAtStart(instr->context()); | 2561 LOperand* context = UseRegisterAtStart(instr->context()); |
2548 return new(zone()) LStoreFrameContext(context); | 2562 return new(zone()) LStoreFrameContext(context); |
2549 } | 2563 } |
2550 | 2564 |
2551 } // namespace internal | 2565 } // namespace internal |
2552 } // namespace v8 | 2566 } // namespace v8 |
OLD | NEW |