Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: src/crankshaft/ppc/lithium-ppc.cc

Issue 1825513002: PPC: [crankshaft] Fixing ES6 tail call elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/crankshaft/ppc/lithium-ppc.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ppc/lithium-ppc.h" 5 #include "src/crankshaft/ppc/lithium-ppc.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/crankshaft/hydrogen-osr.h" 9 #include "src/crankshaft/hydrogen-osr.h"
10 #include "src/crankshaft/lithium-inl.h" 10 #include "src/crankshaft/lithium-inl.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 552
553 553
554 LInstruction* LChunkBuilder::DefineFixedDouble( 554 LInstruction* LChunkBuilder::DefineFixedDouble(
555 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { 555 LTemplateResultInstruction<1>* instr, DoubleRegister reg) {
556 return Define(instr, ToUnallocated(reg)); 556 return Define(instr, ToUnallocated(reg));
557 } 557 }
558 558
559 559
560 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { 560 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
561 HEnvironment* hydrogen_env = current_block_->last_environment(); 561 HEnvironment* hydrogen_env = current_block_->last_environment();
562 int argument_index_accumulator = 0; 562 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env);
563 ZoneList<HValue*> objects_to_materialize(0, zone());
564 instr->set_environment(CreateEnvironment(
565 hydrogen_env, &argument_index_accumulator, &objects_to_materialize));
566 return instr;
567 } 563 }
568 564
569 565
570 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, 566 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
571 HInstruction* hinstr, 567 HInstruction* hinstr,
572 CanDeoptimize can_deoptimize) { 568 CanDeoptimize can_deoptimize) {
573 info()->MarkAsNonDeferredCalling(); 569 info()->MarkAsNonDeferredCalling();
574 #ifdef DEBUG 570 #ifdef DEBUG
575 instr->VerifyCall(); 571 instr->VerifyCall();
576 #endif 572 #endif
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 880
885 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 881 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
886 instr = AssignPointerMap(instr); 882 instr = AssignPointerMap(instr);
887 } 883 }
888 if (FLAG_stress_environments && !instr->HasEnvironment()) { 884 if (FLAG_stress_environments && !instr->HasEnvironment()) {
889 instr = AssignEnvironment(instr); 885 instr = AssignEnvironment(instr);
890 } 886 }
891 chunk_->AddInstruction(instr, current_block_); 887 chunk_->AddInstruction(instr, current_block_);
892 888
893 if (instr->IsCall()) { 889 if (instr->IsCall()) {
890 HEnvironment* hydrogen_env = current_block_->last_environment();
894 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; 891 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
895 if (hydrogen_val->HasObservableSideEffects()) { 892 DCHECK_NOT_NULL(hydrogen_env);
896 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); 893 if (instr->IsSyntacticTailCall()) {
897 sim->ReplayEnvironment(current_block_->last_environment()); 894 // If it was a syntactic tail call we need to drop the current frame and
898 hydrogen_value_for_lazy_bailout = sim; 895 // an arguments adaptor frame on top of it (if the latter is present).
896 hydrogen_env = hydrogen_env->outer();
897 if (hydrogen_env != nullptr &&
898 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) {
899 hydrogen_env = hydrogen_env->outer();
900 }
901 if (hydrogen_env != nullptr) {
902 // Push return value on top of outer environment.
903 hydrogen_env = hydrogen_env->Copy();
904 hydrogen_env->Push(hydrogen_val);
905 } else {
906 // Although we don't need this lazy bailout for normal execution
907 // (because when we tail call from the outermost function we should pop
908 // its frame) we still need it when debugger is on.
909 hydrogen_env = current_block_->last_environment();
910 }
911 } else {
912 if (hydrogen_val->HasObservableSideEffects()) {
913 HSimulate* sim = HSimulate::cast(hydrogen_val->next());
914 sim->ReplayEnvironment(hydrogen_env);
915 hydrogen_value_for_lazy_bailout = sim;
916 }
899 } 917 }
900 LInstruction* bailout = AssignEnvironment(new (zone()) LLazyBailout()); 918 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment(
919 new (zone()) LLazyBailout(), hydrogen_env);
901 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); 920 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
902 chunk_->AddInstruction(bailout, current_block_); 921 chunk_->AddInstruction(bailout, current_block_);
903 } 922 }
904 } 923 }
905 924
906 925
907 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { 926 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) {
908 LInstruction* result = new (zone()) LPrologue(); 927 LInstruction* result = new (zone()) LPrologue();
909 if (info_->num_heap_slots() > 0) { 928 if (info_->num_heap_slots() > 0) {
910 result = MarkAsCall(result, instr); 929 result = MarkAsCall(result, instr);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 i < instr->OperandCount(); i++) { 1087 i < instr->OperandCount(); i++) {
1069 op = 1088 op =
1070 UseFixed(instr->OperandAt(i), 1089 UseFixed(instr->OperandAt(i),
1071 descriptor.GetRegisterParameter( 1090 descriptor.GetRegisterParameter(
1072 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); 1091 i - LCallWithDescriptor::kImplicitRegisterParameterCount));
1073 ops.Add(op, zone()); 1092 ops.Add(op, zone());
1074 } 1093 }
1075 1094
1076 LCallWithDescriptor* result = 1095 LCallWithDescriptor* result =
1077 new (zone()) LCallWithDescriptor(descriptor, ops, zone()); 1096 new (zone()) LCallWithDescriptor(descriptor, ops, zone());
1097 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) {
1098 result->MarkAsSyntacticTailCall();
1099 }
1078 return MarkAsCall(DefineFixed(result, r3), instr); 1100 return MarkAsCall(DefineFixed(result, r3), instr);
1079 } 1101 }
1080 1102
1081 1103
1082 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1104 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1083 LOperand* context = UseFixed(instr->context(), cp); 1105 LOperand* context = UseFixed(instr->context(), cp);
1084 LOperand* function = UseFixed(instr->function(), r4); 1106 LOperand* function = UseFixed(instr->function(), r4);
1085 LInvokeFunction* result = new (zone()) LInvokeFunction(context, function); 1107 LInvokeFunction* result = new (zone()) LInvokeFunction(context, function);
1108 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) {
1109 result->MarkAsSyntacticTailCall();
1110 }
1086 return MarkAsCall(DefineFixed(result, r3), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1111 return MarkAsCall(DefineFixed(result, r3), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1087 } 1112 }
1088 1113
1089 1114
1090 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1115 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1091 switch (instr->op()) { 1116 switch (instr->op()) {
1092 case kMathFloor: 1117 case kMathFloor:
1093 return DoMathFloor(instr); 1118 return DoMathFloor(instr);
1094 case kMathRound: 1119 case kMathRound:
1095 return DoMathRound(instr); 1120 return DoMathRound(instr);
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 } 2518 }
2494 2519
2495 2520
2496 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { 2521 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) {
2497 LOperand* context = UseRegisterAtStart(instr->context()); 2522 LOperand* context = UseRegisterAtStart(instr->context());
2498 return new (zone()) LStoreFrameContext(context); 2523 return new (zone()) LStoreFrameContext(context);
2499 } 2524 }
2500 2525
2501 } // namespace internal 2526 } // namespace internal
2502 } // namespace v8 2527 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/ppc/lithium-ppc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698