Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: src/mips64/assembler-mips64.cc

Issue 2530143002: MIPS: Fix trampoline emission after switch table generation (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/assembler-mips64.h ('k') | test/cctest/test-macro-assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 Label l = *L; 852 Label l = *L;
853 PrintF("unbound label"); 853 PrintF("unbound label");
854 while (l.is_linked()) { 854 while (l.is_linked()) {
855 PrintF("@ %d ", l.pos()); 855 PrintF("@ %d ", l.pos());
856 Instr instr = instr_at(l.pos()); 856 Instr instr = instr_at(l.pos());
857 if ((instr & ~kImm16Mask) == 0) { 857 if ((instr & ~kImm16Mask) == 0) {
858 PrintF("value\n"); 858 PrintF("value\n");
859 } else { 859 } else {
860 PrintF("%d\n", instr); 860 PrintF("%d\n", instr);
861 } 861 }
862 next(&l, internal_reference_positions_.find(l.pos()) != 862 next(&l, is_internal_reference(&l));
863 internal_reference_positions_.end());
864 } 863 }
865 } else { 864 } else {
866 PrintF("label in inconsistent state (pos = %d)\n", L->pos_); 865 PrintF("label in inconsistent state (pos = %d)\n", L->pos_);
867 } 866 }
868 } 867 }
869 868
870 869
871 void Assembler::bind_to(Label* L, int pos) { 870 void Assembler::bind_to(Label* L, int pos) {
872 DCHECK(0 <= pos && pos <= pc_offset()); // Must have valid binding position. 871 DCHECK(0 <= pos && pos <= pc_offset()); // Must have valid binding position.
873 int trampoline_pos = kInvalidSlotPos; 872 int trampoline_pos = kInvalidSlotPos;
874 bool is_internal = false; 873 bool is_internal = false;
875 if (L->is_linked() && !trampoline_emitted_) { 874 if (L->is_linked() && !trampoline_emitted_) {
876 unbound_labels_count_--; 875 unbound_labels_count_--;
877 next_buffer_check_ += kTrampolineSlotsSize; 876 if (!is_internal_reference(L)) {
877 next_buffer_check_ += kTrampolineSlotsSize;
878 }
878 } 879 }
879 880
880 while (L->is_linked()) { 881 while (L->is_linked()) {
881 int fixup_pos = L->pos(); 882 int fixup_pos = L->pos();
882 int dist = pos - fixup_pos; 883 int dist = pos - fixup_pos;
883 is_internal = internal_reference_positions_.find(fixup_pos) != 884 is_internal = is_internal_reference(L);
884 internal_reference_positions_.end();
885 next(L, is_internal); // Call next before overwriting link with target at 885 next(L, is_internal); // Call next before overwriting link with target at
886 // fixup_pos. 886 // fixup_pos.
887 Instr instr = instr_at(fixup_pos); 887 Instr instr = instr_at(fixup_pos);
888 if (is_internal) { 888 if (is_internal) {
889 target_at_put(fixup_pos, pos, is_internal); 889 target_at_put(fixup_pos, pos, is_internal);
890 } else { 890 } else {
891 if (IsBranch(instr)) { 891 if (IsBranch(instr)) {
892 int branch_offset = BranchOffset(instr); 892 int branch_offset = BranchOffset(instr);
893 if (dist > branch_offset) { 893 if (dist > branch_offset) {
894 if (trampoline_pos == kInvalidSlotPos) { 894 if (trampoline_pos == kInvalidSlotPos) {
895 trampoline_pos = get_trampoline_entry(fixup_pos); 895 trampoline_pos = get_trampoline_entry(fixup_pos);
896 CHECK(trampoline_pos != kInvalidSlotPos); 896 CHECK(trampoline_pos != kInvalidSlotPos);
897 } 897 }
898 CHECK((trampoline_pos - fixup_pos) <= branch_offset); 898 CHECK((trampoline_pos - fixup_pos) <= branch_offset);
899 target_at_put(fixup_pos, trampoline_pos, false); 899 target_at_put(fixup_pos, trampoline_pos, false);
900 fixup_pos = trampoline_pos; 900 fixup_pos = trampoline_pos;
901 dist = pos - fixup_pos;
902 } 901 }
903 target_at_put(fixup_pos, pos, false); 902 target_at_put(fixup_pos, pos, false);
904 } else { 903 } else {
905 DCHECK(IsJ(instr) || IsJal(instr) || IsLui(instr) || 904 DCHECK(IsJ(instr) || IsJal(instr) || IsLui(instr) ||
906 IsEmittedConstant(instr)); 905 IsEmittedConstant(instr));
907 target_at_put(fixup_pos, pos, false); 906 target_at_put(fixup_pos, pos, false);
908 } 907 }
909 } 908 }
910 } 909 }
911 L->bind_to(pos); 910 L->bind_to(pos);
(...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after
3505 3504
3506 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3505 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3507 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize); 3506 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize);
3508 } 3507 }
3509 } 3508 }
3510 3509
3511 } // namespace internal 3510 } // namespace internal
3512 } // namespace v8 3511 } // namespace v8
3513 3512
3514 #endif // V8_TARGET_ARCH_MIPS64 3513 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/assembler-mips64.h ('k') | test/cctest/test-macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698