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

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

Issue 1780043004: [crankshaft] Fixing ES6 tail call elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ignition crash is not related to TCE, issue number updated 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
OLDNEW
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/mips64/lithium-mips64.h" 5 #include "src/crankshaft/mips64/lithium-mips64.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #if V8_TARGET_ARCH_MIPS64 9 #if V8_TARGET_ARCH_MIPS64
10 10
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 547
548 LInstruction* LChunkBuilder::DefineFixedDouble( 548 LInstruction* LChunkBuilder::DefineFixedDouble(
549 LTemplateResultInstruction<1>* instr, DoubleRegister reg) { 549 LTemplateResultInstruction<1>* instr, DoubleRegister reg) {
550 return Define(instr, ToUnallocated(reg)); 550 return Define(instr, ToUnallocated(reg));
551 } 551 }
552 552
553 553
554 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { 554 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
555 HEnvironment* hydrogen_env = current_block_->last_environment(); 555 HEnvironment* hydrogen_env = current_block_->last_environment();
556 int argument_index_accumulator = 0; 556 return LChunkBuilderBase::AssignEnvironment(instr, hydrogen_env);
557 ZoneList<HValue*> objects_to_materialize(0, zone());
558 instr->set_environment(CreateEnvironment(hydrogen_env,
559 &argument_index_accumulator,
560 &objects_to_materialize));
561 return instr;
562 } 557 }
563 558
564 559
565 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, 560 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
566 HInstruction* hinstr, 561 HInstruction* hinstr,
567 CanDeoptimize can_deoptimize) { 562 CanDeoptimize can_deoptimize) {
568 info()->MarkAsNonDeferredCalling(); 563 info()->MarkAsNonDeferredCalling();
569 #ifdef DEBUG 564 #ifdef DEBUG
570 instr->VerifyCall(); 565 instr->VerifyCall();
571 #endif 566 #endif
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 875
881 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 876 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
882 instr = AssignPointerMap(instr); 877 instr = AssignPointerMap(instr);
883 } 878 }
884 if (FLAG_stress_environments && !instr->HasEnvironment()) { 879 if (FLAG_stress_environments && !instr->HasEnvironment()) {
885 instr = AssignEnvironment(instr); 880 instr = AssignEnvironment(instr);
886 } 881 }
887 chunk_->AddInstruction(instr, current_block_); 882 chunk_->AddInstruction(instr, current_block_);
888 883
889 if (instr->IsCall() || instr->IsPrologue()) { 884 if (instr->IsCall() || instr->IsPrologue()) {
885 HEnvironment* hydrogen_env = current_block_->last_environment();
890 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; 886 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
891 if (hydrogen_val->HasObservableSideEffects()) { 887 DCHECK_NOT_NULL(hydrogen_env);
892 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); 888 if (instr->IsTailCall()) {
893 sim->ReplayEnvironment(current_block_->last_environment()); 889 hydrogen_env = hydrogen_env->outer();
894 hydrogen_value_for_lazy_bailout = sim; 890 if (hydrogen_env != nullptr &&
891 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) {
892 hydrogen_env = hydrogen_env->outer();
893 }
894 } else {
895 if (hydrogen_val->HasObservableSideEffects()) {
896 HSimulate* sim = HSimulate::cast(hydrogen_val->next());
897 sim->ReplayEnvironment(hydrogen_env);
898 hydrogen_value_for_lazy_bailout = sim;
899 }
895 } 900 }
896 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); 901 if (hydrogen_env != nullptr) {
897 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); 902 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment(
898 chunk_->AddInstruction(bailout, current_block_); 903 new (zone()) LLazyBailout(), hydrogen_env);
904 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
905 chunk_->AddInstruction(bailout, current_block_);
906 }
899 } 907 }
900 } 908 }
901 909
902 910
903 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { 911 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) {
904 return new (zone()) LPrologue(); 912 return new (zone()) LPrologue();
905 } 913 }
906 914
907 915
908 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 916 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 i < instr->OperandCount(); i++) { 1067 i < instr->OperandCount(); i++) {
1060 op = 1068 op =
1061 UseFixed(instr->OperandAt(i), 1069 UseFixed(instr->OperandAt(i),
1062 descriptor.GetRegisterParameter( 1070 descriptor.GetRegisterParameter(
1063 i - LCallWithDescriptor::kImplicitRegisterParameterCount)); 1071 i - LCallWithDescriptor::kImplicitRegisterParameterCount));
1064 ops.Add(op, zone()); 1072 ops.Add(op, zone());
1065 } 1073 }
1066 1074
1067 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor( 1075 LCallWithDescriptor* result = new(zone()) LCallWithDescriptor(
1068 descriptor, ops, zone()); 1076 descriptor, ops, zone());
1077 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) {
1078 result->MarkAsTailCall();
1079 }
1069 return MarkAsCall(DefineFixed(result, v0), instr); 1080 return MarkAsCall(DefineFixed(result, v0), instr);
1070 } 1081 }
1071 1082
1072 1083
1073 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1084 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1074 LOperand* context = UseFixed(instr->context(), cp); 1085 LOperand* context = UseFixed(instr->context(), cp);
1075 LOperand* function = UseFixed(instr->function(), a1); 1086 LOperand* function = UseFixed(instr->function(), a1);
1076 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); 1087 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function);
1088 if (instr->syntactic_tail_call_mode() == TailCallMode::kAllow) {
1089 result->MarkAsTailCall();
1090 }
1077 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1091 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1078 } 1092 }
1079 1093
1080 1094
1081 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1095 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1082 switch (instr->op()) { 1096 switch (instr->op()) {
1083 case kMathFloor: 1097 case kMathFloor:
1084 return DoMathFloor(instr); 1098 return DoMathFloor(instr);
1085 case kMathRound: 1099 case kMathRound:
1086 return DoMathRound(instr); 1100 return DoMathRound(instr);
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { 2512 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) {
2499 LOperand* context = UseRegisterAtStart(instr->context()); 2513 LOperand* context = UseRegisterAtStart(instr->context());
2500 return new(zone()) LStoreFrameContext(context); 2514 return new(zone()) LStoreFrameContext(context);
2501 } 2515 }
2502 2516
2503 2517
2504 } // namespace internal 2518 } // namespace internal
2505 } // namespace v8 2519 } // namespace v8
2506 2520
2507 #endif // V8_TARGET_ARCH_MIPS64 2521 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698