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_X64_MACRO_ASSEMBLER_X64_H_ | 5 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ |
6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ | 6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ |
7 | 7 |
8 #include "src/assembler.h" | |
9 #include "src/bailout-reason.h" | 8 #include "src/bailout-reason.h" |
10 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
11 #include "src/frames.h" | 10 #include "src/frames.h" |
12 #include "src/globals.h" | 11 #include "src/globals.h" |
13 #include "src/x64/assembler-x64.h" | 12 #include "src/x64/assembler-x64.h" |
14 #include "src/x64/frames-x64.h" | 13 #include "src/x64/frames-x64.h" |
15 | 14 |
16 namespace v8 { | 15 namespace v8 { |
17 namespace internal { | 16 namespace internal { |
18 | 17 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 ScaleFactor scale; | 85 ScaleFactor scale; |
87 }; | 86 }; |
88 | 87 |
89 | 88 |
90 // MacroAssembler implements a collection of frequently used macros. | 89 // MacroAssembler implements a collection of frequently used macros. |
91 class MacroAssembler: public Assembler { | 90 class MacroAssembler: public Assembler { |
92 public: | 91 public: |
93 MacroAssembler(Isolate* isolate, void* buffer, int size, | 92 MacroAssembler(Isolate* isolate, void* buffer, int size, |
94 CodeObjectRequired create_code_object); | 93 CodeObjectRequired create_code_object); |
95 | 94 |
| 95 int jit_cookie() const { return jit_cookie_; } |
| 96 |
96 // Prevent the use of the RootArray during the lifetime of this | 97 // Prevent the use of the RootArray during the lifetime of this |
97 // scope object. | 98 // scope object. |
98 class NoRootArrayScope BASE_EMBEDDED { | 99 class NoRootArrayScope BASE_EMBEDDED { |
99 public: | 100 public: |
100 explicit NoRootArrayScope(MacroAssembler* assembler) | 101 explicit NoRootArrayScope(MacroAssembler* assembler) |
101 : variable_(&assembler->root_array_available_), | 102 : variable_(&assembler->root_array_available_), |
102 old_value_(assembler->root_array_available_) { | 103 old_value_(assembler->root_array_available_) { |
103 assembler->root_array_available_ = false; | 104 assembler->root_array_available_ = false; |
104 } | 105 } |
105 ~NoRootArrayScope() { | 106 ~NoRootArrayScope() { |
106 *variable_ = old_value_; | 107 *variable_ = old_value_; |
107 } | 108 } |
108 private: | 109 private: |
109 bool* variable_; | 110 bool* variable_; |
110 bool old_value_; | 111 bool old_value_; |
111 }; | 112 }; |
112 | 113 |
| 114 Isolate* isolate() const { return isolate_; } |
| 115 |
113 // Operand pointing to an external reference. | 116 // Operand pointing to an external reference. |
114 // May emit code to set up the scratch register. The operand is | 117 // May emit code to set up the scratch register. The operand is |
115 // only guaranteed to be correct as long as the scratch register | 118 // only guaranteed to be correct as long as the scratch register |
116 // isn't changed. | 119 // isn't changed. |
117 // If the operand is used more than once, use a scratch register | 120 // If the operand is used more than once, use a scratch register |
118 // that is guaranteed not to be clobbered. | 121 // that is guaranteed not to be clobbered. |
119 Operand ExternalOperand(ExternalReference reference, | 122 Operand ExternalOperand(ExternalReference reference, |
120 Register scratch = kScratchRegister); | 123 Register scratch = kScratchRegister); |
121 // Loads and stores the value of an external reference. | 124 // Loads and stores the value of an external reference. |
122 // Special case code for load and store to take advantage of | 125 // Special case code for load and store to take advantage of |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 | 1527 |
1525 private: | 1528 private: |
1526 // Order general registers are pushed by Pushad. | 1529 // Order general registers are pushed by Pushad. |
1527 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r12, r14, r15. | 1530 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r12, r14, r15. |
1528 static const int kSafepointPushRegisterIndices[Register::kNumRegisters]; | 1531 static const int kSafepointPushRegisterIndices[Register::kNumRegisters]; |
1529 static const int kNumSafepointSavedRegisters = 12; | 1532 static const int kNumSafepointSavedRegisters = 12; |
1530 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; | 1533 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; |
1531 | 1534 |
1532 bool generating_stub_; | 1535 bool generating_stub_; |
1533 bool has_frame_; | 1536 bool has_frame_; |
| 1537 Isolate* isolate_; |
1534 bool root_array_available_; | 1538 bool root_array_available_; |
| 1539 int jit_cookie_; |
1535 | 1540 |
1536 // Returns a register holding the smi value. The register MUST NOT be | 1541 // Returns a register holding the smi value. The register MUST NOT be |
1537 // modified. It may be the "smi 1 constant" register. | 1542 // modified. It may be the "smi 1 constant" register. |
1538 Register GetSmiConstant(Smi* value); | 1543 Register GetSmiConstant(Smi* value); |
1539 | 1544 |
1540 int64_t RootRegisterDelta(ExternalReference other); | 1545 int64_t RootRegisterDelta(ExternalReference other); |
1541 | 1546 |
1542 // Moves the smi value to the destination register. | 1547 // Moves the smi value to the destination register. |
1543 void LoadSmiConstant(Register dst, Smi* value); | 1548 void LoadSmiConstant(Register dst, Smi* value); |
1544 | 1549 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 inline Operand StackOperandForReturnAddress(int32_t disp) { | 1680 inline Operand StackOperandForReturnAddress(int32_t disp) { |
1676 return Operand(rsp, disp); | 1681 return Operand(rsp, disp); |
1677 } | 1682 } |
1678 | 1683 |
1679 #define ACCESS_MASM(masm) masm-> | 1684 #define ACCESS_MASM(masm) masm-> |
1680 | 1685 |
1681 } // namespace internal | 1686 } // namespace internal |
1682 } // namespace v8 | 1687 } // namespace v8 |
1683 | 1688 |
1684 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1689 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |