| OLD | NEW |
| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 451 |
| 452 // Read/Modify the code target in the relative branch/call instruction at pc. | 452 // Read/Modify the code target in the relative branch/call instruction at pc. |
| 453 // On the x64 architecture, we use relative jumps with a 32-bit displacement | 453 // On the x64 architecture, we use relative jumps with a 32-bit displacement |
| 454 // to jump to other Code objects in the Code space in the heap. | 454 // to jump to other Code objects in the Code space in the heap. |
| 455 // Jumps to C functions are done indirectly through a 64-bit register holding | 455 // Jumps to C functions are done indirectly through a 64-bit register holding |
| 456 // the absolute address of the target. | 456 // the absolute address of the target. |
| 457 // These functions convert between absolute Addresses of Code objects and | 457 // These functions convert between absolute Addresses of Code objects and |
| 458 // the relative displacements stored in the code. | 458 // the relative displacements stored in the code. |
| 459 static inline Address target_address_at(Address pc); | 459 static inline Address target_address_at(Address pc); |
| 460 static inline void set_target_address_at(Address pc, Address target); | 460 static inline void set_target_address_at(Address pc, Address target); |
| 461 |
| 461 // This sets the branch destination (which is in the instruction on x64). | 462 // This sets the branch destination (which is in the instruction on x64). |
| 463 // This is for calls and branches within generated code. |
| 462 inline static void set_target_at(Address instruction_payload, | 464 inline static void set_target_at(Address instruction_payload, |
| 463 Address target) { | 465 Address target) { |
| 464 set_target_address_at(instruction_payload, target); | 466 set_target_address_at(instruction_payload, target); |
| 465 } | 467 } |
| 468 |
| 469 // This sets the branch destination (which is a load instruction on x64). |
| 470 // This is for calls and branches to runtime code. |
| 471 inline static void set_external_target_at(Address instruction_payload, |
| 472 Address target) { |
| 473 *reinterpret_cast<Address*>(instruction_payload) = target; |
| 474 } |
| 475 |
| 466 inline Handle<Object> code_target_object_handle_at(Address pc); | 476 inline Handle<Object> code_target_object_handle_at(Address pc); |
| 467 // Number of bytes taken up by the branch target in the code. | 477 // Number of bytes taken up by the branch target in the code. |
| 468 static const int kCallTargetSize = 4; // Use 32-bit displacement. | 478 static const int kCallTargetSize = 4; // Use 32-bit displacement. |
| 479 static const int kExternalTargetSize = 8; // Use 64-bit absolute. |
| 469 // Distance between the address of the code target in the call instruction | 480 // Distance between the address of the code target in the call instruction |
| 470 // and the return address pushed on the stack. | 481 // and the return address pushed on the stack. |
| 471 static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. | 482 static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. |
| 472 // Distance between the start of the JS return sequence and where the | 483 // Distance between the start of the JS return sequence and where the |
| 473 // 32-bit displacement of a near call would be, relative to the pushed | 484 // 32-bit displacement of a near call would be, relative to the pushed |
| 474 // return address. TODO: Use return sequence length instead. | 485 // return address. TODO: Use return sequence length instead. |
| 475 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; | 486 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; |
| 476 static const int kPatchReturnSequenceAddressOffset = 13 - 4; | 487 static const int kPatchReturnSequenceAddressOffset = 13 - 4; |
| 477 // TODO(X64): Rename this, removing the "Real", after changing the above. | 488 // TODO(X64): Rename this, removing the "Real", after changing the above. |
| 478 static const int kRealPatchReturnSequenceAddressOffset = 2; | 489 static const int kRealPatchReturnSequenceAddressOffset = 2; |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 private: | 1387 private: |
| 1377 Assembler* assembler_; | 1388 Assembler* assembler_; |
| 1378 #ifdef DEBUG | 1389 #ifdef DEBUG |
| 1379 int space_before_; | 1390 int space_before_; |
| 1380 #endif | 1391 #endif |
| 1381 }; | 1392 }; |
| 1382 | 1393 |
| 1383 } } // namespace v8::internal | 1394 } } // namespace v8::internal |
| 1384 | 1395 |
| 1385 #endif // V8_X64_ASSEMBLER_X64_H_ | 1396 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |