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

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

Issue 967323002: Refactor BreakLocationIterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: static_cast instead Created 5 years, 9 months 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/x64/debug-x64.cc ('k') | src/x87/debug-x87.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 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // code object moves. 95 // code object moves.
96 return (1 << rmode_) & kApplyMask; 96 return (1 << rmode_) & kApplyMask;
97 } 97 }
98 98
99 99
100 bool RelocInfo::IsInConstantPool() { 100 bool RelocInfo::IsInConstantPool() {
101 return false; 101 return false;
102 } 102 }
103 103
104 104
105 void RelocInfo::PatchCode(byte* instructions, int instruction_count) {
106 // Patch the code at the current address with the supplied instructions.
107 for (int i = 0; i < instruction_count; i++) {
108 *(pc_ + i) = *(instructions + i);
109 }
110
111 // Indicate that code has changed.
112 CpuFeatures::FlushICache(pc_, instruction_count);
113 }
114
115
116 // Patch the code at the current PC with a call to the target address.
117 // Additional guard int3 instructions can be added if required.
118 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) {
119 // Call instruction takes up 5 bytes and int3 takes up one byte.
120 static const int kCallCodeSize = 5;
121 int code_size = kCallCodeSize + guard_bytes;
122
123 // Create a code patcher.
124 CodePatcher patcher(pc_, code_size);
125
126 // Add a label for checking the size of the code used for returning.
127 #ifdef DEBUG
128 Label check_codesize;
129 patcher.masm()->bind(&check_codesize);
130 #endif
131
132 // Patch the code.
133 patcher.masm()->call(target, RelocInfo::NONE32);
134
135 // Check that the size of the code generated is as expected.
136 DCHECK_EQ(kCallCodeSize,
137 patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize));
138
139 // Add the requested number of int3 instructions after the call.
140 DCHECK_GE(guard_bytes, 0);
141 for (int i = 0; i < guard_bytes; i++) {
142 patcher.masm()->int3();
143 }
144 }
145
146
147 // ----------------------------------------------------------------------------- 105 // -----------------------------------------------------------------------------
148 // Implementation of Operand 106 // Implementation of Operand
149 107
150 Operand::Operand(Register base, int32_t disp, RelocInfo::Mode rmode) { 108 Operand::Operand(Register base, int32_t disp, RelocInfo::Mode rmode) {
151 // [base + disp/r] 109 // [base + disp/r]
152 if (disp == 0 && RelocInfo::IsNone(rmode) && !base.is(ebp)) { 110 if (disp == 0 && RelocInfo::IsNone(rmode) && !base.is(ebp)) {
153 // [base] 111 // [base]
154 set_modrm(0, base); 112 set_modrm(0, base);
155 if (base.is(esp)) set_sib(times_1, esp, base); 113 if (base.is(esp)) set_sib(times_1, esp, base);
156 } else if (is_int8(disp) && RelocInfo::IsNone(rmode)) { 114 } else if (is_int8(disp) && RelocInfo::IsNone(rmode)) {
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 fprintf(coverage_log, "%s\n", file_line); 2052 fprintf(coverage_log, "%s\n", file_line);
2095 fflush(coverage_log); 2053 fflush(coverage_log);
2096 } 2054 }
2097 } 2055 }
2098 2056
2099 #endif 2057 #endif
2100 2058
2101 } } // namespace v8::internal 2059 } } // namespace v8::internal
2102 2060
2103 #endif // V8_TARGET_ARCH_X87 2061 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/debug-x64.cc ('k') | src/x87/debug-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698