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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 ICacheFlushMode icache_flush_mode = | 517 ICacheFlushMode icache_flush_mode = |
518 FLUSH_ICACHE_IF_NEEDED) { | 518 FLUSH_ICACHE_IF_NEEDED) { |
519 Address constant_pool = code ? code->constant_pool() : NULL; | 519 Address constant_pool = code ? code->constant_pool() : NULL; |
520 set_target_address_at(pc, constant_pool, target); | 520 set_target_address_at(pc, constant_pool, target); |
521 } | 521 } |
522 | 522 |
523 // Return the code target address at a call site from the return address | 523 // Return the code target address at a call site from the return address |
524 // of that call in the instruction stream. | 524 // of that call in the instruction stream. |
525 inline static Address target_address_from_return_address(Address pc); | 525 inline static Address target_address_from_return_address(Address pc); |
526 | 526 |
527 // Return the code target address of the patch debug break slot | |
528 inline static Address break_address_from_return_address(Address pc); | |
529 | |
530 // This sets the branch destination (which is in the instruction on x86). | 527 // This sets the branch destination (which is in the instruction on x86). |
531 // This is for calls and branches within generated code. | 528 // This is for calls and branches within generated code. |
532 inline static void deserialization_set_special_target_at( | 529 inline static void deserialization_set_special_target_at( |
533 Address instruction_payload, Code* code, Address target) { | 530 Address instruction_payload, Code* code, Address target) { |
534 set_target_address_at(instruction_payload, code, target); | 531 set_target_address_at(instruction_payload, code, target); |
535 } | 532 } |
536 | 533 |
537 // This sets the internal reference at the pc. | 534 // This sets the internal reference at the pc. |
538 inline static void deserialization_set_target_internal_reference_at( | 535 inline static void deserialization_set_target_internal_reference_at( |
539 Address pc, Address target, | 536 Address pc, Address target, |
540 RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE); | 537 RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE); |
541 | 538 |
542 static const int kSpecialTargetSize = kPointerSize; | 539 static const int kSpecialTargetSize = kPointerSize; |
543 | 540 |
544 // Distance between the address of the code target in the call instruction | 541 // Distance between the address of the code target in the call instruction |
545 // and the return address | 542 // and the return address |
546 static const int kCallTargetAddressOffset = kPointerSize; | 543 static const int kCallTargetAddressOffset = kPointerSize; |
547 // Distance between start of patched return sequence and the emitted address | 544 |
548 // to jump to. | 545 static const int kCallInstructionLength = 5; |
549 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. | 546 |
| 547 // The debug break slot must be able to contain a call instruction. |
| 548 static const int kDebugBreakSlotLength = kCallInstructionLength; |
550 | 549 |
551 // Distance between start of patched debug break slot and the emitted address | 550 // Distance between start of patched debug break slot and the emitted address |
552 // to jump to. | 551 // to jump to. |
553 static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32. | 552 static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32. |
554 | 553 |
555 static const int kCallInstructionLength = 5; | |
556 static const int kPatchDebugBreakSlotReturnOffset = kPointerSize; | |
557 static const int kJSReturnSequenceLength = 6; | |
558 | |
559 // The debug break slot must be able to contain a call instruction. | |
560 static const int kDebugBreakSlotLength = kCallInstructionLength; | |
561 | |
562 // One byte opcode for test al, 0xXX. | 554 // One byte opcode for test al, 0xXX. |
563 static const byte kTestAlByte = 0xA8; | 555 static const byte kTestAlByte = 0xA8; |
564 // One byte opcode for nop. | 556 // One byte opcode for nop. |
565 static const byte kNopByte = 0x90; | 557 static const byte kNopByte = 0x90; |
566 | 558 |
567 // One byte opcode for a short unconditional jump. | 559 // One byte opcode for a short unconditional jump. |
568 static const byte kJmpShortOpcode = 0xEB; | 560 static const byte kJmpShortOpcode = 0xEB; |
569 // One byte prefix for a short conditional jump. | 561 // One byte prefix for a short conditional jump. |
570 static const byte kJccShortPrefix = 0x70; | 562 static const byte kJccShortPrefix = 0x70; |
571 static const byte kJncShortOpcode = kJccShortPrefix | not_carry; | 563 static const byte kJncShortOpcode = kJccShortPrefix | not_carry; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 | 936 |
945 void cpuid(); | 937 void cpuid(); |
946 | 938 |
947 // TODO(lrn): Need SFENCE for movnt? | 939 // TODO(lrn): Need SFENCE for movnt? |
948 | 940 |
949 // Check the code size generated from label to here. | 941 // Check the code size generated from label to here. |
950 int SizeOfCodeGeneratedSince(Label* label) { | 942 int SizeOfCodeGeneratedSince(Label* label) { |
951 return pc_offset() - label->pos(); | 943 return pc_offset() - label->pos(); |
952 } | 944 } |
953 | 945 |
954 // Mark address of the ExitJSFrame code. | |
955 void RecordJSReturn(); | |
956 | |
957 // Mark generator continuation. | 946 // Mark generator continuation. |
958 void RecordGeneratorContinuation(); | 947 void RecordGeneratorContinuation(); |
959 | 948 |
960 // Mark address of a debug break slot. | 949 // Mark address of a debug break slot. |
961 void RecordDebugBreakSlot(); | 950 void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0); |
962 void RecordDebugBreakSlotForCall(int argc); | |
963 void RecordDebugBreakSlotForConstructCall(); | |
964 | 951 |
965 // Record a comment relocation entry that can be used by a disassembler. | 952 // Record a comment relocation entry that can be used by a disassembler. |
966 // Use --code-comments to enable. | 953 // Use --code-comments to enable. |
967 void RecordComment(const char* msg); | 954 void RecordComment(const char* msg); |
968 | 955 |
969 // Record a deoptimization reason that can be used by a log or cpu profiler. | 956 // Record a deoptimization reason that can be used by a log or cpu profiler. |
970 // Use --trace-deopt to enable. | 957 // Use --trace-deopt to enable. |
971 void RecordDeoptReason(const int reason, const SourcePosition position); | 958 void RecordDeoptReason(const int reason, const SourcePosition position); |
972 | 959 |
973 // Writes a single byte or word of data in the code stream. Used for | 960 // Writes a single byte or word of data in the code stream. Used for |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 private: | 1092 private: |
1106 Assembler* assembler_; | 1093 Assembler* assembler_; |
1107 #ifdef DEBUG | 1094 #ifdef DEBUG |
1108 int space_before_; | 1095 int space_before_; |
1109 #endif | 1096 #endif |
1110 }; | 1097 }; |
1111 | 1098 |
1112 } } // namespace v8::internal | 1099 } } // namespace v8::internal |
1113 | 1100 |
1114 #endif // V8_X87_ASSEMBLER_X87_H_ | 1101 #endif // V8_X87_ASSEMBLER_X87_H_ |
OLD | NEW |