| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | 64 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
| 65 // For page containing |object| mark region covering |addr| dirty. | 65 // For page containing |object| mark region covering |addr| dirty. |
| 66 // RecordWriteHelper only works if the object is not in new | 66 // RecordWriteHelper only works if the object is not in new |
| 67 // space. | 67 // space. |
| 68 void RecordWriteHelper(Register object, | 68 void RecordWriteHelper(Register object, |
| 69 Register addr, | 69 Register addr, |
| 70 Register scratch); | 70 Register scratch); |
| 71 | 71 |
| 72 // Check if object is in new space. | 72 // Check if object is in new space. |
| 73 // scratch can be object itself, but it will be clobbered. | 73 // scratch can be object itself, but it will be clobbered. |
| 74 template <typename LabelType> |
| 74 void InNewSpace(Register object, | 75 void InNewSpace(Register object, |
| 75 Register scratch, | 76 Register scratch, |
| 76 Condition cc, // equal for new space, not_equal otherwise. | 77 Condition cc, // equal for new space, not_equal otherwise. |
| 77 Label* branch); | 78 LabelType* branch); |
| 78 | 79 |
| 79 // For page containing |object| mark region covering [object+offset] | 80 // For page containing |object| mark region covering [object+offset] |
| 80 // dirty. |object| is the object being stored into, |value| is the | 81 // dirty. |object| is the object being stored into, |value| is the |
| 81 // object being stored. If offset is zero, then the scratch register | 82 // object being stored. If offset is zero, then the scratch register |
| 82 // contains the array index into the elements array represented as a | 83 // contains the array index into the elements array represented as a |
| 83 // Smi. All registers are clobbered by the operation. RecordWrite | 84 // Smi. All registers are clobbered by the operation. RecordWrite |
| 84 // filters out smis so it does not update the write barrier if the | 85 // filters out smis so it does not update the write barrier if the |
| 85 // value is a smi. | 86 // value is a smi. |
| 86 void RecordWrite(Register object, | 87 void RecordWrite(Register object, |
| 87 int offset, | 88 int offset, |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 654 |
| 654 // Helper for PopHandleScope. Allowed to perform a GC and returns | 655 // Helper for PopHandleScope. Allowed to perform a GC and returns |
| 655 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and | 656 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and |
| 656 // possibly returns a failure object indicating an allocation failure. | 657 // possibly returns a failure object indicating an allocation failure. |
| 657 MUST_USE_RESULT MaybeObject* PopHandleScopeHelper(Register saved, | 658 MUST_USE_RESULT MaybeObject* PopHandleScopeHelper(Register saved, |
| 658 Register scratch, | 659 Register scratch, |
| 659 bool gc_allowed); | 660 bool gc_allowed); |
| 660 }; | 661 }; |
| 661 | 662 |
| 662 | 663 |
| 664 template <typename LabelType> |
| 665 void MacroAssembler::InNewSpace(Register object, |
| 666 Register scratch, |
| 667 Condition cc, |
| 668 LabelType* branch) { |
| 669 ASSERT(cc == equal || cc == not_equal); |
| 670 if (Serializer::enabled()) { |
| 671 // Can't do arithmetic on external references if it might get serialized. |
| 672 mov(scratch, Operand(object)); |
| 673 // The mask isn't really an address. We load it as an external reference in |
| 674 // case the size of the new space is different between the snapshot maker |
| 675 // and the running system. |
| 676 and_(Operand(scratch), Immediate(ExternalReference::new_space_mask())); |
| 677 cmp(Operand(scratch), Immediate(ExternalReference::new_space_start())); |
| 678 j(cc, branch); |
| 679 } else { |
| 680 int32_t new_space_start = reinterpret_cast<int32_t>( |
| 681 ExternalReference::new_space_start().address()); |
| 682 lea(scratch, Operand(object, -new_space_start)); |
| 683 and_(scratch, Heap::NewSpaceMask()); |
| 684 j(cc, branch); |
| 685 } |
| 686 } |
| 687 |
| 688 |
| 663 // The code patcher is used to patch (typically) small parts of code e.g. for | 689 // The code patcher is used to patch (typically) small parts of code e.g. for |
| 664 // debugging and other types of instrumentation. When using the code patcher | 690 // debugging and other types of instrumentation. When using the code patcher |
| 665 // the exact number of bytes specified must be emitted. Is not legal to emit | 691 // the exact number of bytes specified must be emitted. Is not legal to emit |
| 666 // relocation information. If any of these constraints are violated it causes | 692 // relocation information. If any of these constraints are violated it causes |
| 667 // an assertion. | 693 // an assertion. |
| 668 class CodePatcher { | 694 class CodePatcher { |
| 669 public: | 695 public: |
| 670 CodePatcher(byte* address, int size); | 696 CodePatcher(byte* address, int size); |
| 671 virtual ~CodePatcher(); | 697 virtual ~CodePatcher(); |
| 672 | 698 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 } \ | 767 } \ |
| 742 masm-> | 768 masm-> |
| 743 #else | 769 #else |
| 744 #define ACCESS_MASM(masm) masm-> | 770 #define ACCESS_MASM(masm) masm-> |
| 745 #endif | 771 #endif |
| 746 | 772 |
| 747 | 773 |
| 748 } } // namespace v8::internal | 774 } } // namespace v8::internal |
| 749 | 775 |
| 750 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 776 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |