OLD | NEW |
---|---|
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 12 matching lines...) Expand all Loading... | |
23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 // The original source code covered by the above license above has been | 31 // The original source code covered by the above license above has been |
32 // modified significantly by Google Inc. | 32 // modified significantly by Google Inc. |
33 // Copyright 2011 the V8 project authors. All rights reserved. | 33 // Copyright 2011 the V8 project authors. All rights reserved. |
Jakob Kummerow
2012/02/16 12:46:02
2012
| |
34 | 34 |
35 // A lightweight X64 Assembler. | 35 // A lightweight X64 Assembler. |
36 | 36 |
37 #ifndef V8_X64_ASSEMBLER_X64_H_ | 37 #ifndef V8_X64_ASSEMBLER_X64_H_ |
38 #define V8_X64_ASSEMBLER_X64_H_ | 38 #define V8_X64_ASSEMBLER_X64_H_ |
39 | 39 |
40 #include "serialize.h" | 40 #include "serialize.h" |
41 | 41 |
42 namespace v8 { | 42 namespace v8 { |
43 namespace internal { | 43 namespace internal { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 }; | 124 }; |
125 return names[index]; | 125 return names[index]; |
126 } | 126 } |
127 | 127 |
128 static Register from_code(int code) { | 128 static Register from_code(int code) { |
129 Register r = { code }; | 129 Register r = { code }; |
130 return r; | 130 return r; |
131 } | 131 } |
132 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } | 132 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } |
133 bool is(Register reg) const { return code_ == reg.code_; } | 133 bool is(Register reg) const { return code_ == reg.code_; } |
134 // rax, rbx, rcx and rdx are byte registers, the rest are not. | |
135 bool is_byte_register() const { return code_ <= 3; } | |
134 int code() const { | 136 int code() const { |
135 ASSERT(is_valid()); | 137 ASSERT(is_valid()); |
136 return code_; | 138 return code_; |
137 } | 139 } |
138 int bit() const { | 140 int bit() const { |
139 return 1 << code_; | 141 return 1 << code_; |
140 } | 142 } |
141 | 143 |
142 // Return the high bit of the register code as a 0 or 1. Used often | 144 // Return the high bit of the register code as a 0 or 1. Used often |
143 // when constructing the REX prefix byte. | 145 // when constructing the REX prefix byte. |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1644 private: | 1646 private: |
1645 Assembler* assembler_; | 1647 Assembler* assembler_; |
1646 #ifdef DEBUG | 1648 #ifdef DEBUG |
1647 int space_before_; | 1649 int space_before_; |
1648 #endif | 1650 #endif |
1649 }; | 1651 }; |
1650 | 1652 |
1651 } } // namespace v8::internal | 1653 } } // namespace v8::internal |
1652 | 1654 |
1653 #endif // V8_X64_ASSEMBLER_X64_H_ | 1655 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |