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/ia32/lithium-ia32.h" | 5 #include "src/crankshaft/ia32/lithium-ia32.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
10 | 10 |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 #endif | 897 #endif |
898 | 898 |
899 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 899 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
900 instr = AssignPointerMap(instr); | 900 instr = AssignPointerMap(instr); |
901 } | 901 } |
902 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 902 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
903 instr = AssignEnvironment(instr); | 903 instr = AssignEnvironment(instr); |
904 } | 904 } |
905 chunk_->AddInstruction(instr, current_block_); | 905 chunk_->AddInstruction(instr, current_block_); |
906 | 906 |
907 if (instr->IsCall()) { | 907 CreateLazyBailoutForCall(current_block_, instr, hydrogen_val); |
908 HEnvironment* hydrogen_env = current_block_->last_environment(); | |
909 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | |
910 DCHECK_NOT_NULL(hydrogen_env); | |
911 if (instr->IsSyntacticTailCall()) { | |
912 // If it was a syntactic tail call we need to drop the current frame and | |
913 // all the frames on top of it that are either an arguments adaptor frame | |
914 // or a tail caller frame. | |
915 hydrogen_env = hydrogen_env->outer(); | |
916 while (hydrogen_env != nullptr && | |
917 (hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR || | |
918 hydrogen_env->frame_type() == TAIL_CALLER_FUNCTION)) { | |
919 hydrogen_env = hydrogen_env->outer(); | |
920 } | |
921 if (hydrogen_env != nullptr) { | |
922 // Push return value on top of outer environment. | |
923 hydrogen_env = hydrogen_env->Copy(); | |
924 hydrogen_env->Push(hydrogen_val); | |
925 } else { | |
926 // Although we don't need this lazy bailout for normal execution | |
927 // (because when we tail call from the outermost function we should pop | |
928 // its frame) we still need it when debugger is on. | |
929 hydrogen_env = current_block_->last_environment(); | |
930 } | |
931 } else { | |
932 if (hydrogen_val->HasObservableSideEffects()) { | |
933 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | |
934 sim->ReplayEnvironment(hydrogen_env); | |
935 hydrogen_value_for_lazy_bailout = sim; | |
936 } | |
937 } | |
938 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( | |
939 new (zone()) LLazyBailout(), hydrogen_env); | |
940 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | |
941 chunk_->AddInstruction(bailout, current_block_); | |
942 } | |
943 } | 908 } |
944 | 909 |
945 | 910 |
946 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 911 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
947 LInstruction* result = new (zone()) LPrologue(); | 912 LInstruction* result = new (zone()) LPrologue(); |
948 if (info_->scope()->num_heap_slots() > 0) { | 913 if (info_->scope()->num_heap_slots() > 0) { |
949 result = MarkAsCall(result, instr); | 914 result = MarkAsCall(result, instr); |
950 } | 915 } |
951 return result; | 916 return result; |
952 } | 917 } |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 LOperand* index = UseTempRegister(instr->index()); | 2589 LOperand* index = UseTempRegister(instr->index()); |
2625 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2590 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2626 LInstruction* result = DefineSameAsFirst(load); | 2591 LInstruction* result = DefineSameAsFirst(load); |
2627 return AssignPointerMap(result); | 2592 return AssignPointerMap(result); |
2628 } | 2593 } |
2629 | 2594 |
2630 } // namespace internal | 2595 } // namespace internal |
2631 } // namespace v8 | 2596 } // namespace v8 |
2632 | 2597 |
2633 #endif // V8_TARGET_ARCH_IA32 | 2598 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |