| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Store an object to the root table. | 132 // Store an object to the root table. |
| 133 void StoreRoot(Register source, | 133 void StoreRoot(Register source, |
| 134 Heap::RootListIndex index, | 134 Heap::RootListIndex index, |
| 135 Condition cond = al); | 135 Condition cond = al); |
| 136 | 136 |
| 137 | 137 |
| 138 // Check if object is in new space. | 138 // Check if object is in new space. |
| 139 // scratch can be object itself, but it will be clobbered. | 139 // scratch can be object itself, but it will be clobbered. |
| 140 void InNewSpace(Register object, | 140 void InNewSpace(Register object, |
| 141 Register scratch, | 141 Register scratch, |
| 142 Condition cc, // eq for new space, ne otherwise | 142 Condition cond, // eq for new space, ne otherwise |
| 143 Label* branch); | 143 Label* branch); |
| 144 | 144 |
| 145 | 145 |
| 146 // For the page containing |object| mark the region covering [address] | 146 // For the page containing |object| mark the region covering [address] |
| 147 // dirty. The object address must be in the first 8K of an allocated page. | 147 // dirty. The object address must be in the first 8K of an allocated page. |
| 148 void RecordWriteHelper(Register object, | 148 void RecordWriteHelper(Register object, |
| 149 Register address, | 149 Register address, |
| 150 Register scratch); | 150 Register scratch); |
| 151 | 151 |
| 152 // For the page containing |object| mark the region covering | 152 // For the page containing |object| mark the region covering |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } else { | 225 } else { |
| 226 str(src1, MemOperand(sp, 4, NegPreIndex), cond); | 226 str(src1, MemOperand(sp, 4, NegPreIndex), cond); |
| 227 Push(src2, src3, src4, cond); | 227 Push(src2, src3, src4, cond); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 // Push and pop the registers that can hold pointers, as defined by the | 231 // Push and pop the registers that can hold pointers, as defined by the |
| 232 // RegList constant kSafepointSavedRegisters. | 232 // RegList constant kSafepointSavedRegisters. |
| 233 void PushSafepointRegisters(); | 233 void PushSafepointRegisters(); |
| 234 void PopSafepointRegisters(); | 234 void PopSafepointRegisters(); |
| 235 void PushSafepointRegistersAndDoubles(); |
| 236 void PopSafepointRegistersAndDoubles(); |
| 237 void StoreToSafepointRegisterSlot(Register reg); |
| 235 static int SafepointRegisterStackIndex(int reg_code); | 238 static int SafepointRegisterStackIndex(int reg_code); |
| 239 static MemOperand SafepointRegisterSlot(Register reg); |
| 236 | 240 |
| 237 // Load two consecutive registers with two consecutive memory locations. | 241 // Load two consecutive registers with two consecutive memory locations. |
| 238 void Ldrd(Register dst1, | 242 void Ldrd(Register dst1, |
| 239 Register dst2, | 243 Register dst2, |
| 240 const MemOperand& src, | 244 const MemOperand& src, |
| 241 Condition cond = al); | 245 Condition cond = al); |
| 242 | 246 |
| 243 // Store two consecutive registers to two consecutive memory locations. | 247 // Store two consecutive registers to two consecutive memory locations. |
| 244 void Strd(Register src1, | 248 void Strd(Register src1, |
| 245 Register src2, | 249 Register src2, |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 Condition IsObjectStringType(Register obj, | 538 Condition IsObjectStringType(Register obj, |
| 535 Register type) { | 539 Register type) { |
| 536 ldr(type, FieldMemOperand(obj, HeapObject::kMapOffset)); | 540 ldr(type, FieldMemOperand(obj, HeapObject::kMapOffset)); |
| 537 ldrb(type, FieldMemOperand(type, Map::kInstanceTypeOffset)); | 541 ldrb(type, FieldMemOperand(type, Map::kInstanceTypeOffset)); |
| 538 tst(type, Operand(kIsNotStringMask)); | 542 tst(type, Operand(kIsNotStringMask)); |
| 539 ASSERT_EQ(0, kStringTag); | 543 ASSERT_EQ(0, kStringTag); |
| 540 return eq; | 544 return eq; |
| 541 } | 545 } |
| 542 | 546 |
| 543 | 547 |
| 544 inline void BranchOnSmi(Register value, Label* smi_label) { | |
| 545 tst(value, Operand(kSmiTagMask)); | |
| 546 b(eq, smi_label); | |
| 547 } | |
| 548 | |
| 549 inline void BranchOnNotSmi(Register value, Label* not_smi_label) { | |
| 550 tst(value, Operand(kSmiTagMask)); | |
| 551 b(ne, not_smi_label); | |
| 552 } | |
| 553 | |
| 554 // Generates code for reporting that an illegal operation has | 548 // Generates code for reporting that an illegal operation has |
| 555 // occurred. | 549 // occurred. |
| 556 void IllegalOperation(int num_arguments); | 550 void IllegalOperation(int num_arguments); |
| 557 | 551 |
| 558 // Picks out an array index from the hash field. | 552 // Picks out an array index from the hash field. |
| 559 // Register use: | 553 // Register use: |
| 560 // hash - holds the index's hash. Clobbered. | 554 // hash - holds the index's hash. Clobbered. |
| 561 // index - holds the overwritten index on exit. | 555 // index - holds the overwritten index on exit. |
| 562 void IndexFromHash(Register hash, Register index); | 556 void IndexFromHash(Register hash, Register index); |
| 563 | 557 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 Register scratch1, Register scratch2); | 678 Register scratch1, Register scratch2); |
| 685 void IncrementCounter(StatsCounter* counter, int value, | 679 void IncrementCounter(StatsCounter* counter, int value, |
| 686 Register scratch1, Register scratch2); | 680 Register scratch1, Register scratch2); |
| 687 void DecrementCounter(StatsCounter* counter, int value, | 681 void DecrementCounter(StatsCounter* counter, int value, |
| 688 Register scratch1, Register scratch2); | 682 Register scratch1, Register scratch2); |
| 689 | 683 |
| 690 | 684 |
| 691 // --------------------------------------------------------------------------- | 685 // --------------------------------------------------------------------------- |
| 692 // Debugging | 686 // Debugging |
| 693 | 687 |
| 694 // Calls Abort(msg) if the condition cc is not satisfied. | 688 // Calls Abort(msg) if the condition cond is not satisfied. |
| 695 // Use --debug_code to enable. | 689 // Use --debug_code to enable. |
| 696 void Assert(Condition cc, const char* msg); | 690 void Assert(Condition cond, const char* msg); |
| 697 void AssertRegisterIsRoot(Register reg, Heap::RootListIndex index); | 691 void AssertRegisterIsRoot(Register reg, Heap::RootListIndex index); |
| 698 void AssertFastElements(Register elements); | 692 void AssertFastElements(Register elements); |
| 699 | 693 |
| 700 // Like Assert(), but always enabled. | 694 // Like Assert(), but always enabled. |
| 701 void Check(Condition cc, const char* msg); | 695 void Check(Condition cond, const char* msg); |
| 702 | 696 |
| 703 // Print a message to stdout and abort execution. | 697 // Print a message to stdout and abort execution. |
| 704 void Abort(const char* msg); | 698 void Abort(const char* msg); |
| 705 | 699 |
| 706 // Verify restrictions about code generated in stubs. | 700 // Verify restrictions about code generated in stubs. |
| 707 void set_generating_stub(bool value) { generating_stub_ = value; } | 701 void set_generating_stub(bool value) { generating_stub_ = value; } |
| 708 bool generating_stub() { return generating_stub_; } | 702 bool generating_stub() { return generating_stub_; } |
| 709 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 703 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
| 710 bool allow_stub_calls() { return allow_stub_calls_; } | 704 bool allow_stub_calls() { return allow_stub_calls_; } |
| 711 | 705 |
| 712 // --------------------------------------------------------------------------- | 706 // --------------------------------------------------------------------------- |
| 713 // Smi utilities | 707 // Smi utilities |
| 714 | 708 |
| 715 void SmiTag(Register reg, SBit s = LeaveCC) { | 709 void SmiTag(Register reg, SBit s = LeaveCC) { |
| 716 add(reg, reg, Operand(reg), s); | 710 add(reg, reg, Operand(reg), s); |
| 717 } | 711 } |
| 712 void SmiTag(Register dst, Register src, SBit s = LeaveCC) { |
| 713 add(dst, src, Operand(src), s); |
| 714 } |
| 715 |
| 716 // Try to convert int32 to smi. If the value is to large, preserve |
| 717 // the original value and jump to not_a_smi. Destroys scratch and |
| 718 // sets flags. |
| 719 void TrySmiTag(Register reg, Label* not_a_smi, Register scratch) { |
| 720 mov(scratch, reg); |
| 721 SmiTag(scratch, SetCC); |
| 722 b(vs, not_a_smi); |
| 723 mov(reg, scratch); |
| 724 } |
| 718 | 725 |
| 719 void SmiUntag(Register reg) { | 726 void SmiUntag(Register reg) { |
| 720 mov(reg, Operand(reg, ASR, kSmiTagSize)); | 727 mov(reg, Operand(reg, ASR, kSmiTagSize)); |
| 721 } | 728 } |
| 729 void SmiUntag(Register dst, Register src) { |
| 730 mov(dst, Operand(src, ASR, kSmiTagSize)); |
| 731 } |
| 722 | 732 |
| 733 // Jump the register contains a smi. |
| 734 inline void JumpIfSmi(Register value, Label* smi_label) { |
| 735 tst(value, Operand(kSmiTagMask)); |
| 736 b(eq, smi_label); |
| 737 } |
| 738 // Jump if either of the registers contain a non-smi. |
| 739 inline void JumpIfNotSmi(Register value, Label* not_smi_label) { |
| 740 tst(value, Operand(kSmiTagMask)); |
| 741 b(ne, not_smi_label); |
| 742 } |
| 723 // Jump if either of the registers contain a non-smi. | 743 // Jump if either of the registers contain a non-smi. |
| 724 void JumpIfNotBothSmi(Register reg1, Register reg2, Label* on_not_both_smi); | 744 void JumpIfNotBothSmi(Register reg1, Register reg2, Label* on_not_both_smi); |
| 725 // Jump if either of the registers contain a smi. | 745 // Jump if either of the registers contain a smi. |
| 726 void JumpIfEitherSmi(Register reg1, Register reg2, Label* on_either_smi); | 746 void JumpIfEitherSmi(Register reg1, Register reg2, Label* on_either_smi); |
| 727 | 747 |
| 728 // Abort execution if argument is a smi. Used in debug code. | 748 // Abort execution if argument is a smi. Used in debug code. |
| 729 void AbortIfSmi(Register object); | 749 void AbortIfSmi(Register object); |
| 750 void AbortIfNotSmi(Register object); |
| 751 |
| 752 // --------------------------------------------------------------------------- |
| 753 // HeapNumber utilities |
| 754 |
| 755 void JumpIfNotHeapNumber(Register object, |
| 756 Register heap_number_map, |
| 757 Register scratch, |
| 758 Label* on_not_heap_number); |
| 730 | 759 |
| 731 // --------------------------------------------------------------------------- | 760 // --------------------------------------------------------------------------- |
| 732 // String utilities | 761 // String utilities |
| 733 | 762 |
| 734 // Checks if both objects are sequential ASCII strings and jumps to label | 763 // Checks if both objects are sequential ASCII strings and jumps to label |
| 735 // if either is not. Assumes that neither object is a smi. | 764 // if either is not. Assumes that neither object is a smi. |
| 736 void JumpIfNonSmisNotBothSequentialAsciiStrings(Register object1, | 765 void JumpIfNonSmisNotBothSequentialAsciiStrings(Register object1, |
| 737 Register object2, | 766 Register object2, |
| 738 Register scratch1, | 767 Register scratch1, |
| 739 Register scratch2, | 768 Register scratch2, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 756 Register scratch2, | 785 Register scratch2, |
| 757 Label* failure); | 786 Label* failure); |
| 758 | 787 |
| 759 // Check if instance type is sequential ASCII string and jump to label if | 788 // Check if instance type is sequential ASCII string and jump to label if |
| 760 // it is not. | 789 // it is not. |
| 761 void JumpIfInstanceTypeIsNotSequentialAscii(Register type, | 790 void JumpIfInstanceTypeIsNotSequentialAscii(Register type, |
| 762 Register scratch, | 791 Register scratch, |
| 763 Label* failure); | 792 Label* failure); |
| 764 | 793 |
| 765 | 794 |
| 795 // --------------------------------------------------------------------------- |
| 796 // Patching helpers. |
| 797 |
| 798 // Get the location of a relocated constant (its address in the constant pool) |
| 799 // from its load site. |
| 800 void GetRelocatedValueLocation(Register ldr_location, |
| 801 Register result); |
| 802 |
| 803 |
| 766 private: | 804 private: |
| 767 void CallCFunctionHelper(Register function, | 805 void CallCFunctionHelper(Register function, |
| 768 ExternalReference function_reference, | 806 ExternalReference function_reference, |
| 769 Register scratch, | 807 Register scratch, |
| 770 int num_arguments); | 808 int num_arguments); |
| 771 | 809 |
| 772 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | 810 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); |
| 773 void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | 811 void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); |
| 774 | 812 |
| 775 // Helper functions for generating invokes. | 813 // Helper functions for generating invokes. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 895 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 858 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 896 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 859 #else | 897 #else |
| 860 #define ACCESS_MASM(masm) masm-> | 898 #define ACCESS_MASM(masm) masm-> |
| 861 #endif | 899 #endif |
| 862 | 900 |
| 863 | 901 |
| 864 } } // namespace v8::internal | 902 } } // namespace v8::internal |
| 865 | 903 |
| 866 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 904 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |