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/ia32/lithium-ia32.h" | 5 #include "src/crankshaft/ia32/lithium-ia32.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
10 | 10 |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 583 |
584 LInstruction* LChunkBuilder::DefineFixedDouble( | 584 LInstruction* LChunkBuilder::DefineFixedDouble( |
585 LTemplateResultInstruction<1>* instr, | 585 LTemplateResultInstruction<1>* instr, |
586 XMMRegister reg) { | 586 XMMRegister reg) { |
587 return Define(instr, ToUnallocated(reg)); | 587 return Define(instr, ToUnallocated(reg)); |
588 } | 588 } |
589 | 589 |
590 | 590 |
591 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 591 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
592 HEnvironment* hydrogen_env = current_block_->last_environment(); | 592 HEnvironment* hydrogen_env = current_block_->last_environment(); |
593 int argument_index_accumulator = 0; | 593 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); |
594 ZoneList<HValue*> objects_to_materialize(0, zone()); | |
595 instr->set_environment(CreateEnvironment( | |
596 hydrogen_env, &argument_index_accumulator, &objects_to_materialize)); | |
597 return instr; | |
598 } | 594 } |
599 | 595 |
600 | 596 |
601 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 597 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
602 HInstruction* hinstr, | 598 HInstruction* hinstr, |
603 CanDeoptimize can_deoptimize) { | 599 CanDeoptimize can_deoptimize) { |
604 info()->MarkAsNonDeferredCalling(); | 600 info()->MarkAsNonDeferredCalling(); |
605 | 601 |
606 #ifdef DEBUG | 602 #ifdef DEBUG |
607 instr->VerifyCall(); | 603 instr->VerifyCall(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 | 898 |
903 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 899 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
904 instr = AssignPointerMap(instr); | 900 instr = AssignPointerMap(instr); |
905 } | 901 } |
906 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 902 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
907 instr = AssignEnvironment(instr); | 903 instr = AssignEnvironment(instr); |
908 } | 904 } |
909 chunk_->AddInstruction(instr, current_block_); | 905 chunk_->AddInstruction(instr, current_block_); |
910 | 906 |
911 if (instr->IsCall() || instr->IsPrologue()) { | 907 if (instr->IsCall() || instr->IsPrologue()) { |
| 908 HEnvironment* hydrogen_env = current_block_->last_environment(); |
912 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 909 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
913 if (hydrogen_val->HasObservableSideEffects()) { | 910 DCHECK_NOT_NULL(hydrogen_env); |
914 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | 911 if (instr->IsTailCall()) { |
915 sim->ReplayEnvironment(current_block_->last_environment()); | 912 hydrogen_env = hydrogen_env->outer(); |
916 hydrogen_value_for_lazy_bailout = sim; | 913 if (hydrogen_env != nullptr && |
| 914 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) { |
| 915 hydrogen_env = hydrogen_env->outer(); |
| 916 } |
| 917 } else { |
| 918 if (hydrogen_val->HasObservableSideEffects()) { |
| 919 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 920 sim->ReplayEnvironment(hydrogen_env); |
| 921 hydrogen_value_for_lazy_bailout = sim; |
| 922 } |
917 } | 923 } |
918 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); | 924 if (hydrogen_env != nullptr) { |
919 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | 925 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( |
920 chunk_->AddInstruction(bailout, current_block_); | 926 new (zone()) LLazyBailout(), hydrogen_env); |
| 927 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 928 chunk_->AddInstruction(bailout, current_block_); |
| 929 } |
921 } | 930 } |
922 } | 931 } |
923 | 932 |
924 | 933 |
925 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 934 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
926 return new (zone()) LPrologue(); | 935 return new (zone()) LPrologue(); |
927 } | 936 } |
928 | 937 |
929 | 938 |
930 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 939 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 i < instr->OperandCount(); i++) { | 1096 i < instr->OperandCount(); i++) { |
1088 op = | 1097 op = |
1089 UseFixed(instr->OperandAt(i), | 1098 UseFixed(instr->OperandAt(i), |
1090 descriptor.GetRegisterParameter( | 1099 descriptor.GetRegisterParameter( |
1091 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); | 1100 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); |
1092 ops.Add(op, zone()); | 1101 ops.Add(op, zone()); |
1093 } | 1102 } |
1094 | 1103 |
1095 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( | 1104 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( |
1096 descriptor, ops, zone()); | 1105 descriptor, ops, zone()); |
| 1106 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1107 result->MarkAsTailCall(); |
| 1108 } |
1097 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1109 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1098 } | 1110 } |
1099 | 1111 |
1100 | 1112 |
1101 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1113 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
1102 LOperand* context = UseFixed(instr->context(), esi); | 1114 LOperand* context = UseFixed(instr->context(), esi); |
1103 LOperand* function = UseFixed(instr->function(), edi); | 1115 LOperand* function = UseFixed(instr->function(), edi); |
1104 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1116 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1117 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { |
| 1118 result->MarkAsTailCall(); |
| 1119 } |
1105 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1120 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1106 } | 1121 } |
1107 | 1122 |
1108 | 1123 |
1109 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1124 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1110 switch (instr->op()) { | 1125 switch (instr->op()) { |
1111 case kMathFloor: | 1126 case kMathFloor: |
1112 return DoMathFloor(instr); | 1127 return DoMathFloor(instr); |
1113 case kMathRound: | 1128 case kMathRound: |
1114 return DoMathRound(instr); | 1129 return DoMathRound(instr); |
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2598 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2613 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
2599 LOperand* context = UseRegisterAtStart(instr->context()); | 2614 LOperand* context = UseRegisterAtStart(instr->context()); |
2600 return new(zone()) LStoreFrameContext(context); | 2615 return new(zone()) LStoreFrameContext(context); |
2601 } | 2616 } |
2602 | 2617 |
2603 | 2618 |
2604 } // namespace internal | 2619 } // namespace internal |
2605 } // namespace v8 | 2620 } // namespace v8 |
2606 | 2621 |
2607 #endif // V8_TARGET_ARCH_IA32 | 2622 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |