| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
| (...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1972 void Assembler::DoubleAbs(XmmRegister reg) { | 1972 void Assembler::DoubleAbs(XmmRegister reg) { |
| 1973 static const struct ALIGN16 { | 1973 static const struct ALIGN16 { |
| 1974 uint64_t a; | 1974 uint64_t a; |
| 1975 uint64_t b; | 1975 uint64_t b; |
| 1976 } double_abs_constant = | 1976 } double_abs_constant = |
| 1977 {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}; | 1977 {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}; |
| 1978 andpd(reg, Address::Absolute(reinterpret_cast<uword>(&double_abs_constant))); | 1978 andpd(reg, Address::Absolute(reinterpret_cast<uword>(&double_abs_constant))); |
| 1979 } | 1979 } |
| 1980 | 1980 |
| 1981 | 1981 |
| 1982 void Assembler::DoubleRound(XmmRegister dst, XmmRegister src, XmmRegister tmp) { | |
| 1983 ASSERT(tmp != src); | |
| 1984 static double kZeroFiveConst = 0.5; | |
| 1985 static double kNegZeroFiveConst = -0.5; | |
| 1986 static double kOneConst = 1.0; | |
| 1987 static double kNegOneConst = -1.0; | |
| 1988 Label is_negative, round; | |
| 1989 if (src != dst) { | |
| 1990 movsd(dst, src); | |
| 1991 } | |
| 1992 // Special handling: 0.5 -> 1.0, -0.5 -> -1.0; | |
| 1993 Label done, equal_point5, equal_neg_point5; | |
| 1994 movsd(tmp, Address::Absolute(reinterpret_cast<intptr_t>(&kZeroFiveConst))); | |
| 1995 comisd(tmp, dst); | |
| 1996 j(EQUAL, &equal_point5, Assembler::kNearJump); | |
| 1997 movsd(tmp, Address::Absolute(reinterpret_cast<intptr_t>(&kNegZeroFiveConst))); | |
| 1998 comisd(tmp, dst); | |
| 1999 j(EQUAL, &equal_neg_point5, Assembler::kNearJump); | |
| 2000 | |
| 2001 roundsd(dst, dst, Assembler::kRoundToNearest); | |
| 2002 jmp(&done, Assembler::kNearJump); | |
| 2003 | |
| 2004 Bind(&equal_point5); | |
| 2005 movsd(dst, Address::Absolute(reinterpret_cast<intptr_t>(&kOneConst))); | |
| 2006 jmp(&done); | |
| 2007 | |
| 2008 Bind(&equal_neg_point5); | |
| 2009 movsd(dst, Address::Absolute(reinterpret_cast<intptr_t>(&kNegOneConst))); | |
| 2010 Bind(&done); | |
| 2011 } | |
| 2012 | |
| 2013 | |
| 2014 void Assembler::EnterFrame(intptr_t frame_size) { | 1982 void Assembler::EnterFrame(intptr_t frame_size) { |
| 2015 if (prologue_offset_ == -1) { | 1983 if (prologue_offset_ == -1) { |
| 2016 prologue_offset_ = CodeSize(); | 1984 prologue_offset_ = CodeSize(); |
| 2017 } | 1985 } |
| 2018 pushl(EBP); | 1986 pushl(EBP); |
| 2019 movl(EBP, ESP); | 1987 movl(EBP, ESP); |
| 2020 if (frame_size != 0) { | 1988 if (frame_size != 0) { |
| 2021 Immediate frame_space(frame_size); | 1989 Immediate frame_space(frame_size); |
| 2022 subl(ESP, frame_space); | 1990 subl(ESP, frame_space); |
| 2023 } | 1991 } |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 | 2281 |
| 2314 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2282 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 2315 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 2283 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
| 2316 return xmm_reg_names[reg]; | 2284 return xmm_reg_names[reg]; |
| 2317 } | 2285 } |
| 2318 | 2286 |
| 2319 | 2287 |
| 2320 } // namespace dart | 2288 } // namespace dart |
| 2321 | 2289 |
| 2322 #endif // defined TARGET_ARCH_IA32 | 2290 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |