OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (op.rex_ != 0) emit(0x40 | op.rex_); | 169 if (op.rex_ != 0) emit(0x40 | op.rex_); |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 Address Assembler::target_address_at(Address pc) { | 173 Address Assembler::target_address_at(Address pc) { |
174 return Memory::int32_at(pc) + pc + 4; | 174 return Memory::int32_at(pc) + pc + 4; |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 void Assembler::set_target_address_at(Address pc, Address target) { | 178 void Assembler::set_target_address_at(Address pc, Address target) { |
179 Memory::int32_at(pc) = target - pc - 4; | 179 Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4); |
180 CPU::FlushICache(pc, sizeof(int32_t)); | 180 CPU::FlushICache(pc, sizeof(int32_t)); |
181 } | 181 } |
182 | 182 |
183 Handle<Object> Assembler::code_target_object_handle_at(Address pc) { | 183 Handle<Object> Assembler::code_target_object_handle_at(Address pc) { |
184 return code_targets_[Memory::int32_at(pc)]; | 184 return code_targets_[Memory::int32_at(pc)]; |
185 } | 185 } |
186 | 186 |
187 // ----------------------------------------------------------------------------- | 187 // ----------------------------------------------------------------------------- |
188 // Implementation of RelocInfo | 188 // Implementation of RelocInfo |
189 | 189 |
190 // The modes possibly affected by apply must be in kApplyMask. | 190 // The modes possibly affected by apply must be in kApplyMask. |
191 void RelocInfo::apply(intptr_t delta) { | 191 void RelocInfo::apply(intptr_t delta) { |
192 if (IsInternalReference(rmode_)) { | 192 if (IsInternalReference(rmode_)) { |
193 // absolute code pointer inside code object moves with the code object. | 193 // absolute code pointer inside code object moves with the code object. |
194 Memory::Address_at(pc_) += delta; | 194 Memory::Address_at(pc_) += static_cast<int32_t>(delta); |
195 } else if (IsCodeTarget(rmode_)) { | 195 } else if (IsCodeTarget(rmode_)) { |
196 Memory::int32_at(pc_) -= delta; | 196 Memory::int32_at(pc_) -= static_cast<int32_t>(delta); |
197 } else if (rmode_ == JS_RETURN && IsPatchedReturnSequence()) { | 197 } else if (rmode_ == JS_RETURN && IsPatchedReturnSequence()) { |
198 // Special handling of js_return when a break point is set (call | 198 // Special handling of js_return when a break point is set (call |
199 // instruction has been inserted). | 199 // instruction has been inserted). |
200 Memory::int32_at(pc_ + 1) -= delta; // relocate entry | 200 Memory::int32_at(pc_ + 1) -= static_cast<int32_t>(delta); // relocate entry |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 | 204 |
205 Address RelocInfo::target_address() { | 205 Address RelocInfo::target_address() { |
206 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 206 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
207 if (IsCodeTarget(rmode_)) { | 207 if (IsCodeTarget(rmode_)) { |
208 return Assembler::target_address_at(pc_); | 208 return Assembler::target_address_at(pc_); |
209 } else { | 209 } else { |
210 return Memory::Address_at(pc_); | 210 return Memory::Address_at(pc_); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 ASSERT(len_ == 1 || len_ == 2); | 343 ASSERT(len_ == 1 || len_ == 2); |
344 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 344 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
345 *p = disp; | 345 *p = disp; |
346 len_ += sizeof(int32_t); | 346 len_ += sizeof(int32_t); |
347 } | 347 } |
348 | 348 |
349 | 349 |
350 } } // namespace v8::internal | 350 } } // namespace v8::internal |
351 | 351 |
352 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 352 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |