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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 293 } |
294 } | 294 } |
295 // Deferred code is the last part of the instruction sequence. Mark | 295 // Deferred code is the last part of the instruction sequence. Mark |
296 // the generated code as done unless we bailed out. | 296 // the generated code as done unless we bailed out. |
297 if (!is_aborted()) status_ = DONE; | 297 if (!is_aborted()) status_ = DONE; |
298 return !is_aborted(); | 298 return !is_aborted(); |
299 } | 299 } |
300 | 300 |
301 | 301 |
302 bool LCodeGen::GenerateJumpTable() { | 302 bool LCodeGen::GenerateJumpTable() { |
303 if (deopt_jump_table_.length() > 0) { | 303 if (jump_table_.length() > 0) { |
304 Comment(";;; -------------------- Jump table --------------------"); | 304 Comment(";;; -------------------- Jump table --------------------"); |
305 } | 305 } |
306 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 306 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
307 Label table_start; | 307 Label table_start; |
308 __ bind(&table_start); | 308 __ bind(&table_start); |
309 Label needs_frame; | 309 Label needs_frame; |
310 for (int i = 0; i < deopt_jump_table_.length(); i++) { | 310 for (int i = 0; i < jump_table_.length(); i++) { |
311 Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i]; | 311 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; |
312 __ bind(&table_entry->label); | 312 __ bind(&table_entry->label); |
313 Address entry = table_entry->address; | 313 Address entry = table_entry->address; |
314 Deoptimizer::BailoutType type = table_entry->bailout_type; | |
315 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); | |
316 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); | |
317 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | |
318 DeoptComment(table_entry->reason); | 314 DeoptComment(table_entry->reason); |
319 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); | 315 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); |
320 if (table_entry->needs_frame) { | 316 if (table_entry->needs_frame) { |
321 DCHECK(!info()->saves_caller_doubles()); | 317 DCHECK(!info()->saves_caller_doubles()); |
322 if (needs_frame.is_bound()) { | 318 if (needs_frame.is_bound()) { |
323 __ Branch(&needs_frame); | 319 __ Branch(&needs_frame); |
324 } else { | 320 } else { |
325 __ bind(&needs_frame); | 321 __ bind(&needs_frame); |
326 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); | 322 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); |
327 // This variant of deopt can only be used with stubs. Since we don't | 323 // This variant of deopt can only be used with stubs. Since we don't |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), | 811 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), |
816 instr->Mnemonic(), detail); | 812 instr->Mnemonic(), detail); |
817 DCHECK(info()->IsStub() || frame_is_built_); | 813 DCHECK(info()->IsStub() || frame_is_built_); |
818 // Go through jump table if we need to handle condition, build frame, or | 814 // Go through jump table if we need to handle condition, build frame, or |
819 // restore caller doubles. | 815 // restore caller doubles. |
820 if (condition == al && frame_is_built_ && | 816 if (condition == al && frame_is_built_ && |
821 !info()->saves_caller_doubles()) { | 817 !info()->saves_caller_doubles()) { |
822 DeoptComment(reason); | 818 DeoptComment(reason); |
823 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); | 819 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); |
824 } else { | 820 } else { |
| 821 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type, |
| 822 !frame_is_built_); |
825 // We often have several deopts to the same entry, reuse the last | 823 // We often have several deopts to the same entry, reuse the last |
826 // jump entry if this is the case. | 824 // jump entry if this is the case. |
827 if (deopt_jump_table_.is_empty() || | 825 if (jump_table_.is_empty() || |
828 (deopt_jump_table_.last().address != entry) || | 826 !table_entry.IsEquivalentTo(jump_table_.last())) { |
829 (deopt_jump_table_.last().bailout_type != bailout_type) || | 827 jump_table_.Add(table_entry, zone()); |
830 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { | |
831 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type, | |
832 !frame_is_built_); | |
833 deopt_jump_table_.Add(table_entry, zone()); | |
834 } | 828 } |
835 __ Branch(&deopt_jump_table_.last().label, condition, src1, src2); | 829 __ Branch(&jump_table_.last().label, condition, src1, src2); |
836 } | 830 } |
837 } | 831 } |
838 | 832 |
839 | 833 |
840 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, | 834 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, |
841 Register src1, const Operand& src2, | 835 Register src1, const Operand& src2, |
842 const char* detail) { | 836 const char* detail) { |
843 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 837 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
844 ? Deoptimizer::LAZY | 838 ? Deoptimizer::LAZY |
845 : Deoptimizer::EAGER; | 839 : Deoptimizer::EAGER; |
(...skipping 5100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5946 __ li(at, scope_info); | 5940 __ li(at, scope_info); |
5947 __ Push(at, ToRegister(instr->function())); | 5941 __ Push(at, ToRegister(instr->function())); |
5948 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5942 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5949 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5943 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5950 } | 5944 } |
5951 | 5945 |
5952 | 5946 |
5953 #undef __ | 5947 #undef __ |
5954 | 5948 |
5955 } } // namespace v8::internal | 5949 } } // namespace v8::internal |
OLD | NEW |