| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 return reinterpret_cast<Address*>(pc_); | 267 return reinterpret_cast<Address*>(pc_); |
| 268 } | 268 } |
| 269 | 269 |
| 270 | 270 |
| 271 void RelocInfo::set_target_object(Object* target) { | 271 void RelocInfo::set_target_object(Object* target) { |
| 272 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 272 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 273 *reinterpret_cast<Object**>(pc_) = target; | 273 *reinterpret_cast<Object**>(pc_) = target; |
| 274 } | 274 } |
| 275 | 275 |
| 276 | 276 |
| 277 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { |
| 278 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 279 Address address = Memory::Address_at(pc_); |
| 280 return Handle<JSGlobalPropertyCell>( |
| 281 reinterpret_cast<JSGlobalPropertyCell**>(address)); |
| 282 } |
| 283 |
| 284 |
| 285 JSGlobalPropertyCell* RelocInfo::target_cell() { |
| 286 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 287 Address address = Memory::Address_at(pc_); |
| 288 Object* object = HeapObject::FromAddress( |
| 289 address - JSGlobalPropertyCell::kValueOffset); |
| 290 return reinterpret_cast<JSGlobalPropertyCell*>(object); |
| 291 } |
| 292 |
| 293 |
| 294 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { |
| 295 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 296 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; |
| 297 Memory::Address_at(pc_) = address; |
| 298 } |
| 299 |
| 300 |
| 277 bool RelocInfo::IsPatchedReturnSequence() { | 301 bool RelocInfo::IsPatchedReturnSequence() { |
| 278 // The recognized call sequence is: | 302 // The recognized call sequence is: |
| 279 // movq(kScratchRegister, immediate64); call(kScratchRegister); | 303 // movq(kScratchRegister, immediate64); call(kScratchRegister); |
| 280 // It only needs to be distinguished from a return sequence | 304 // It only needs to be distinguished from a return sequence |
| 281 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 | 305 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 |
| 282 // The 11th byte is int3 (0xCC) in the return sequence and | 306 // The 11th byte is int3 (0xCC) in the return sequence and |
| 283 // REX.WB (0x48+register bit) for the call sequence. | 307 // REX.WB (0x48+register bit) for the call sequence. |
| 284 #ifdef ENABLE_DEBUGGER_SUPPORT | 308 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 285 return pc_[10] != 0xCC; | 309 return pc_[10] != 0xCC; |
| 286 #else | 310 #else |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 ASSERT(len_ == 1 || len_ == 2); | 432 ASSERT(len_ == 1 || len_ == 2); |
| 409 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 433 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
| 410 *p = disp; | 434 *p = disp; |
| 411 len_ += sizeof(int32_t); | 435 len_ += sizeof(int32_t); |
| 412 } | 436 } |
| 413 | 437 |
| 414 | 438 |
| 415 } } // namespace v8::internal | 439 } } // namespace v8::internal |
| 416 | 440 |
| 417 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 441 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
| OLD | NEW |