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/arm/lithium-arm.h" | 5 #include "src/crankshaft/arm/lithium-arm.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/crankshaft/arm/lithium-codegen-arm.h" | 9 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
10 #include "src/crankshaft/hydrogen-osr.h" | 10 #include "src/crankshaft/hydrogen-osr.h" |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 #endif | 864 #endif |
865 | 865 |
866 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 866 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
867 instr = AssignPointerMap(instr); | 867 instr = AssignPointerMap(instr); |
868 } | 868 } |
869 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 869 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
870 instr = AssignEnvironment(instr); | 870 instr = AssignEnvironment(instr); |
871 } | 871 } |
872 chunk_->AddInstruction(instr, current_block_); | 872 chunk_->AddInstruction(instr, current_block_); |
873 | 873 |
874 if (instr->IsCall()) { | 874 CreateLazyBailoutForCall(current_block_, instr, hydrogen_val); |
875 HEnvironment* hydrogen_env = current_block_->last_environment(); | |
876 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | |
877 DCHECK_NOT_NULL(hydrogen_env); | |
878 if (instr->IsSyntacticTailCall()) { | |
879 // If it was a syntactic tail call we need to drop the current frame and | |
880 // all the frames on top of it that are either an arguments adaptor frame | |
881 // or a tail caller frame. | |
882 hydrogen_env = hydrogen_env->outer(); | |
883 while (hydrogen_env != nullptr && | |
884 (hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR || | |
885 hydrogen_env->frame_type() == TAIL_CALLER_FUNCTION)) { | |
886 hydrogen_env = hydrogen_env->outer(); | |
887 } | |
888 if (hydrogen_env != nullptr) { | |
889 // Push return value on top of outer environment. | |
890 hydrogen_env = hydrogen_env->Copy(); | |
891 hydrogen_env->Push(hydrogen_val); | |
892 } else { | |
893 // Although we don't need this lazy bailout for normal execution | |
894 // (because when we tail call from the outermost function we should pop | |
895 // its frame) we still need it when debugger is on. | |
896 hydrogen_env = current_block_->last_environment(); | |
897 } | |
898 } else { | |
899 if (hydrogen_val->HasObservableSideEffects()) { | |
900 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | |
901 sim->ReplayEnvironment(hydrogen_env); | |
902 hydrogen_value_for_lazy_bailout = sim; | |
903 } | |
904 } | |
905 LInstruction* bailout = LChunkBuilderBase::AssignEnvironment( | |
906 new (zone()) LLazyBailout(), hydrogen_env); | |
907 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); | |
908 chunk_->AddInstruction(bailout, current_block_); | |
909 } | |
910 } | 875 } |
911 | 876 |
912 | 877 |
913 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { | 878 LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) { |
914 LInstruction* result = new (zone()) LPrologue(); | 879 LInstruction* result = new (zone()) LPrologue(); |
915 if (info_->scope()->num_heap_slots() > 0) { | 880 if (info_->scope()->num_heap_slots() > 0) { |
916 result = MarkAsCall(result, instr); | 881 result = MarkAsCall(result, instr); |
917 } | 882 } |
918 return result; | 883 return result; |
919 } | 884 } |
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2523 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2559 LOperand* object = UseRegister(instr->object()); | 2524 LOperand* object = UseRegister(instr->object()); |
2560 LOperand* index = UseTempRegister(instr->index()); | 2525 LOperand* index = UseTempRegister(instr->index()); |
2561 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2526 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2562 LInstruction* result = DefineSameAsFirst(load); | 2527 LInstruction* result = DefineSameAsFirst(load); |
2563 return AssignPointerMap(result); | 2528 return AssignPointerMap(result); |
2564 } | 2529 } |
2565 | 2530 |
2566 } // namespace internal | 2531 } // namespace internal |
2567 } // namespace v8 | 2532 } // namespace v8 |
OLD | NEW |