| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class PostCallGenerator; | 54 class PostCallGenerator; |
| 55 | 55 |
| 56 // MacroAssembler implements a collection of frequently used macros. | 56 // MacroAssembler implements a collection of frequently used macros. |
| 57 class MacroAssembler: public Assembler { | 57 class MacroAssembler: public Assembler { |
| 58 public: | 58 public: |
| 59 MacroAssembler(void* buffer, int size); | 59 MacroAssembler(void* buffer, int size); |
| 60 | 60 |
| 61 // --------------------------------------------------------------------------- | 61 // --------------------------------------------------------------------------- |
| 62 // GC Support | 62 // GC Support |
| 63 | 63 |
| 64 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 65 // For page containing |object| mark region covering |addr| dirty. | 64 // For page containing |object| mark region covering |addr| dirty. |
| 66 // RecordWriteHelper only works if the object is not in new | 65 // RecordWriteHelper only works if the object is not in new |
| 67 // space. | 66 // space. |
| 68 void RecordWriteHelper(Register object, | 67 void RecordWriteHelper(Register object, |
| 69 Register addr, | 68 Register addr, |
| 70 Register scratch); | 69 Register scratch, |
| 70 SaveFPRegsMode save_fp); |
| 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 template <typename LabelType> |
| 75 void InNewSpace(Register object, | 75 void InNewSpace(Register object, |
| 76 Register scratch, | 76 Register scratch, |
| 77 Condition cc, // equal for new space, not_equal otherwise. | 77 Condition cc, // equal for new space, not_equal otherwise. |
| 78 LabelType* branch); | 78 LabelType* branch); |
| 79 | 79 |
| 80 // For page containing |object| mark region covering [object+offset] | 80 // For page containing |object| mark region covering [object+offset] |
| 81 // dirty. |object| is the object being stored into, |value| is the | 81 // dirty. |object| is the object being stored into, |value| is the |
| 82 // object being stored. If offset is zero, then the scratch register | 82 // object being stored. If offset is zero, then the scratch register |
| 83 // contains the array index into the elements array represented as a | 83 // contains the array index into the elements array represented as a |
| 84 // Smi. All registers are clobbered by the operation. RecordWrite | 84 // Smi. All registers are clobbered by the operation. RecordWrite |
| 85 // 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 |
| 86 // value is a smi. | 86 // value is a smi. |
| 87 void RecordWrite(Register object, | 87 void RecordWrite(Register object, |
| 88 int offset, | 88 int offset, |
| 89 Register value, | 89 Register value, |
| 90 Register scratch); | 90 Register scratch, |
| 91 SaveFPRegsMode save_fp); |
| 91 | 92 |
| 92 // For page containing |object| mark region covering |address| | 93 // For page containing |object| mark region covering |address| |
| 93 // dirty. |object| is the object being stored into, |value| is the | 94 // dirty. |object| is the object being stored into, |value| is the |
| 94 // object being stored. All registers are clobbered by the | 95 // object being stored. All registers are clobbered by the |
| 95 // operation. RecordWrite filters out smis so it does not update the | 96 // operation. RecordWrite filters out smis so it does not update the |
| 96 // write barrier if the value is a smi. | 97 // write barrier if the value is a smi. |
| 97 void RecordWrite(Register object, | 98 void RecordWrite(Register object, |
| 98 Register address, | 99 Register address, |
| 99 Register value); | 100 Register value, |
| 100 #endif | 101 SaveFPRegsMode save_fp); |
| 101 | 102 |
| 102 #ifdef ENABLE_DEBUGGER_SUPPORT | 103 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 103 // --------------------------------------------------------------------------- | 104 // --------------------------------------------------------------------------- |
| 104 // Debugger Support | 105 // Debugger Support |
| 105 | 106 |
| 106 void DebugBreak(); | 107 void DebugBreak(); |
| 107 #endif | 108 #endif |
| 108 | 109 |
| 109 // --------------------------------------------------------------------------- | 110 // --------------------------------------------------------------------------- |
| 110 // Activation frames | 111 // Activation frames |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 655 |
| 655 // Helper for PopHandleScope. Allowed to perform a GC and returns | 656 // Helper for PopHandleScope. Allowed to perform a GC and returns |
| 656 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and | 657 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and |
| 657 // possibly returns a failure object indicating an allocation failure. | 658 // possibly returns a failure object indicating an allocation failure. |
| 658 MUST_USE_RESULT MaybeObject* PopHandleScopeHelper(Register saved, | 659 MUST_USE_RESULT MaybeObject* PopHandleScopeHelper(Register saved, |
| 659 Register scratch, | 660 Register scratch, |
| 660 bool gc_allowed); | 661 bool gc_allowed); |
| 661 }; | 662 }; |
| 662 | 663 |
| 663 | 664 |
| 664 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 665 template <typename LabelType> | 665 template <typename LabelType> |
| 666 void MacroAssembler::InNewSpace(Register object, | 666 void MacroAssembler::InNewSpace(Register object, |
| 667 Register scratch, | 667 Register scratch, |
| 668 Condition cc, | 668 Condition cc, |
| 669 LabelType* branch) { | 669 LabelType* branch) { |
| 670 ASSERT(cc == equal || cc == not_equal); | 670 ASSERT(cc == equal || cc == not_equal); |
| 671 if (Serializer::enabled()) { | 671 if (Serializer::enabled()) { |
| 672 // Can't do arithmetic on external references if it might get serialized. | 672 // Can't do arithmetic on external references if it might get serialized. |
| 673 mov(scratch, Operand(object)); | 673 mov(scratch, Operand(object)); |
| 674 // The mask isn't really an address. We load it as an external reference in | 674 // The mask isn't really an address. We load it as an external reference in |
| 675 // case the size of the new space is different between the snapshot maker | 675 // case the size of the new space is different between the snapshot maker |
| 676 // and the running system. | 676 // and the running system. |
| 677 and_(Operand(scratch), Immediate(ExternalReference::new_space_mask())); | 677 and_(Operand(scratch), Immediate(ExternalReference::new_space_mask())); |
| 678 cmp(Operand(scratch), Immediate(ExternalReference::new_space_start())); | 678 cmp(Operand(scratch), Immediate(ExternalReference::new_space_start())); |
| 679 j(cc, branch); | 679 j(cc, branch); |
| 680 } else { | 680 } else { |
| 681 int32_t new_space_start = reinterpret_cast<int32_t>( | 681 int32_t new_space_start = reinterpret_cast<int32_t>( |
| 682 ExternalReference::new_space_start().address()); | 682 ExternalReference::new_space_start().address()); |
| 683 lea(scratch, Operand(object, -new_space_start)); | 683 lea(scratch, Operand(object, -new_space_start)); |
| 684 and_(scratch, Heap::NewSpaceMask()); | 684 and_(scratch, Heap::NewSpaceMask()); |
| 685 j(cc, branch); | 685 j(cc, branch); |
| 686 } | 686 } |
| 687 } | 687 } |
| 688 #endif | |
| 689 | 688 |
| 690 | 689 |
| 691 // The code patcher is used to patch (typically) small parts of code e.g. for | 690 // The code patcher is used to patch (typically) small parts of code e.g. for |
| 692 // debugging and other types of instrumentation. When using the code patcher | 691 // debugging and other types of instrumentation. When using the code patcher |
| 693 // the exact number of bytes specified must be emitted. Is not legal to emit | 692 // the exact number of bytes specified must be emitted. Is not legal to emit |
| 694 // relocation information. If any of these constraints are violated it causes | 693 // relocation information. If any of these constraints are violated it causes |
| 695 // an assertion. | 694 // an assertion. |
| 696 class CodePatcher { | 695 class CodePatcher { |
| 697 public: | 696 public: |
| 698 CodePatcher(byte* address, int size); | 697 CodePatcher(byte* address, int size); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 } \ | 768 } \ |
| 770 masm-> | 769 masm-> |
| 771 #else | 770 #else |
| 772 #define ACCESS_MASM(masm) masm-> | 771 #define ACCESS_MASM(masm) masm-> |
| 773 #endif | 772 #endif |
| 774 | 773 |
| 775 | 774 |
| 776 } } // namespace v8::internal | 775 } } // namespace v8::internal |
| 777 | 776 |
| 778 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 777 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |