OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 intptr_t delta = other.address() - roots_register_value; | 68 intptr_t delta = other.address() - roots_register_value; |
69 return delta; | 69 return delta; |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 Operand MacroAssembler::ExternalOperand(ExternalReference target, | 73 Operand MacroAssembler::ExternalOperand(ExternalReference target, |
74 Register scratch) { | 74 Register scratch) { |
75 if (root_array_available_ && !Serializer::enabled()) { | 75 if (root_array_available_ && !Serializer::enabled()) { |
76 intptr_t delta = RootRegisterDelta(target); | 76 intptr_t delta = RootRegisterDelta(target); |
77 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { | 77 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { |
78 Serializer::TooLateToEnableNow(); | |
79 return Operand(kRootRegister, static_cast<int32_t>(delta)); | 78 return Operand(kRootRegister, static_cast<int32_t>(delta)); |
80 } | 79 } |
81 } | 80 } |
82 Move(scratch, target); | 81 Move(scratch, target); |
83 return Operand(scratch, 0); | 82 return Operand(scratch, 0); |
84 } | 83 } |
85 | 84 |
86 | 85 |
87 void MacroAssembler::Load(Register destination, ExternalReference source) { | 86 void MacroAssembler::Load(Register destination, ExternalReference source) { |
88 if (root_array_available_ && !Serializer::enabled()) { | 87 if (root_array_available_ && !Serializer::enabled()) { |
89 intptr_t delta = RootRegisterDelta(source); | 88 intptr_t delta = RootRegisterDelta(source); |
90 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { | 89 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { |
91 Serializer::TooLateToEnableNow(); | |
92 movp(destination, Operand(kRootRegister, static_cast<int32_t>(delta))); | 90 movp(destination, Operand(kRootRegister, static_cast<int32_t>(delta))); |
93 return; | 91 return; |
94 } | 92 } |
95 } | 93 } |
96 // Safe code. | 94 // Safe code. |
97 if (destination.is(rax)) { | 95 if (destination.is(rax)) { |
98 load_rax(source); | 96 load_rax(source); |
99 } else { | 97 } else { |
100 Move(kScratchRegister, source); | 98 Move(kScratchRegister, source); |
101 movp(destination, Operand(kScratchRegister, 0)); | 99 movp(destination, Operand(kScratchRegister, 0)); |
102 } | 100 } |
103 } | 101 } |
104 | 102 |
105 | 103 |
106 void MacroAssembler::Store(ExternalReference destination, Register source) { | 104 void MacroAssembler::Store(ExternalReference destination, Register source) { |
107 if (root_array_available_ && !Serializer::enabled()) { | 105 if (root_array_available_ && !Serializer::enabled()) { |
108 intptr_t delta = RootRegisterDelta(destination); | 106 intptr_t delta = RootRegisterDelta(destination); |
109 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { | 107 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { |
110 Serializer::TooLateToEnableNow(); | |
111 movp(Operand(kRootRegister, static_cast<int32_t>(delta)), source); | 108 movp(Operand(kRootRegister, static_cast<int32_t>(delta)), source); |
112 return; | 109 return; |
113 } | 110 } |
114 } | 111 } |
115 // Safe code. | 112 // Safe code. |
116 if (source.is(rax)) { | 113 if (source.is(rax)) { |
117 store_rax(destination); | 114 store_rax(destination); |
118 } else { | 115 } else { |
119 Move(kScratchRegister, destination); | 116 Move(kScratchRegister, destination); |
120 movp(Operand(kScratchRegister, 0), source); | 117 movp(Operand(kScratchRegister, 0), source); |
121 } | 118 } |
122 } | 119 } |
123 | 120 |
124 | 121 |
125 void MacroAssembler::LoadAddress(Register destination, | 122 void MacroAssembler::LoadAddress(Register destination, |
126 ExternalReference source) { | 123 ExternalReference source) { |
127 if (root_array_available_ && !Serializer::enabled()) { | 124 if (root_array_available_ && !Serializer::enabled()) { |
128 intptr_t delta = RootRegisterDelta(source); | 125 intptr_t delta = RootRegisterDelta(source); |
129 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { | 126 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { |
130 Serializer::TooLateToEnableNow(); | |
131 leap(destination, Operand(kRootRegister, static_cast<int32_t>(delta))); | 127 leap(destination, Operand(kRootRegister, static_cast<int32_t>(delta))); |
132 return; | 128 return; |
133 } | 129 } |
134 } | 130 } |
135 // Safe code. | 131 // Safe code. |
136 Move(destination, source); | 132 Move(destination, source); |
137 } | 133 } |
138 | 134 |
139 | 135 |
140 int MacroAssembler::LoadAddressSize(ExternalReference source) { | 136 int MacroAssembler::LoadAddressSize(ExternalReference source) { |
141 if (root_array_available_ && !Serializer::enabled()) { | 137 if (root_array_available_ && !Serializer::enabled()) { |
142 // This calculation depends on the internals of LoadAddress. | 138 // This calculation depends on the internals of LoadAddress. |
143 // It's correctness is ensured by the asserts in the Call | 139 // It's correctness is ensured by the asserts in the Call |
144 // instruction below. | 140 // instruction below. |
145 intptr_t delta = RootRegisterDelta(source); | 141 intptr_t delta = RootRegisterDelta(source); |
146 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { | 142 if (delta != kInvalidRootRegisterDelta && is_int32(delta)) { |
147 Serializer::TooLateToEnableNow(); | |
148 // Operand is leap(scratch, Operand(kRootRegister, delta)); | 143 // Operand is leap(scratch, Operand(kRootRegister, delta)); |
149 // Opcodes : REX.W 8D ModRM Disp8/Disp32 - 4 or 7. | 144 // Opcodes : REX.W 8D ModRM Disp8/Disp32 - 4 or 7. |
150 int size = 4; | 145 int size = 4; |
151 if (!is_int8(static_cast<int32_t>(delta))) { | 146 if (!is_int8(static_cast<int32_t>(delta))) { |
152 size += 3; // Need full four-byte displacement in lea. | 147 size += 3; // Need full four-byte displacement in lea. |
153 } | 148 } |
154 return size; | 149 return size; |
155 } | 150 } |
156 } | 151 } |
157 // Size of movp(destination, src); | 152 // Size of movp(destination, src); |
(...skipping 4997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5155 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); | 5150 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); |
5156 movl(rax, dividend); | 5151 movl(rax, dividend); |
5157 shrl(rax, Immediate(31)); | 5152 shrl(rax, Immediate(31)); |
5158 addl(rdx, rax); | 5153 addl(rdx, rax); |
5159 } | 5154 } |
5160 | 5155 |
5161 | 5156 |
5162 } } // namespace v8::internal | 5157 } } // namespace v8::internal |
5163 | 5158 |
5164 #endif // V8_TARGET_ARCH_X64 | 5159 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |