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/x87/lithium-x87.h" | 5 #include "src/crankshaft/x87/lithium-x87.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_X87 | 9 #if V8_TARGET_ARCH_X87 |
10 | 10 |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 // TODO(olivf) Since phis of spilled values are joined as registers | 912 // TODO(olivf) Since phis of spilled values are joined as registers |
913 // (not in the stack slot), we need to allow the goto gaps to keep one | 913 // (not in the stack slot), we need to allow the goto gaps to keep one |
914 // x87 register alive. To ensure all other values are still spilled, we | 914 // x87 register alive. To ensure all other values are still spilled, we |
915 // insert a fpu register barrier right before. | 915 // insert a fpu register barrier right before. |
916 LClobberDoubles* clobber = new(zone()) LClobberDoubles(isolate()); | 916 LClobberDoubles* clobber = new(zone()) LClobberDoubles(isolate()); |
917 clobber->set_hydrogen_value(hydrogen_val); | 917 clobber->set_hydrogen_value(hydrogen_val); |
918 chunk_->AddInstruction(clobber, current_block_); | 918 chunk_->AddInstruction(clobber, current_block_); |
919 } | 919 } |
920 chunk_->AddInstruction(instr, current_block_); | 920 chunk_->AddInstruction(instr, current_block_); |
921 | 921 |
922 if (instr->IsCall()) { | 922 CreateLazyBailoutForCall(current_block_, instr, hydrogen_val); |
923 HEnvironment* hydrogen_env = current_block_->last_environment(); | |
924 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | |
925 DCHECK_NOT_NULL(hydrogen_env); | |
926 if (instr->IsSyntacticTailCall()) { | |
927 // If it was a syntactic tail call we need to drop the current frame and | |
928 // all the frames on top of it that are either an arguments adaptor frame | |
929 // or a tail caller frame. | |
930 hydrogen_env = hydrogen_env->outer(); | |
931 while (hydrogen_env != nullptr && | |
932 (hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR || | |
933 hydrogen_env->frame_type() == TAIL_CALLER_FUNCTION)) { | |
934 hydrogen_env = hydrogen_env->outer(); | |
935 } | |
936 if (hydrogen_env != nullptr) { | |
937 // Push return value on top of outer environment. | |
938 hydrogen_env = hydrogen_env->Copy(); | |
939 hydrogen_env->Push(hydrogen_val); | |
940 } else { | |
941 // Although we don't need this lazy bailout for normal execution | |
942 // (because when we tail call from the outermost function we should pop | |
943 // its frame) we still need it when debugger is on. | |
944 hydrogen_env = current_block_->last_environment(); | |
945 } | |
946 } else { | |
947 if (hydrogen_val->HasObservableSideEffects()) { | |
948 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | |
949 sim->ReplayEnvironment(hydrogen_env); | |
950 hydrogen_value_for_lazy_bailout = sim; | |
951 } | |
952 } | |
953 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( | |
954 new (zone()) LLazyBailout(), hydrogen_env); | |
955 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | |
956 chunk_->AddInstruction(bailout, current_block_); | |
957 } | |
958 } | 923 } |
959 | 924 |
960 | 925 |
961 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 926 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
962 LInstruction* result = new (zone()) LPrologue(); | 927 LInstruction* result = new (zone()) LPrologue(); |
963 if (info_->scope()->num_heap_slots() > 0) { | 928 if (info_->scope()->num_heap_slots() > 0) { |
964 result = MarkAsCall(result, instr); | 929 result = MarkAsCall(result, instr); |
965 } | 930 } |
966 return result; | 931 return result; |
967 } | 932 } |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 LOperand* index = UseTempRegister(instr->index()); | 2582 LOperand* index = UseTempRegister(instr->index()); |
2618 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2583 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2619 LInstruction* result = DefineSameAsFirst(load); | 2584 LInstruction* result = DefineSameAsFirst(load); |
2620 return AssignPointerMap(result); | 2585 return AssignPointerMap(result); |
2621 } | 2586 } |
2622 | 2587 |
2623 } // namespace internal | 2588 } // namespace internal |
2624 } // namespace v8 | 2589 } // namespace v8 |
2625 | 2590 |
2626 #endif // V8_TARGET_ARCH_X87 | 2591 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |