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/x64/lithium-x64.h" | 5 #include "src/crankshaft/x64/lithium-x64.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
10 | 10 |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 574 |
575 LInstruction* LChunkBuilder::DefineFixedDouble( | 575 LInstruction* LChunkBuilder::DefineFixedDouble( |
576 LTemplateResultInstruction<1>* instr, | 576 LTemplateResultInstruction<1>* instr, |
577 XMMRegister reg) { | 577 XMMRegister reg) { |
578 return Define(instr, ToUnallocated(reg)); | 578 return Define(instr, ToUnallocated(reg)); |
579 } | 579 } |
580 | 580 |
581 | 581 |
582 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 582 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
583 HEnvironment* hydrogen_env = current_block_->last_environment(); | 583 HEnvironment* hydrogen_env = current_block_->last_environment(); |
584 int argument_index_accumulator = 0; | 584 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); |
585 ZoneList<HValue*> objects_to_materialize(0, zone()); | |
586 instr->set_environment(CreateEnvironment( | |
587 hydrogen_env, &argument_index_accumulator, &objects_to_materialize)); | |
588 return instr; | |
589 } | 585 } |
590 | 586 |
591 | 587 |
592 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 588 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
593 HInstruction* hinstr, | 589 HInstruction* hinstr, |
594 CanDeoptimize can_deoptimize) { | 590 CanDeoptimize can_deoptimize) { |
595 info()->MarkAsNonDeferredCalling(); | 591 info()->MarkAsNonDeferredCalling(); |
596 | 592 |
597 #ifdef DEBUG | 593 #ifdef DEBUG |
598 instr->VerifyCall(); | 594 instr->VerifyCall(); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 890 |
895 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 891 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
896 instr = AssignPointerMap(instr); | 892 instr = AssignPointerMap(instr); |
897 } | 893 } |
898 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 894 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
899 instr = AssignEnvironment(instr); | 895 instr = AssignEnvironment(instr); |
900 } | 896 } |
901 chunk_->AddInstruction(instr, current_block_); | 897 chunk_->AddInstruction(instr, current_block_); |
902 | 898 |
903 if (instr->IsCall() || instr->IsPrologue()) { | 899 if (instr->IsCall() || instr->IsPrologue()) { |
| 900 HEnvironment* hydrogen_env = current_block_->last_environment(); |
904 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 901 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
905 if (hydrogen_val->HasObservableSideEffects()) { | 902 DCHECK_NOT_NULL(hydrogen_env); |
906 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | 903 if (instr->IsTailCall()) { |
907 sim->ReplayEnvironment(current_block_->last_environment()); | 904 hydrogen_env = hydrogen_env->outer(); |
908 hydrogen_value_for_lazy_bailout = sim; | 905 if (hydrogen_env != nullptr && |
| 906 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) { |
| 907 hydrogen_env = hydrogen_env->outer(); |
| 908 } |
| 909 } else { |
| 910 if (hydrogen_val->HasObservableSideEffects()) { |
| 911 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 912 sim->ReplayEnvironment(hydrogen_env); |
| 913 hydrogen_value_for_lazy_bailout = sim; |
| 914 } |
909 } | 915 } |
910 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 916 if (hydrogen_env != nullptr) { |
911 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 917 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( |
912 chunk_->AddInstruction(bailout, current_block_); | 918 new (zone()) LLazyBailout(), hydrogen_env); |
| 919 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 920 chunk_->AddInstruction(bailout, current_block_); |
| 921 } |
913 } | 922 } |
914 } | 923 } |
915 | 924 |
916 | 925 |
917 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 926 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
918 return new(zone()) LGoto(instr->FirstSuccessor()); | 927 return new(zone()) LGoto(instr->FirstSuccessor()); |
919 } | 928 } |
920 | 929 |
921 | 930 |
922 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 931 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 i < instr->OperandCount(); i++) { | 1085 i < instr->OperandCount(); i++) { |
1077 op = | 1086 op = |
1078 UseFixed(instr->OperandAt(i), | 1087 UseFixed(instr->OperandAt(i), |
1079 descriptor.GetRegisterParameter( | 1088 descriptor.GetRegisterParameter( |
1080 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); | 1089 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); |
1081 ops.Add(op, zone()); | 1090 ops.Add(op, zone()); |
1082 } | 1091 } |
1083 | 1092 |
1084 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( | 1093 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( |
1085 descriptor, ops, zone()); | 1094 descriptor, ops, zone()); |
| 1095 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1096 result->MarkAsTailCall(); |
| 1097 } |
1086 return MarkAsCall(DefineFixed(result, rax), instr); | 1098 return MarkAsCall(DefineFixed(result, rax), instr); |
1087 } | 1099 } |
1088 | 1100 |
1089 | 1101 |
1090 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1102 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
1091 LOperand* context = UseFixed(instr->context(), rsi); | 1103 LOperand* context = UseFixed(instr->context(), rsi); |
1092 LOperand* function = UseFixed(instr->function(), rdi); | 1104 LOperand* function = UseFixed(instr->function(), rdi); |
1093 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1105 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1106 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1107 result->MarkAsTailCall(); |
| 1108 } |
1094 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1109 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1095 } | 1110 } |
1096 | 1111 |
1097 | 1112 |
1098 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1113 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1099 switch (instr->op()) { | 1114 switch (instr->op()) { |
1100 case kMathFloor: | 1115 case kMathFloor: |
1101 return DoMathFloor(instr); | 1116 return DoMathFloor(instr); |
1102 case kMathRound: | 1117 case kMathRound: |
1103 return DoMathRound(instr); | 1118 return DoMathRound(instr); |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2601 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2616 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
2602 LOperand* context = UseRegisterAtStart(instr->context()); | 2617 LOperand* context = UseRegisterAtStart(instr->context()); |
2603 return new(zone()) LStoreFrameContext(context); | 2618 return new(zone()) LStoreFrameContext(context); |
2604 } | 2619 } |
2605 | 2620 |
2606 | 2621 |
2607 } // namespace internal | 2622 } // namespace internal |
2608 } // namespace v8 | 2623 } // namespace v8 |
2609 | 2624 |
2610 #endif // V8_TARGET_ARCH_X64 | 2625 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |