Chromium Code Reviews| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 } | 221 } |
| 222 | 222 |
| 223 | 223 |
| 224 void RelocInfo::set_target_object(Object* target) { | 224 void RelocInfo::set_target_object(Object* target) { |
| 225 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 225 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 226 *reinterpret_cast<Object**>(pc_) = target; | 226 *reinterpret_cast<Object**>(pc_) = target; |
| 227 } | 227 } |
| 228 | 228 |
| 229 | 229 |
| 230 bool RelocInfo::IsCallInstruction() { | 230 bool RelocInfo::IsCallInstruction() { |
| 231 UNIMPLEMENTED(); // IA32 code below. | 231 // TODO(X64) If allowing short (relative32 offset) jumps, also |
| 232 return *pc_ == 0xE8; | 232 // recognize 0xE8! |
| 233 return pc_[11] != 0xCC; | |
|
Søren Thygesen Gjesse
2009/08/18 13:10:44
Please explain why non int3 instruction at pc + 11
Lasse Reichstein
2009/08/19 07:07:55
Has been elaborated.
We only need to distinguish a
| |
| 233 } | 234 } |
| 234 | 235 |
| 235 | 236 |
| 236 Address RelocInfo::call_address() { | 237 Address RelocInfo::call_address() { |
| 237 UNIMPLEMENTED(); // IA32 code below. | |
| 238 ASSERT(IsCallInstruction()); | 238 ASSERT(IsCallInstruction()); |
| 239 return Assembler::target_address_at(pc_ + 1); | 239 return |
| 240 Assembler::target_address_at(pc_ + Assembler::kReturnAddrPatchPrefixSize); | |
| 240 } | 241 } |
| 241 | 242 |
| 242 | 243 |
| 243 void RelocInfo::set_call_address(Address target) { | 244 void RelocInfo::set_call_address(Address target) { |
| 244 UNIMPLEMENTED(); // IA32 code below. | |
| 245 ASSERT(IsCallInstruction()); | 245 ASSERT(IsCallInstruction()); |
| 246 Assembler::set_target_address_at(pc_ + 1, target); | 246 Assembler::set_target_address_at(pc_ + Assembler::kReturnAddrPatchPrefixSize, |
|
William Hesse
2009/08/19 08:44:00
I really think this name is bad. Maybe there shou
Lasse Reichstein
2009/08/19 10:12:32
I can't see a good and quick way to separate it. I
| |
| 247 target); | |
| 247 } | 248 } |
| 248 | 249 |
| 249 | 250 |
| 250 Object* RelocInfo::call_object() { | 251 Object* RelocInfo::call_object() { |
| 251 UNIMPLEMENTED(); // IA32 code below. | |
| 252 ASSERT(IsCallInstruction()); | 252 ASSERT(IsCallInstruction()); |
| 253 return *call_object_address(); | 253 return *call_object_address(); |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| 257 void RelocInfo::set_call_object(Object* target) { | 257 void RelocInfo::set_call_object(Object* target) { |
| 258 UNIMPLEMENTED(); // IA32 code below. | |
| 259 ASSERT(IsCallInstruction()); | 258 ASSERT(IsCallInstruction()); |
| 260 *call_object_address() = target; | 259 *call_object_address() = target; |
| 261 } | 260 } |
| 262 | 261 |
| 263 | 262 |
| 264 Object** RelocInfo::call_object_address() { | 263 Object** RelocInfo::call_object_address() { |
| 265 UNIMPLEMENTED(); // IA32 code below. | |
| 266 ASSERT(IsCallInstruction()); | 264 ASSERT(IsCallInstruction()); |
| 267 return reinterpret_cast<Object**>(pc_ + 1); | 265 return |
| 266 reinterpret_cast<Object**>(pc_ + Assembler::kReturnAddrPatchPrefixSize); | |
| 268 } | 267 } |
| 269 | 268 |
| 270 // ----------------------------------------------------------------------------- | 269 // ----------------------------------------------------------------------------- |
| 271 // Implementation of Operand | 270 // Implementation of Operand |
| 272 | 271 |
| 273 void Operand::set_modrm(int mod, Register rm_reg) { | 272 void Operand::set_modrm(int mod, Register rm_reg) { |
| 274 ASSERT(is_uint2(mod)); | 273 ASSERT(is_uint2(mod)); |
| 275 buf_[0] = mod << 6 | rm_reg.low_bits(); | 274 buf_[0] = mod << 6 | rm_reg.low_bits(); |
| 276 // Set REX.B to the high bit of rm.code(). | 275 // Set REX.B to the high bit of rm.code(). |
| 277 rex_ |= rm_reg.high_bit(); | 276 rex_ |= rm_reg.high_bit(); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 301 ASSERT(len_ == 1 || len_ == 2); | 300 ASSERT(len_ == 1 || len_ == 2); |
| 302 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 301 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
| 303 *p = disp; | 302 *p = disp; |
| 304 len_ += sizeof(int32_t); | 303 len_ += sizeof(int32_t); |
| 305 } | 304 } |
| 306 | 305 |
| 307 | 306 |
| 308 } } // namespace v8::internal | 307 } } // namespace v8::internal |
| 309 | 308 |
| 310 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 309 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |