| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
| 8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 Address base = jump_table_[0]->address; | 832 Address base = jump_table_[0]->address; |
| 833 | 833 |
| 834 UseScratchRegisterScope temps(masm()); | 834 UseScratchRegisterScope temps(masm()); |
| 835 Register entry_offset = temps.AcquireX(); | 835 Register entry_offset = temps.AcquireX(); |
| 836 | 836 |
| 837 int length = jump_table_.length(); | 837 int length = jump_table_.length(); |
| 838 for (int i = 0; i < length; i++) { | 838 for (int i = 0; i < length; i++) { |
| 839 Deoptimizer::JumpTableEntry* table_entry = jump_table_[i]; | 839 Deoptimizer::JumpTableEntry* table_entry = jump_table_[i]; |
| 840 __ Bind(&table_entry->label); | 840 __ Bind(&table_entry->label); |
| 841 | 841 |
| 842 Deoptimizer::BailoutType type = table_entry->bailout_type; | |
| 843 Address entry = table_entry->address; | 842 Address entry = table_entry->address; |
| 844 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); | |
| 845 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); | |
| 846 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | |
| 847 DeoptComment(table_entry->reason); | 843 DeoptComment(table_entry->reason); |
| 848 | 844 |
| 849 // Second-level deopt table entries are contiguous and small, so instead | 845 // Second-level deopt table entries are contiguous and small, so instead |
| 850 // of loading the full, absolute address of each one, load the base | 846 // of loading the full, absolute address of each one, load the base |
| 851 // address and add an immediate offset. | 847 // address and add an immediate offset. |
| 852 __ Mov(entry_offset, entry - base); | 848 __ Mov(entry_offset, entry - base); |
| 853 | 849 |
| 854 // The last entry can fall through into `call_deopt_entry`, avoiding a | 850 // The last entry can fall through into `call_deopt_entry`, avoiding a |
| 855 // branch. | 851 // branch. |
| 856 bool last_entry = (i + 1) == length; | 852 bool last_entry = (i + 1) == length; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 | 1042 |
| 1047 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), | 1043 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), |
| 1048 instr->Mnemonic(), detail); | 1044 instr->Mnemonic(), detail); |
| 1049 DCHECK(info()->IsStub() || frame_is_built_); | 1045 DCHECK(info()->IsStub() || frame_is_built_); |
| 1050 // Go through jump table if we need to build frame, or restore caller doubles. | 1046 // Go through jump table if we need to build frame, or restore caller doubles. |
| 1051 if (branch_type == always && | 1047 if (branch_type == always && |
| 1052 frame_is_built_ && !info()->saves_caller_doubles()) { | 1048 frame_is_built_ && !info()->saves_caller_doubles()) { |
| 1053 DeoptComment(reason); | 1049 DeoptComment(reason); |
| 1054 __ Call(entry, RelocInfo::RUNTIME_ENTRY); | 1050 __ Call(entry, RelocInfo::RUNTIME_ENTRY); |
| 1055 } else { | 1051 } else { |
| 1052 Deoptimizer::JumpTableEntry* table_entry = |
| 1053 new (zone()) Deoptimizer::JumpTableEntry(entry, reason, bailout_type, |
| 1054 !frame_is_built_); |
| 1056 // We often have several deopts to the same entry, reuse the last | 1055 // We often have several deopts to the same entry, reuse the last |
| 1057 // jump entry if this is the case. | 1056 // jump entry if this is the case. |
| 1058 if (jump_table_.is_empty() || (jump_table_.last()->address != entry) || | 1057 if (jump_table_.is_empty() || |
| 1059 (jump_table_.last()->bailout_type != bailout_type) || | 1058 !table_entry->IsEquivalentTo(*jump_table_.last())) { |
| 1060 (jump_table_.last()->needs_frame != !frame_is_built_)) { | |
| 1061 Deoptimizer::JumpTableEntry* table_entry = | |
| 1062 new (zone()) Deoptimizer::JumpTableEntry(entry, reason, bailout_type, | |
| 1063 !frame_is_built_); | |
| 1064 jump_table_.Add(table_entry, zone()); | 1059 jump_table_.Add(table_entry, zone()); |
| 1065 } | 1060 } |
| 1066 __ B(&jump_table_.last()->label, branch_type, reg, bit); | 1061 __ B(&jump_table_.last()->label, branch_type, reg, bit); |
| 1067 } | 1062 } |
| 1068 } | 1063 } |
| 1069 | 1064 |
| 1070 | 1065 |
| 1071 void LCodeGen::Deoptimize(LInstruction* instr, | 1066 void LCodeGen::Deoptimize(LInstruction* instr, |
| 1072 Deoptimizer::BailoutType* override_bailout_type, | 1067 Deoptimizer::BailoutType* override_bailout_type, |
| 1073 const char* detail) { | 1068 const char* detail) { |
| (...skipping 4963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6037 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6032 Handle<ScopeInfo> scope_info = instr->scope_info(); |
| 6038 __ Push(scope_info); | 6033 __ Push(scope_info); |
| 6039 __ Push(ToRegister(instr->function())); | 6034 __ Push(ToRegister(instr->function())); |
| 6040 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6035 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6041 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6036 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6042 } | 6037 } |
| 6043 | 6038 |
| 6044 | 6039 |
| 6045 | 6040 |
| 6046 } } // namespace v8::internal | 6041 } } // namespace v8::internal |
| OLD | NEW |