| 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 #endif | 889 #endif |
| 890 | 890 |
| 891 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 891 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 892 instr = AssignPointerMap(instr); | 892 instr = AssignPointerMap(instr); |
| 893 } | 893 } |
| 894 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 894 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 895 instr = AssignEnvironment(instr); | 895 instr = AssignEnvironment(instr); |
| 896 } | 896 } |
| 897 chunk_->AddInstruction(instr, current_block_); | 897 chunk_->AddInstruction(instr, current_block_); |
| 898 | 898 |
| 899 if (instr->IsCall()) { | 899 CreateLazyBailoutForCall(current_block_, instr, hydrogen_val); |
| 900 HEnvironment* hydrogen_env = current_block_->last_environment(); | |
| 901 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | |
| 902 DCHECK_NOT_NULL(hydrogen_env); | |
| 903 if (instr->IsSyntacticTailCall()) { | |
| 904 // If it was a syntactic tail call we need to drop the current frame and | |
| 905 // all the frames on top of it that are either an arguments adaptor frame | |
| 906 // or a tail caller frame. | |
| 907 hydrogen_env = hydrogen_env->outer(); | |
| 908 while (hydrogen_env != nullptr && | |
| 909 (hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR || | |
| 910 hydrogen_env->frame_type() == TAIL_CALLER_FUNCTION)) { | |
| 911 hydrogen_env = hydrogen_env->outer(); | |
| 912 } | |
| 913 if (hydrogen_env != nullptr) { | |
| 914 // Push return value on top of outer environment. | |
| 915 hydrogen_env = hydrogen_env->Copy(); | |
| 916 hydrogen_env->Push(hydrogen_val); | |
| 917 } else { | |
| 918 // Although we don't need this lazy bailout for normal execution | |
| 919 // (because when we tail call from the outermost function we should pop | |
| 920 // its frame) we still need it when debugger is on. | |
| 921 hydrogen_env = current_block_->last_environment(); | |
| 922 } | |
| 923 } else { | |
| 924 if (hydrogen_val->HasObservableSideEffects()) { | |
| 925 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | |
| 926 sim->ReplayEnvironment(hydrogen_env); | |
| 927 hydrogen_value_for_lazy_bailout = sim; | |
| 928 } | |
| 929 } | |
| 930 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( | |
| 931 new (zone()) LLazyBailout(), hydrogen_env); | |
| 932 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | |
| 933 chunk_->AddInstruction(bailout, current_block_); | |
| 934 } | |
| 935 } | 900 } |
| 936 | 901 |
| 937 | 902 |
| 938 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 903 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 939 return new(zone()) LGoto(instr->FirstSuccessor()); | 904 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 940 } | 905 } |
| 941 | 906 |
| 942 | 907 |
| 943 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 908 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
| 944 LInstruction* result = new (zone()) LPrologue(); | 909 LInstruction* result = new (zone()) LPrologue(); |
| (...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 LOperand* index = UseTempRegister(instr->index()); | 2592 LOperand* index = UseTempRegister(instr->index()); |
| 2628 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2593 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
| 2629 LInstruction* result = DefineSameAsFirst(load); | 2594 LInstruction* result = DefineSameAsFirst(load); |
| 2630 return AssignPointerMap(result); | 2595 return AssignPointerMap(result); |
| 2631 } | 2596 } |
| 2632 | 2597 |
| 2633 } // namespace internal | 2598 } // namespace internal |
| 2634 } // namespace v8 | 2599 } // namespace v8 |
| 2635 | 2600 |
| 2636 #endif // V8_TARGET_ARCH_X64 | 2601 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |