| 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 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); | 584 int argument_index_accumulator = 0; |
| 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; |
| 585 } | 589 } |
| 586 | 590 |
| 587 | 591 |
| 588 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 592 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
| 589 HInstruction* hinstr, | 593 HInstruction* hinstr, |
| 590 CanDeoptimize can_deoptimize) { | 594 CanDeoptimize can_deoptimize) { |
| 591 info()->MarkAsNonDeferredCalling(); | 595 info()->MarkAsNonDeferredCalling(); |
| 592 | 596 |
| 593 #ifdef DEBUG | 597 #ifdef DEBUG |
| 594 instr->VerifyCall(); | 598 instr->VerifyCall(); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 | 894 |
| 891 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 895 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 892 instr = AssignPointerMap(instr); | 896 instr = AssignPointerMap(instr); |
| 893 } | 897 } |
| 894 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 898 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 895 instr = AssignEnvironment(instr); | 899 instr = AssignEnvironment(instr); |
| 896 } | 900 } |
| 897 chunk_->AddInstruction(instr, current_block_); | 901 chunk_->AddInstruction(instr, current_block_); |
| 898 | 902 |
| 899 if (instr->IsCall()) { | 903 if (instr->IsCall()) { |
| 900 HEnvironment* hydrogen_env = current_block_->last_environment(); | |
| 901 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 904 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
| 902 DCHECK_NOT_NULL(hydrogen_env); | 905 if (hydrogen_val->HasObservableSideEffects()) { |
| 903 if (instr->IsTailCall()) { | 906 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
| 904 hydrogen_env = hydrogen_env->outer(); | 907 sim->ReplayEnvironment(current_block_->last_environment()); |
| 905 if (hydrogen_env != nullptr && | 908 hydrogen_value_for_lazy_bailout = sim; |
| 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 } | |
| 915 } | 909 } |
| 916 if (hydrogen_env != nullptr) { | 910 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
| 917 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( | 911 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 918 new (zone()) LLazyBailout(), hydrogen_env); | 912 chunk_->AddInstruction(bailout, current_block_); |
| 919 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | |
| 920 chunk_->AddInstruction(bailout, current_block_); | |
| 921 } | |
| 922 } | 913 } |
| 923 } | 914 } |
| 924 | 915 |
| 925 | 916 |
| 926 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 917 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 927 return new(zone()) LGoto(instr->FirstSuccessor()); | 918 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 928 } | 919 } |
| 929 | 920 |
| 930 | 921 |
| 931 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 922 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 i < instr->OperandCount(); i++) { | 1080 i < instr->OperandCount(); i++) { |
| 1090 op = | 1081 op = |
| 1091 UseFixed(instr->OperandAt(i), | 1082 UseFixed(instr->OperandAt(i), |
| 1092 descriptor.GetRegisterParameter( | 1083 descriptor.GetRegisterParameter( |
| 1093 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); | 1084 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); |
| 1094 ops.Add(op, zone()); | 1085 ops.Add(op, zone()); |
| 1095 } | 1086 } |
| 1096 | 1087 |
| 1097 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( | 1088 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( |
| 1098 descriptor, ops, zone()); | 1089 descriptor, ops, zone()); |
| 1099 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { | |
| 1100 result->MarkAsTailCall(); | |
| 1101 } | |
| 1102 return MarkAsCall(DefineFixed(result, rax), instr); | 1090 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1103 } | 1091 } |
| 1104 | 1092 |
| 1105 | 1093 |
| 1106 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1094 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1107 LOperand* context = UseFixed(instr->context(), rsi); | 1095 LOperand* context = UseFixed(instr->context(), rsi); |
| 1108 LOperand* function = UseFixed(instr->function(), rdi); | 1096 LOperand* function = UseFixed(instr->function(), rdi); |
| 1109 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1097 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
| 1110 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { | |
| 1111 result->MarkAsTailCall(); | |
| 1112 } | |
| 1113 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1098 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1114 } | 1099 } |
| 1115 | 1100 |
| 1116 | 1101 |
| 1117 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1102 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1118 switch (instr->op()) { | 1103 switch (instr->op()) { |
| 1119 case kMathFloor: | 1104 case kMathFloor: |
| 1120 return DoMathFloor(instr); | 1105 return DoMathFloor(instr); |
| 1121 case kMathRound: | 1106 case kMathRound: |
| 1122 return DoMathRound(instr); | 1107 return DoMathRound(instr); |
| (...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2620 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2605 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
| 2621 LOperand* context = UseRegisterAtStart(instr->context()); | 2606 LOperand* context = UseRegisterAtStart(instr->context()); |
| 2622 return new(zone()) LStoreFrameContext(context); | 2607 return new(zone()) LStoreFrameContext(context); |
| 2623 } | 2608 } |
| 2624 | 2609 |
| 2625 | 2610 |
| 2626 } // namespace internal | 2611 } // namespace internal |
| 2627 } // namespace v8 | 2612 } // namespace v8 |
| 2628 | 2613 |
| 2629 #endif // V8_TARGET_ARCH_X64 | 2614 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |