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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 ICacheFlushMode icache_flush_mode = | 526 ICacheFlushMode icache_flush_mode = |
527 FLUSH_ICACHE_IF_NEEDED) { | 527 FLUSH_ICACHE_IF_NEEDED) { |
528 Address constant_pool = code ? code->constant_pool() : NULL; | 528 Address constant_pool = code ? code->constant_pool() : NULL; |
529 set_target_address_at(pc, constant_pool, target); | 529 set_target_address_at(pc, constant_pool, target); |
530 } | 530 } |
531 | 531 |
532 // Return the code target address at a call site from the return address | 532 // Return the code target address at a call site from the return address |
533 // of that call in the instruction stream. | 533 // of that call in the instruction stream. |
534 inline static Address target_address_from_return_address(Address pc); | 534 inline static Address target_address_from_return_address(Address pc); |
535 | 535 |
536 // Return the code target address of the patch debug break slot | |
537 inline static Address break_address_from_return_address(Address pc); | |
538 | |
539 // This sets the branch destination (which is in the instruction on x86). | 536 // This sets the branch destination (which is in the instruction on x86). |
540 // This is for calls and branches within generated code. | 537 // This is for calls and branches within generated code. |
541 inline static void deserialization_set_special_target_at( | 538 inline static void deserialization_set_special_target_at( |
542 Address instruction_payload, Code* code, Address target) { | 539 Address instruction_payload, Code* code, Address target) { |
543 set_target_address_at(instruction_payload, code, target); | 540 set_target_address_at(instruction_payload, code, target); |
544 } | 541 } |
545 | 542 |
546 // This sets the internal reference at the pc. | 543 // This sets the internal reference at the pc. |
547 inline static void deserialization_set_target_internal_reference_at( | 544 inline static void deserialization_set_target_internal_reference_at( |
548 Address pc, Address target, | 545 Address pc, Address target, |
549 RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE); | 546 RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE); |
550 | 547 |
551 static const int kSpecialTargetSize = kPointerSize; | 548 static const int kSpecialTargetSize = kPointerSize; |
552 | 549 |
553 // Distance between the address of the code target in the call instruction | 550 // Distance between the address of the code target in the call instruction |
554 // and the return address | 551 // and the return address |
555 static const int kCallTargetAddressOffset = kPointerSize; | 552 static const int kCallTargetAddressOffset = kPointerSize; |
556 // Distance between start of patched return sequence and the emitted address | 553 |
557 // to jump to. | 554 static const int kCallInstructionLength = 5; |
558 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. | 555 |
| 556 // The debug break slot must be able to contain a call instruction. |
| 557 static const int kDebugBreakSlotLength = kCallInstructionLength; |
559 | 558 |
560 // Distance between start of patched debug break slot and the emitted address | 559 // Distance between start of patched debug break slot and the emitted address |
561 // to jump to. | 560 // to jump to. |
562 static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32. | 561 static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32. |
563 | 562 |
564 static const int kCallInstructionLength = 5; | |
565 static const int kPatchDebugBreakSlotReturnOffset = kPointerSize; | |
566 static const int kJSReturnSequenceLength = 6; | |
567 | |
568 // The debug break slot must be able to contain a call instruction. | |
569 static const int kDebugBreakSlotLength = kCallInstructionLength; | |
570 | |
571 // One byte opcode for test al, 0xXX. | 563 // One byte opcode for test al, 0xXX. |
572 static const byte kTestAlByte = 0xA8; | 564 static const byte kTestAlByte = 0xA8; |
573 // One byte opcode for nop. | 565 // One byte opcode for nop. |
574 static const byte kNopByte = 0x90; | 566 static const byte kNopByte = 0x90; |
575 | 567 |
576 // One byte opcode for a short unconditional jump. | 568 // One byte opcode for a short unconditional jump. |
577 static const byte kJmpShortOpcode = 0xEB; | 569 static const byte kJmpShortOpcode = 0xEB; |
578 // One byte prefix for a short conditional jump. | 570 // One byte prefix for a short conditional jump. |
579 static const byte kJccShortPrefix = 0x70; | 571 static const byte kJccShortPrefix = 0x70; |
580 static const byte kJncShortOpcode = kJccShortPrefix | not_carry; | 572 static const byte kJncShortOpcode = kJccShortPrefix | not_carry; |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 // Level 1, 2 or 3 specifies CPU cache level. Level 0 specifies a | 1418 // Level 1, 2 or 3 specifies CPU cache level. Level 0 specifies a |
1427 // non-temporal | 1419 // non-temporal |
1428 void prefetch(const Operand& src, int level); | 1420 void prefetch(const Operand& src, int level); |
1429 // TODO(lrn): Need SFENCE for movnt? | 1421 // TODO(lrn): Need SFENCE for movnt? |
1430 | 1422 |
1431 // Check the code size generated from label to here. | 1423 // Check the code size generated from label to here. |
1432 int SizeOfCodeGeneratedSince(Label* label) { | 1424 int SizeOfCodeGeneratedSince(Label* label) { |
1433 return pc_offset() - label->pos(); | 1425 return pc_offset() - label->pos(); |
1434 } | 1426 } |
1435 | 1427 |
1436 // Mark address of the ExitJSFrame code. | |
1437 void RecordJSReturn(); | |
1438 | |
1439 // Mark generator continuation. | 1428 // Mark generator continuation. |
1440 void RecordGeneratorContinuation(); | 1429 void RecordGeneratorContinuation(); |
1441 | 1430 |
1442 // Mark address of a debug break slot. | 1431 // Mark address of a debug break slot. |
1443 void RecordDebugBreakSlot(); | 1432 void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0); |
1444 void RecordDebugBreakSlotForCall(int argc); | |
1445 void RecordDebugBreakSlotForConstructCall(); | |
1446 | 1433 |
1447 // Record a comment relocation entry that can be used by a disassembler. | 1434 // Record a comment relocation entry that can be used by a disassembler. |
1448 // Use --code-comments to enable. | 1435 // Use --code-comments to enable. |
1449 void RecordComment(const char* msg); | 1436 void RecordComment(const char* msg); |
1450 | 1437 |
1451 // Record a deoptimization reason that can be used by a log or cpu profiler. | 1438 // Record a deoptimization reason that can be used by a log or cpu profiler. |
1452 // Use --trace-deopt to enable. | 1439 // Use --trace-deopt to enable. |
1453 void RecordDeoptReason(const int reason, const SourcePosition position); | 1440 void RecordDeoptReason(const int reason, const SourcePosition position); |
1454 | 1441 |
1455 // Writes a single byte or word of data in the code stream. Used for | 1442 // Writes a single byte or word of data in the code stream. Used for |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 private: | 1594 private: |
1608 Assembler* assembler_; | 1595 Assembler* assembler_; |
1609 #ifdef DEBUG | 1596 #ifdef DEBUG |
1610 int space_before_; | 1597 int space_before_; |
1611 #endif | 1598 #endif |
1612 }; | 1599 }; |
1613 | 1600 |
1614 } } // namespace v8::internal | 1601 } } // namespace v8::internal |
1615 | 1602 |
1616 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1603 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |