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 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 bool LCodeGen::GenerateJumpTable() { | 380 bool LCodeGen::GenerateJumpTable() { |
381 Label needs_frame; | 381 Label needs_frame; |
382 if (jump_table_.length() > 0) { | 382 if (jump_table_.length() > 0) { |
383 Comment(";;; -------------------- Jump table --------------------"); | 383 Comment(";;; -------------------- Jump table --------------------"); |
384 } | 384 } |
385 for (int i = 0; i < jump_table_.length(); i++) { | 385 for (int i = 0; i < jump_table_.length(); i++) { |
386 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; | 386 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; |
387 __ bind(&table_entry->label); | 387 __ bind(&table_entry->label); |
388 Address entry = table_entry->address; | 388 Address entry = table_entry->address; |
389 Deoptimizer::BailoutType type = table_entry->bailout_type; | |
390 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); | |
391 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); | |
392 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | |
393 DeoptComment(table_entry->reason); | 389 DeoptComment(table_entry->reason); |
394 if (table_entry->needs_frame) { | 390 if (table_entry->needs_frame) { |
395 DCHECK(!info()->saves_caller_doubles()); | 391 DCHECK(!info()->saves_caller_doubles()); |
396 __ push(Immediate(ExternalReference::ForDeoptEntry(entry))); | 392 __ push(Immediate(ExternalReference::ForDeoptEntry(entry))); |
397 if (needs_frame.is_bound()) { | 393 if (needs_frame.is_bound()) { |
398 __ jmp(&needs_frame); | 394 __ jmp(&needs_frame); |
399 } else { | 395 } else { |
400 __ bind(&needs_frame); | 396 __ bind(&needs_frame); |
401 __ push(MemOperand(ebp, StandardFrameConstants::kContextOffset)); | 397 __ push(MemOperand(ebp, StandardFrameConstants::kContextOffset)); |
402 // This variant of deopt can only be used with stubs. Since we don't | 398 // This variant of deopt can only be used with stubs. Since we don't |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 __ bind(&done); | 863 __ bind(&done); |
868 } | 864 } |
869 | 865 |
870 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), | 866 Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(), |
871 instr->Mnemonic(), detail); | 867 instr->Mnemonic(), detail); |
872 DCHECK(info()->IsStub() || frame_is_built_); | 868 DCHECK(info()->IsStub() || frame_is_built_); |
873 if (cc == no_condition && frame_is_built_) { | 869 if (cc == no_condition && frame_is_built_) { |
874 DeoptComment(reason); | 870 DeoptComment(reason); |
875 __ call(entry, RelocInfo::RUNTIME_ENTRY); | 871 __ call(entry, RelocInfo::RUNTIME_ENTRY); |
876 } else { | 872 } else { |
| 873 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type, |
| 874 !frame_is_built_); |
877 // We often have several deopts to the same entry, reuse the last | 875 // We often have several deopts to the same entry, reuse the last |
878 // jump entry if this is the case. | 876 // jump entry if this is the case. |
879 if (jump_table_.is_empty() || | 877 if (jump_table_.is_empty() || |
880 jump_table_.last().address != entry || | 878 !table_entry.IsEquivalentTo(jump_table_.last())) { |
881 jump_table_.last().needs_frame != !frame_is_built_ || | |
882 jump_table_.last().bailout_type != bailout_type) { | |
883 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type, | |
884 !frame_is_built_); | |
885 jump_table_.Add(table_entry, zone()); | 879 jump_table_.Add(table_entry, zone()); |
886 } | 880 } |
887 if (cc == no_condition) { | 881 if (cc == no_condition) { |
888 __ jmp(&jump_table_.last().label); | 882 __ jmp(&jump_table_.last().label); |
889 } else { | 883 } else { |
890 __ j(cc, &jump_table_.last().label); | 884 __ j(cc, &jump_table_.last().label); |
891 } | 885 } |
892 } | 886 } |
893 } | 887 } |
894 | 888 |
(...skipping 4801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5696 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5690 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5697 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5691 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5698 } | 5692 } |
5699 | 5693 |
5700 | 5694 |
5701 #undef __ | 5695 #undef __ |
5702 | 5696 |
5703 } } // namespace v8::internal | 5697 } } // namespace v8::internal |
5704 | 5698 |
5705 #endif // V8_TARGET_ARCH_IA32 | 5699 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |