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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 // an arguments adaptor frame on top of it (if the latter is present). | 905 // an arguments adaptor frame on top of it (if the latter is present). |
906 hydrogen_env = hydrogen_env->outer(); | 906 hydrogen_env = hydrogen_env->outer(); |
907 if (hydrogen_env != nullptr && | 907 if (hydrogen_env != nullptr && |
908 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) { | 908 hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) { |
909 hydrogen_env = hydrogen_env->outer(); | 909 hydrogen_env = hydrogen_env->outer(); |
910 } | 910 } |
911 if (hydrogen_env != nullptr) { | 911 if (hydrogen_env != nullptr) { |
912 // Push return value on top of outer environment. | 912 // Push return value on top of outer environment. |
913 hydrogen_env = hydrogen_env->Copy(); | 913 hydrogen_env = hydrogen_env->Copy(); |
914 hydrogen_env->Push(hydrogen_val); | 914 hydrogen_env->Push(hydrogen_val); |
| 915 } else { |
| 916 // Although we don't need this lazy bailout for normal execution |
| 917 // (because when we tail call from the outermost function we should pop |
| 918 // its frame) we still need it when debugger is on. |
| 919 hydrogen_env = current_block_->last_environment(); |
915 } | 920 } |
916 } else { | 921 } else { |
917 if (hydrogen_val->HasObservableSideEffects()) { | 922 if (hydrogen_val->HasObservableSideEffects()) { |
918 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | 923 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
919 sim->ReplayEnvironment(hydrogen_env); | 924 sim->ReplayEnvironment(hydrogen_env); |
920 hydrogen_value_for_lazy_bailout = sim; | 925 hydrogen_value_for_lazy_bailout = sim; |
921 } | 926 } |
922 } | 927 } |
923 if (hydrogen_env != nullptr) { | 928 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( |
924 // The |hydrogen_env| can be null at this point only if we are generating | 929 new (zone()) LLazyBailout(), hydrogen_env); |
925 // a syntactic tail call from the outermost function but in this case | 930 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
926 // it would be a real tail call which will pop function's frame and | 931 chunk_->AddInstruction(bailout, current_block_); |
927 // therefore this lazy bailout can be skipped. | |
928 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( | |
929 new (zone()) LLazyBailout(), hydrogen_env); | |
930 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | |
931 chunk_->AddInstruction(bailout, current_block_); | |
932 } | |
933 } | 932 } |
934 } | 933 } |
935 | 934 |
936 | 935 |
937 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 936 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
938 return new(zone()) LGoto(instr->FirstSuccessor()); | 937 return new(zone()) LGoto(instr->FirstSuccessor()); |
939 } | 938 } |
940 | 939 |
941 | 940 |
942 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 941 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2631 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2630 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
2632 LOperand* context = UseRegisterAtStart(instr->context()); | 2631 LOperand* context = UseRegisterAtStart(instr->context()); |
2633 return new(zone()) LStoreFrameContext(context); | 2632 return new(zone()) LStoreFrameContext(context); |
2634 } | 2633 } |
2635 | 2634 |
2636 | 2635 |
2637 } // namespace internal | 2636 } // namespace internal |
2638 } // namespace v8 | 2637 } // namespace v8 |
2639 | 2638 |
2640 #endif // V8_TARGET_ARCH_X64 | 2639 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |