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

Side by Side Diff: src/mips/assembler-mips.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/mips/assembler-mips.h ('k') | src/mips64/assembler-mips64.h » ('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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 Label l = *L; 888 Label l = *L;
889 PrintF("unbound label"); 889 PrintF("unbound label");
890 while (l.is_linked()) { 890 while (l.is_linked()) {
891 PrintF("@ %d ", l.pos()); 891 PrintF("@ %d ", l.pos());
892 Instr instr = instr_at(l.pos()); 892 Instr instr = instr_at(l.pos());
893 if ((instr & ~kImm16Mask) == 0) { 893 if ((instr & ~kImm16Mask) == 0) {
894 PrintF("value\n"); 894 PrintF("value\n");
895 } else { 895 } else {
896 PrintF("%d\n", instr); 896 PrintF("%d\n", instr);
897 } 897 }
898 next(&l, internal_reference_positions_.find(l.pos()) != 898 next(&l, is_internal_reference(&l));
899 internal_reference_positions_.end());
900 } 899 }
901 } else { 900 } else {
902 PrintF("label in inconsistent state (pos = %d)\n", L->pos_); 901 PrintF("label in inconsistent state (pos = %d)\n", L->pos_);
903 } 902 }
904 } 903 }
905 904
906 905
907 void Assembler::bind_to(Label* L, int pos) { 906 void Assembler::bind_to(Label* L, int pos) {
908 DCHECK(0 <= pos && pos <= pc_offset()); // Must have valid binding position. 907 DCHECK(0 <= pos && pos <= pc_offset()); // Must have valid binding position.
909 int32_t trampoline_pos = kInvalidSlotPos; 908 int32_t trampoline_pos = kInvalidSlotPos;
910 bool is_internal = false; 909 bool is_internal = false;
911 if (L->is_linked() && !trampoline_emitted_) { 910 if (L->is_linked() && !trampoline_emitted_) {
912 unbound_labels_count_--; 911 unbound_labels_count_--;
913 next_buffer_check_ += kTrampolineSlotsSize; 912 if (!is_internal_reference(L)) {
913 next_buffer_check_ += kTrampolineSlotsSize;
914 }
914 } 915 }
915 916
916 while (L->is_linked()) { 917 while (L->is_linked()) {
917 int32_t fixup_pos = L->pos(); 918 int32_t fixup_pos = L->pos();
918 int32_t dist = pos - fixup_pos; 919 int32_t dist = pos - fixup_pos;
919 is_internal = internal_reference_positions_.find(fixup_pos) != 920 is_internal = is_internal_reference(L);
920 internal_reference_positions_.end();
921 next(L, is_internal); // Call next before overwriting link with target at 921 next(L, is_internal); // Call next before overwriting link with target at
922 // fixup_pos. 922 // fixup_pos.
923 Instr instr = instr_at(fixup_pos); 923 Instr instr = instr_at(fixup_pos);
924 if (is_internal) { 924 if (is_internal) {
925 target_at_put(fixup_pos, pos, is_internal); 925 target_at_put(fixup_pos, pos, is_internal);
926 } else { 926 } else {
927 if (IsBranch(instr)) { 927 if (IsBranch(instr)) {
928 int branch_offset = BranchOffset(instr); 928 int branch_offset = BranchOffset(instr);
929 if (dist > branch_offset) { 929 if (dist > branch_offset) {
930 if (trampoline_pos == kInvalidSlotPos) { 930 if (trampoline_pos == kInvalidSlotPos) {
931 trampoline_pos = get_trampoline_entry(fixup_pos); 931 trampoline_pos = get_trampoline_entry(fixup_pos);
932 CHECK(trampoline_pos != kInvalidSlotPos); 932 CHECK(trampoline_pos != kInvalidSlotPos);
933 } 933 }
934 CHECK((trampoline_pos - fixup_pos) <= branch_offset); 934 CHECK((trampoline_pos - fixup_pos) <= branch_offset);
935 target_at_put(fixup_pos, trampoline_pos, false); 935 target_at_put(fixup_pos, trampoline_pos, false);
936 fixup_pos = trampoline_pos; 936 fixup_pos = trampoline_pos;
937 dist = pos - fixup_pos;
938 } 937 }
939 target_at_put(fixup_pos, pos, false); 938 target_at_put(fixup_pos, pos, false);
940 } else { 939 } else {
941 target_at_put(fixup_pos, pos, false); 940 target_at_put(fixup_pos, pos, false);
942 } 941 }
943 } 942 }
944 } 943 }
945 L->bind_to(pos); 944 L->bind_to(pos);
946 945
947 // Keep track of the last bound label so we don't eliminate any instructions 946 // Keep track of the last bound label so we don't eliminate any instructions
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 3258
3260 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 3259 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
3261 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); 3260 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t));
3262 } 3261 }
3263 } 3262 }
3264 3263
3265 } // namespace internal 3264 } // namespace internal
3266 } // namespace v8 3265 } // namespace v8
3267 3266
3268 #endif // V8_TARGET_ARCH_MIPS 3267 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.h ('k') | src/mips64/assembler-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698