| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // For page containing |object| mark region covering |addr| dirty. | 64 // For page containing |object| mark region covering |addr| dirty. |
| 65 // RecordWriteHelper only works if the object is not in new | 65 // RecordWriteHelper only works if the object is not in new |
| 66 // space. | 66 // space. |
| 67 void RecordWriteHelper(Register object, | 67 void RecordWriteHelper(Register object, |
| 68 Register addr, | 68 Register addr, |
| 69 Register scratch); | 69 Register scratch); |
| 70 | 70 |
| 71 // Check if object is in new space. | 71 // Check if object is in new space. |
| 72 // scratch can be object itself, but it will be clobbered. | 72 // scratch can be object itself, but it will be clobbered. |
| 73 template <typename LabelType> | |
| 74 void InNewSpace(Register object, | 73 void InNewSpace(Register object, |
| 75 Register scratch, | 74 Register scratch, |
| 76 Condition cc, // equal for new space, not_equal otherwise. | 75 Condition cc, // equal for new space, not_equal otherwise. |
| 77 LabelType* branch); | 76 Label* branch, |
| 77 Label::Distance branch_near = Label::kFar); |
| 78 | 78 |
| 79 // For page containing |object| mark region covering [object+offset] | 79 // For page containing |object| mark region covering [object+offset] |
| 80 // dirty. |object| is the object being stored into, |value| is the | 80 // dirty. |object| is the object being stored into, |value| is the |
| 81 // object being stored. If offset is zero, then the scratch register | 81 // object being stored. If offset is zero, then the scratch register |
| 82 // contains the array index into the elements array represented as a | 82 // contains the array index into the elements array represented as a |
| 83 // Smi. All registers are clobbered by the operation. RecordWrite | 83 // Smi. All registers are clobbered by the operation. RecordWrite |
| 84 // filters out smis so it does not update the write barrier if the | 84 // filters out smis so it does not update the write barrier if the |
| 85 // value is a smi. | 85 // value is a smi. |
| 86 void RecordWrite(Register object, | 86 void RecordWrite(Register object, |
| 87 int offset, | 87 int offset, |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 bool generating_stub_; | 640 bool generating_stub_; |
| 641 bool allow_stub_calls_; | 641 bool allow_stub_calls_; |
| 642 // This handle will be patched with the code object on installation. | 642 // This handle will be patched with the code object on installation. |
| 643 Handle<Object> code_object_; | 643 Handle<Object> code_object_; |
| 644 | 644 |
| 645 // Helper functions for generating invokes. | 645 // Helper functions for generating invokes. |
| 646 void InvokePrologue(const ParameterCount& expected, | 646 void InvokePrologue(const ParameterCount& expected, |
| 647 const ParameterCount& actual, | 647 const ParameterCount& actual, |
| 648 Handle<Code> code_constant, | 648 Handle<Code> code_constant, |
| 649 const Operand& code_operand, | 649 const Operand& code_operand, |
| 650 NearLabel* done, | 650 Label* done, |
| 651 InvokeFlag flag, | 651 InvokeFlag flag, |
| 652 Label::Distance done_near = Label::kFar, |
| 652 const CallWrapper& call_wrapper = NullCallWrapper()); | 653 const CallWrapper& call_wrapper = NullCallWrapper()); |
| 653 | 654 |
| 654 // Activation support. | 655 // Activation support. |
| 655 void EnterFrame(StackFrame::Type type); | 656 void EnterFrame(StackFrame::Type type); |
| 656 void LeaveFrame(StackFrame::Type type); | 657 void LeaveFrame(StackFrame::Type type); |
| 657 | 658 |
| 658 void EnterExitFramePrologue(); | 659 void EnterExitFramePrologue(); |
| 659 void EnterExitFrameEpilogue(int argc, bool save_doubles); | 660 void EnterExitFrameEpilogue(int argc, bool save_doubles); |
| 660 | 661 |
| 661 void LeaveExitFrameEpilogue(); | 662 void LeaveExitFrameEpilogue(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 677 // Compute memory operands for safepoint stack slots. | 678 // Compute memory operands for safepoint stack slots. |
| 678 Operand SafepointRegisterSlot(Register reg); | 679 Operand SafepointRegisterSlot(Register reg); |
| 679 static int SafepointRegisterStackIndex(int reg_code); | 680 static int SafepointRegisterStackIndex(int reg_code); |
| 680 | 681 |
| 681 // Needs access to SafepointRegisterStackIndex for optimized frame | 682 // Needs access to SafepointRegisterStackIndex for optimized frame |
| 682 // traversal. | 683 // traversal. |
| 683 friend class OptimizedFrame; | 684 friend class OptimizedFrame; |
| 684 }; | 685 }; |
| 685 | 686 |
| 686 | 687 |
| 687 template <typename LabelType> | |
| 688 void MacroAssembler::InNewSpace(Register object, | |
| 689 Register scratch, | |
| 690 Condition cc, | |
| 691 LabelType* branch) { | |
| 692 ASSERT(cc == equal || cc == not_equal); | |
| 693 if (Serializer::enabled()) { | |
| 694 // Can't do arithmetic on external references if it might get serialized. | |
| 695 mov(scratch, Operand(object)); | |
| 696 // The mask isn't really an address. We load it as an external reference in | |
| 697 // case the size of the new space is different between the snapshot maker | |
| 698 // and the running system. | |
| 699 and_(Operand(scratch), | |
| 700 Immediate(ExternalReference::new_space_mask(isolate()))); | |
| 701 cmp(Operand(scratch), | |
| 702 Immediate(ExternalReference::new_space_start(isolate()))); | |
| 703 j(cc, branch); | |
| 704 } else { | |
| 705 int32_t new_space_start = reinterpret_cast<int32_t>( | |
| 706 ExternalReference::new_space_start(isolate()).address()); | |
| 707 lea(scratch, Operand(object, -new_space_start)); | |
| 708 and_(scratch, isolate()->heap()->NewSpaceMask()); | |
| 709 j(cc, branch); | |
| 710 } | |
| 711 } | |
| 712 | |
| 713 | |
| 714 // The code patcher is used to patch (typically) small parts of code e.g. for | 688 // The code patcher is used to patch (typically) small parts of code e.g. for |
| 715 // debugging and other types of instrumentation. When using the code patcher | 689 // debugging and other types of instrumentation. When using the code patcher |
| 716 // the exact number of bytes specified must be emitted. Is not legal to emit | 690 // the exact number of bytes specified must be emitted. Is not legal to emit |
| 717 // relocation information. If any of these constraints are violated it causes | 691 // relocation information. If any of these constraints are violated it causes |
| 718 // an assertion. | 692 // an assertion. |
| 719 class CodePatcher { | 693 class CodePatcher { |
| 720 public: | 694 public: |
| 721 CodePatcher(byte* address, int size); | 695 CodePatcher(byte* address, int size); |
| 722 virtual ~CodePatcher(); | 696 virtual ~CodePatcher(); |
| 723 | 697 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 } \ | 755 } \ |
| 782 masm-> | 756 masm-> |
| 783 #else | 757 #else |
| 784 #define ACCESS_MASM(masm) masm-> | 758 #define ACCESS_MASM(masm) masm-> |
| 785 #endif | 759 #endif |
| 786 | 760 |
| 787 | 761 |
| 788 } } // namespace v8::internal | 762 } } // namespace v8::internal |
| 789 | 763 |
| 790 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 764 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |