OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 } | 318 } |
319 // Deferred code is the last part of the instruction sequence. Mark | 319 // Deferred code is the last part of the instruction sequence. Mark |
320 // the generated code as done unless we bailed out. | 320 // the generated code as done unless we bailed out. |
321 if (!is_aborted()) status_ = DONE; | 321 if (!is_aborted()) status_ = DONE; |
322 return !is_aborted(); | 322 return !is_aborted(); |
323 } | 323 } |
324 | 324 |
325 | 325 |
326 bool LCodeGen::GenerateJumpTable() { | 326 bool LCodeGen::GenerateJumpTable() { |
327 if (deopt_jump_table_.length() > 0) { | 327 if (jump_table_.length() > 0) { |
328 Label needs_frame, call_deopt_entry; | 328 Label needs_frame, call_deopt_entry; |
329 | 329 |
330 Comment(";;; -------------------- Jump table --------------------"); | 330 Comment(";;; -------------------- Jump table --------------------"); |
331 Address base = deopt_jump_table_[0].address; | 331 Address base = jump_table_[0].address; |
332 | 332 |
333 Register entry_offset = t9; | 333 Register entry_offset = t9; |
334 | 334 |
335 int length = deopt_jump_table_.length(); | 335 int length = jump_table_.length(); |
336 for (int i = 0; i < length; i++) { | 336 for (int i = 0; i < length; i++) { |
337 Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i]; | 337 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; |
338 __ bind(&table_entry->label); | 338 __ bind(&table_entry->label); |
339 | 339 |
340 Deoptimizer::BailoutType type = table_entry->bailout_type; | 340 DCHECK(table_entry->bailout_type == jump_table_[0].bailout_type); |
341 DCHECK(type == deopt_jump_table_[0].bailout_type); | |
342 Address entry = table_entry->address; | 341 Address entry = table_entry->address; |
343 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); | |
344 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); | |
345 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | |
346 DeoptComment(table_entry->reason); | 342 DeoptComment(table_entry->reason); |
347 | 343 |
348 // Second-level deopt table entries are contiguous and small, so instead | 344 // Second-level deopt table entries are contiguous and small, so instead |
349 // of loading the full, absolute address of each one, load an immediate | 345 // of loading the full, absolute address of each one, load an immediate |
350 // offset which will be added to the base address later. | 346 // offset which will be added to the base address later. |
351 __ li(entry_offset, Operand(entry - base)); | 347 __ li(entry_offset, Operand(entry - base)); |
352 | 348 |
353 if (table_entry->needs_frame) { | 349 if (table_entry->needs_frame) { |
354 DCHECK(!info()->saves_caller_doubles()); | 350 DCHECK(!info()->saves_caller_doubles()); |
355 if (needs_frame.is_bound()) { | 351 if (needs_frame.is_bound()) { |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), | 861 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), |
866 instr->Mnemonic(), detail); | 862 instr->Mnemonic(), detail); |
867 DCHECK(info()->IsStub() || frame_is_built_); | 863 DCHECK(info()->IsStub() || frame_is_built_); |
868 // Go through jump table if we need to handle condition, build frame, or | 864 // Go through jump table if we need to handle condition, build frame, or |
869 // restore caller doubles. | 865 // restore caller doubles. |
870 if (condition == al && frame_is_built_ && | 866 if (condition == al && frame_is_built_ && |
871 !info()->saves_caller_doubles()) { | 867 !info()->saves_caller_doubles()) { |
872 DeoptComment(reason); | 868 DeoptComment(reason); |
873 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); | 869 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); |
874 } else { | 870 } else { |
| 871 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type, |
| 872 !frame_is_built_); |
875 // We often have several deopts to the same entry, reuse the last | 873 // We often have several deopts to the same entry, reuse the last |
876 // jump entry if this is the case. | 874 // jump entry if this is the case. |
877 if (deopt_jump_table_.is_empty() || | 875 if (jump_table_.is_empty() || |
878 (deopt_jump_table_.last().address != entry) || | 876 !table_entry.IsEquivalentTo(jump_table_.last())) { |
879 (deopt_jump_table_.last().bailout_type != bailout_type) || | 877 jump_table_.Add(table_entry, zone()); |
880 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { | |
881 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type, | |
882 !frame_is_built_); | |
883 deopt_jump_table_.Add(table_entry, zone()); | |
884 } | 878 } |
885 __ Branch(&deopt_jump_table_.last().label, condition, src1, src2); | 879 __ Branch(&jump_table_.last().label, condition, src1, src2); |
886 } | 880 } |
887 } | 881 } |
888 | 882 |
889 | 883 |
890 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, | 884 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, |
891 Register src1, const Operand& src2, | 885 Register src1, const Operand& src2, |
892 const char* detail) { | 886 const char* detail) { |
893 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 887 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
894 ? Deoptimizer::LAZY | 888 ? Deoptimizer::LAZY |
895 : Deoptimizer::EAGER; | 889 : Deoptimizer::EAGER; |
(...skipping 5019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5915 __ li(at, scope_info); | 5909 __ li(at, scope_info); |
5916 __ Push(at, ToRegister(instr->function())); | 5910 __ Push(at, ToRegister(instr->function())); |
5917 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5911 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5918 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5912 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5919 } | 5913 } |
5920 | 5914 |
5921 | 5915 |
5922 #undef __ | 5916 #undef __ |
5923 | 5917 |
5924 } } // namespace v8::internal | 5918 } } // namespace v8::internal |
OLD | NEW |