| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 5 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| 6 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 6 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| 7 | 7 |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/frames.h" | 10 #include "src/frames.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 public: | 64 public: |
| 65 // The isolate parameter can be NULL if the macro assembler should | 65 // The isolate parameter can be NULL if the macro assembler should |
| 66 // not use isolate-dependent functionality. In this case, it's the | 66 // not use isolate-dependent functionality. In this case, it's the |
| 67 // responsibility of the caller to never invoke such function on the | 67 // responsibility of the caller to never invoke such function on the |
| 68 // macro assembler. | 68 // macro assembler. |
| 69 MacroAssembler(Isolate* isolate, void* buffer, int size); | 69 MacroAssembler(Isolate* isolate, void* buffer, int size); |
| 70 | 70 |
| 71 void Load(Register dst, const Operand& src, Representation r); | 71 void Load(Register dst, const Operand& src, Representation r); |
| 72 void Store(Register src, const Operand& dst, Representation r); | 72 void Store(Register src, const Operand& dst, Representation r); |
| 73 | 73 |
| 74 // Load a register with a long value as efficiently as possible. | |
| 75 void Set(Register dst, int32_t x) { | |
| 76 if (x == 0) { | |
| 77 xor_(dst, dst); | |
| 78 } else { | |
| 79 mov(dst, Immediate(x)); | |
| 80 } | |
| 81 } | |
| 82 void Set(const Operand& dst, int32_t x) { mov(dst, Immediate(x)); } | |
| 83 | |
| 84 // Operations on roots in the root-array. | 74 // Operations on roots in the root-array. |
| 85 void LoadRoot(Register destination, Heap::RootListIndex index); | 75 void LoadRoot(Register destination, Heap::RootListIndex index); |
| 86 void StoreRoot(Register source, Register scratch, Heap::RootListIndex index); | 76 void StoreRoot(Register source, Register scratch, Heap::RootListIndex index); |
| 87 void CompareRoot(Register with, Register scratch, Heap::RootListIndex index); | 77 void CompareRoot(Register with, Register scratch, Heap::RootListIndex index); |
| 88 // These methods can only be used with constant roots (i.e. non-writable | 78 // These methods can only be used with constant roots (i.e. non-writable |
| 89 // and not in new space). | 79 // and not in new space). |
| 90 void CompareRoot(Register with, Heap::RootListIndex index); | 80 void CompareRoot(Register with, Heap::RootListIndex index); |
| 91 void CompareRoot(const Operand& with, Heap::RootListIndex index); | 81 void CompareRoot(const Operand& with, Heap::RootListIndex index); |
| 92 void PushRoot(Heap::RootListIndex index); | |
| 93 | |
| 94 // Compare the object in a register to a value and jump if they are equal. | |
| 95 void JumpIfRoot(Register with, Heap::RootListIndex index, Label* if_equal, | |
| 96 Label::Distance if_equal_distance = Label::kNear) { | |
| 97 CompareRoot(with, index); | |
| 98 j(equal, if_equal, if_equal_distance); | |
| 99 } | |
| 100 | |
| 101 // Compare the object in a register to a value and jump if they are not equal. | |
| 102 void JumpIfNotRoot(Register with, Heap::RootListIndex index, | |
| 103 Label* if_not_equal, | |
| 104 Label::Distance if_not_equal_distance = Label::kNear) { | |
| 105 CompareRoot(with, index); | |
| 106 j(not_equal, if_not_equal, if_not_equal_distance); | |
| 107 } | |
| 108 | 82 |
| 109 // --------------------------------------------------------------------------- | 83 // --------------------------------------------------------------------------- |
| 110 // GC Support | 84 // GC Support |
| 111 enum RememberedSetFinalAction { | 85 enum RememberedSetFinalAction { |
| 112 kReturnAtEnd, | 86 kReturnAtEnd, |
| 113 kFallThroughAtEnd | 87 kFallThroughAtEnd |
| 114 }; | 88 }; |
| 115 | 89 |
| 116 // Record in the remembered set the fact that we have a pointer to new space | 90 // Record in the remembered set the fact that we have a pointer to new space |
| 117 // at the address pointed to by the addr register. Only works if addr is not | 91 // at the address pointed to by the addr register. Only works if addr is not |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // argument in register esi. | 255 // argument in register esi. |
| 282 void LeaveExitFrame(bool save_doubles); | 256 void LeaveExitFrame(bool save_doubles); |
| 283 | 257 |
| 284 // Leave the current exit frame. Expects the return value in | 258 // Leave the current exit frame. Expects the return value in |
| 285 // register eax (untouched). | 259 // register eax (untouched). |
| 286 void LeaveApiExitFrame(bool restore_context); | 260 void LeaveApiExitFrame(bool restore_context); |
| 287 | 261 |
| 288 // Find the function context up the context chain. | 262 // Find the function context up the context chain. |
| 289 void LoadContext(Register dst, int context_chain_length); | 263 void LoadContext(Register dst, int context_chain_length); |
| 290 | 264 |
| 291 // Load the global proxy from the current context. | |
| 292 void LoadGlobalProxy(Register dst); | |
| 293 | |
| 294 // Conditionally load the cached Array transitioned map of type | 265 // Conditionally load the cached Array transitioned map of type |
| 295 // transitioned_kind from the native context if the map in register | 266 // transitioned_kind from the native context if the map in register |
| 296 // map_in_out is the cached Array map in the native context of | 267 // map_in_out is the cached Array map in the native context of |
| 297 // expected_kind. | 268 // expected_kind. |
| 298 void LoadTransitionedArrayMapConditional( | 269 void LoadTransitionedArrayMapConditional( |
| 299 ElementsKind expected_kind, | 270 ElementsKind expected_kind, |
| 300 ElementsKind transitioned_kind, | 271 ElementsKind transitioned_kind, |
| 301 Register map_in_out, | 272 Register map_in_out, |
| 302 Register scratch, | 273 Register scratch, |
| 303 Label* no_map_match); | 274 Label* no_map_match); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 558 |
| 588 // Abort execution if argument is a smi, enabled via --debug-code. | 559 // Abort execution if argument is a smi, enabled via --debug-code. |
| 589 void AssertNotSmi(Register object); | 560 void AssertNotSmi(Register object); |
| 590 | 561 |
| 591 // Abort execution if argument is not a string, enabled via --debug-code. | 562 // Abort execution if argument is not a string, enabled via --debug-code. |
| 592 void AssertString(Register object); | 563 void AssertString(Register object); |
| 593 | 564 |
| 594 // Abort execution if argument is not a name, enabled via --debug-code. | 565 // Abort execution if argument is not a name, enabled via --debug-code. |
| 595 void AssertName(Register object); | 566 void AssertName(Register object); |
| 596 | 567 |
| 597 // Abort execution if argument is not a JSFunction, enabled via --debug-code. | |
| 598 void AssertFunction(Register object); | |
| 599 | |
| 600 // Abort execution if argument is not undefined or an AllocationSite, enabled | 568 // Abort execution if argument is not undefined or an AllocationSite, enabled |
| 601 // via --debug-code. | 569 // via --debug-code. |
| 602 void AssertUndefinedOrAllocationSite(Register object); | 570 void AssertUndefinedOrAllocationSite(Register object); |
| 603 | 571 |
| 604 // --------------------------------------------------------------------------- | 572 // --------------------------------------------------------------------------- |
| 605 // Exception handling | 573 // Exception handling |
| 606 | 574 |
| 607 // Push a new stack handler and link it into stack handler chain. | 575 // Push a new stack handler and link it into stack handler chain. |
| 608 void PushStackHandler(); | 576 void PushStackHandler(); |
| 609 | 577 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 | 796 |
| 829 // Return and drop arguments from stack, where the number of arguments | 797 // Return and drop arguments from stack, where the number of arguments |
| 830 // may be bigger than 2^16 - 1. Requires a scratch register. | 798 // may be bigger than 2^16 - 1. Requires a scratch register. |
| 831 void Ret(int bytes_dropped, Register scratch); | 799 void Ret(int bytes_dropped, Register scratch); |
| 832 | 800 |
| 833 // Emit code to discard a non-negative number of pointer-sized elements | 801 // Emit code to discard a non-negative number of pointer-sized elements |
| 834 // from the stack, clobbering only the esp register. | 802 // from the stack, clobbering only the esp register. |
| 835 void Drop(int element_count); | 803 void Drop(int element_count); |
| 836 | 804 |
| 837 void Call(Label* target) { call(target); } | 805 void Call(Label* target) { call(target); } |
| 838 void Call(Handle<Code> target, RelocInfo::Mode rmode) { call(target, rmode); } | |
| 839 void Jump(Handle<Code> target, RelocInfo::Mode rmode) { jmp(target, rmode); } | |
| 840 void Push(Register src) { push(src); } | 806 void Push(Register src) { push(src); } |
| 841 void Push(const Operand& src) { push(src); } | |
| 842 void Push(Immediate value) { push(value); } | |
| 843 void Pop(Register dst) { pop(dst); } | 807 void Pop(Register dst) { pop(dst); } |
| 844 void PushReturnAddressFrom(Register src) { push(src); } | |
| 845 void PopReturnAddressTo(Register dst) { pop(dst); } | |
| 846 | 808 |
| 847 // Non-SSE2 instructions. | 809 // Non-SSE2 instructions. |
| 848 void Pextrd(Register dst, XMMRegister src, int8_t imm8); | 810 void Pextrd(Register dst, XMMRegister src, int8_t imm8); |
| 849 void Pinsrd(XMMRegister dst, Register src, int8_t imm8) { | 811 void Pinsrd(XMMRegister dst, Register src, int8_t imm8) { |
| 850 Pinsrd(dst, Operand(src), imm8); | 812 Pinsrd(dst, Operand(src), imm8); |
| 851 } | 813 } |
| 852 void Pinsrd(XMMRegister dst, const Operand& src, int8_t imm8); | 814 void Pinsrd(XMMRegister dst, const Operand& src, int8_t imm8); |
| 853 | 815 |
| 854 void Lzcnt(Register dst, Register src) { Lzcnt(dst, Operand(src)); } | 816 void Lzcnt(Register dst, Register src) { Lzcnt(dst, Operand(src)); } |
| 855 void Lzcnt(Register dst, const Operand& src); | 817 void Lzcnt(Register dst, const Operand& src); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 } \ | 1095 } \ |
| 1134 masm-> | 1096 masm-> |
| 1135 #else | 1097 #else |
| 1136 #define ACCESS_MASM(masm) masm-> | 1098 #define ACCESS_MASM(masm) masm-> |
| 1137 #endif | 1099 #endif |
| 1138 | 1100 |
| 1139 | 1101 |
| 1140 } } // namespace v8::internal | 1102 } } // namespace v8::internal |
| 1141 | 1103 |
| 1142 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 1104 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |