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 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env); | 593 int argument_index_accumulator = 0; |
| 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; |
594 } | 598 } |
595 | 599 |
596 | 600 |
597 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 601 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
598 HInstruction* hinstr, | 602 HInstruction* hinstr, |
599 CanDeoptimize can_deoptimize) { | 603 CanDeoptimize can_deoptimize) { |
600 info()->MarkAsNonDeferredCalling(); | 604 info()->MarkAsNonDeferredCalling(); |
601 | 605 |
602 #ifdef DEBUG | 606 #ifdef DEBUG |
603 instr->VerifyCall(); | 607 instr->VerifyCall(); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 902 |
899 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 903 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
900 instr = AssignPointerMap(instr); | 904 instr = AssignPointerMap(instr); |
901 } | 905 } |
902 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 906 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
903 instr = AssignEnvironment(instr); | 907 instr = AssignEnvironment(instr); |
904 } | 908 } |
905 chunk_->AddInstruction(instr, current_block_); | 909 chunk_->AddInstruction(instr, current_block_); |
906 | 910 |
907 if (instr->IsCall()) { | 911 if (instr->IsCall()) { |
908 HEnvironment* hydrogen_env = current_block_->last_environment(); | |
909 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 912 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
910 DCHECK_NOT_NULL(hydrogen_env); | 913 if (hydrogen_val->HasObservableSideEffects()) { |
911 if (instr->IsTailCall()) { | 914 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
912 hydrogen_env = hydrogen_env->outer(); | 915 sim->ReplayEnvironment(current_block_->last_environment()); |
913 if (hydrogen_env != nullptr && | 916 hydrogen_value_for_lazy_bailout = sim; |
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 } | |
923 } | 917 } |
924 if (hydrogen_env != nullptr) { | 918 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
925 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( | 919 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
926 new (zone()) LLazyBailout(), hydrogen_env); | 920 chunk_->AddInstruction(bailout, current_block_); |
927 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | |
928 chunk_->AddInstruction(bailout, current_block_); | |
929 } | |
930 } | 921 } |
931 } | 922 } |
932 | 923 |
933 | 924 |
934 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 925 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
935 LInstruction* result = new (zone()) LPrologue(); | 926 LInstruction* result = new (zone()) LPrologue(); |
936 if (info_->num_heap_slots() > 0) { | 927 if (info_->num_heap_slots() > 0) { |
937 result = MarkAsCall(result, instr); | 928 result = MarkAsCall(result, instr); |
938 } | 929 } |
939 return result; | 930 return result; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 i < instr->OperandCount(); i++) { | 1091 i < instr->OperandCount(); i++) { |
1101 op = | 1092 op = |
1102 UseFixed(instr->OperandAt(i), | 1093 UseFixed(instr->OperandAt(i), |
1103 descriptor.GetRegisterParameter( | 1094 descriptor.GetRegisterParameter( |
1104 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); | 1095 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); |
1105 ops.Add(op, zone()); | 1096 ops.Add(op, zone()); |
1106 } | 1097 } |
1107 | 1098 |
1108 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( | 1099 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( |
1109 descriptor, ops, zone()); | 1100 descriptor, ops, zone()); |
1110 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { | |
1111 result->MarkAsTailCall(); | |
1112 } | |
1113 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1101 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1114 } | 1102 } |
1115 | 1103 |
1116 | 1104 |
1117 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1105 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
1118 LOperand* context = UseFixed(instr->context(), esi); | 1106 LOperand* context = UseFixed(instr->context(), esi); |
1119 LOperand* function = UseFixed(instr->function(), edi); | 1107 LOperand* function = UseFixed(instr->function(), edi); |
1120 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); | 1108 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
1121 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) { | |
1122 result->MarkAsTailCall(); | |
1123 } | |
1124 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1109 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1125 } | 1110 } |
1126 | 1111 |
1127 | 1112 |
1128 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1113 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1129 switch (instr->op()) { | 1114 switch (instr->op()) { |
1130 case kMathFloor: | 1115 case kMathFloor: |
1131 return DoMathFloor(instr); | 1116 return DoMathFloor(instr); |
1132 case kMathRound: | 1117 case kMathRound: |
1133 return DoMathRound(instr); | 1118 return DoMathRound(instr); |
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2602 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
2618 LOperand* context = UseRegisterAtStart(instr->context()); | 2603 LOperand* context = UseRegisterAtStart(instr->context()); |
2619 return new(zone()) LStoreFrameContext(context); | 2604 return new(zone()) LStoreFrameContext(context); |
2620 } | 2605 } |
2621 | 2606 |
2622 | 2607 |
2623 } // namespace internal | 2608 } // namespace internal |
2624 } // namespace v8 | 2609 } // namespace v8 |
2625 | 2610 |
2626 #endif // V8_TARGET_ARCH_IA32 | 2611 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |