| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if defined(V8_TARGET_ARCH_X64) | 30 #if V8_TARGET_ARCH_X64 |
| 31 | 31 |
| 32 #include "x64/lithium-gap-resolver-x64.h" | 32 #include "x64/lithium-gap-resolver-x64.h" |
| 33 #include "x64/lithium-codegen-x64.h" | 33 #include "x64/lithium-codegen-x64.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 LGapResolver::LGapResolver(LCodeGen* owner) | 38 LGapResolver::LGapResolver(LCodeGen* owner) |
| 39 : cgen_(owner), moves_(32, owner->zone()) {} | 39 : cgen_(owner), moves_(32, owner->zone()) {} |
| 40 | 40 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 LConstantOperand* constant_source = LConstantOperand::cast(source); | 195 LConstantOperand* constant_source = LConstantOperand::cast(source); |
| 196 if (destination->IsRegister()) { | 196 if (destination->IsRegister()) { |
| 197 Register dst = cgen_->ToRegister(destination); | 197 Register dst = cgen_->ToRegister(destination); |
| 198 if (cgen_->IsSmiConstant(constant_source)) { | 198 if (cgen_->IsSmiConstant(constant_source)) { |
| 199 __ Move(dst, cgen_->ToSmi(constant_source)); | 199 __ Move(dst, cgen_->ToSmi(constant_source)); |
| 200 } else if (cgen_->IsInteger32Constant(constant_source)) { | 200 } else if (cgen_->IsInteger32Constant(constant_source)) { |
| 201 __ movl(dst, Immediate(cgen_->ToInteger32(constant_source))); | 201 __ movl(dst, Immediate(cgen_->ToInteger32(constant_source))); |
| 202 } else { | 202 } else { |
| 203 __ LoadObject(dst, cgen_->ToHandle(constant_source)); | 203 __ LoadObject(dst, cgen_->ToHandle(constant_source)); |
| 204 } | 204 } |
| 205 } else if (destination->IsDoubleRegister()) { |
| 206 double v = cgen_->ToDouble(constant_source); |
| 207 uint64_t int_val = BitCast<uint64_t, double>(v); |
| 208 int32_t lower = static_cast<int32_t>(int_val); |
| 209 int32_t upper = static_cast<int32_t>(int_val >> (kBitsPerInt)); |
| 210 XMMRegister dst = cgen_->ToDoubleRegister(destination); |
| 211 if (int_val == 0) { |
| 212 __ xorps(dst, dst); |
| 213 } else { |
| 214 __ push(Immediate(upper)); |
| 215 __ push(Immediate(lower)); |
| 216 __ movsd(dst, Operand(rsp, 0)); |
| 217 __ addq(rsp, Immediate(kDoubleSize)); |
| 218 } |
| 205 } else { | 219 } else { |
| 206 ASSERT(destination->IsStackSlot()); | 220 ASSERT(destination->IsStackSlot()); |
| 207 Operand dst = cgen_->ToOperand(destination); | 221 Operand dst = cgen_->ToOperand(destination); |
| 208 if (cgen_->IsSmiConstant(constant_source)) { | 222 if (cgen_->IsSmiConstant(constant_source)) { |
| 209 __ Move(dst, cgen_->ToSmi(constant_source)); | 223 __ Move(dst, cgen_->ToSmi(constant_source)); |
| 210 } else if (cgen_->IsInteger32Constant(constant_source)) { | 224 } else if (cgen_->IsInteger32Constant(constant_source)) { |
| 211 // Zero top 32 bits of a 64 bit spill slot that holds a 32 bit untagged | 225 // Zero top 32 bits of a 64 bit spill slot that holds a 32 bit untagged |
| 212 // value. | 226 // value. |
| 213 __ movq(dst, Immediate(cgen_->ToInteger32(constant_source))); | 227 __ movq(dst, Immediate(cgen_->ToInteger32(constant_source))); |
| 214 } else { | 228 } else { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 moves_[i].set_source(source); | 331 moves_[i].set_source(source); |
| 318 } | 332 } |
| 319 } | 333 } |
| 320 } | 334 } |
| 321 | 335 |
| 322 #undef __ | 336 #undef __ |
| 323 | 337 |
| 324 } } // namespace v8::internal | 338 } } // namespace v8::internal |
| 325 | 339 |
| 326 #endif // V8_TARGET_ARCH_X64 | 340 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |