| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 compiler->double_class(), | 1877 compiler->double_class(), |
| 1878 slow_path->entry_label(), | 1878 slow_path->entry_label(), |
| 1879 Assembler::kFarJump, | 1879 Assembler::kFarJump, |
| 1880 out_reg); | 1880 out_reg); |
| 1881 __ Bind(slow_path->exit_label()); | 1881 __ Bind(slow_path->exit_label()); |
| 1882 __ movsd(FieldAddress(out_reg, Double::value_offset()), value); | 1882 __ movsd(FieldAddress(out_reg, Double::value_offset()), value); |
| 1883 } | 1883 } |
| 1884 | 1884 |
| 1885 | 1885 |
| 1886 LocationSummary* UnboxDoubleInstr::MakeLocationSummary() const { | 1886 LocationSummary* UnboxDoubleInstr::MakeLocationSummary() const { |
| 1887 const intptr_t v_cid = value()->ResultCid(); | |
| 1888 | |
| 1889 const intptr_t kNumInputs = 1; | 1887 const intptr_t kNumInputs = 1; |
| 1890 const intptr_t kNumTemps = (v_cid != kDoubleCid) ? 1 : 0; | 1888 const intptr_t kNumTemps = CanDeoptimize() ? 1 : 0; |
| 1891 LocationSummary* summary = | 1889 LocationSummary* summary = |
| 1892 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1890 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1893 summary->set_in(0, Location::RequiresRegister()); | 1891 summary->set_in(0, Location::RequiresRegister()); |
| 1894 if (v_cid != kDoubleCid) summary->set_temp(0, Location::RequiresRegister()); | 1892 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister()); |
| 1895 summary->set_out(Location::RequiresXmmRegister()); | 1893 summary->set_out(Location::RequiresXmmRegister()); |
| 1896 return summary; | 1894 return summary; |
| 1897 } | 1895 } |
| 1898 | 1896 |
| 1899 | 1897 |
| 1900 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1898 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1901 const intptr_t v_cid = value()->ResultCid(); | 1899 const intptr_t value_cid = value()->ResultCid(); |
| 1902 | |
| 1903 const Register value = locs()->in(0).reg(); | 1900 const Register value = locs()->in(0).reg(); |
| 1904 const XmmRegister result = locs()->out().xmm_reg(); | 1901 const XmmRegister result = locs()->out().xmm_reg(); |
| 1905 if (v_cid != kDoubleCid) { | 1902 |
| 1903 if (value_cid == kDoubleCid) { |
| 1904 __ movsd(result, FieldAddress(value, Double::value_offset())); |
| 1905 } else if (value_cid == kSmiCid) { |
| 1906 __ SmiUntag(value); // Untag input before conversion. |
| 1907 __ cvtsi2sd(result, value); |
| 1908 __ SmiTag(value); // Restore input register. |
| 1909 } else { |
| 1906 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptBinaryDoubleOp); | 1910 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptBinaryDoubleOp); |
| 1907 compiler->LoadDoubleOrSmiToXmm(result, | 1911 compiler->LoadDoubleOrSmiToXmm(result, |
| 1908 value, | 1912 value, |
| 1909 locs()->temp(0).reg(), | 1913 locs()->temp(0).reg(), |
| 1910 deopt); | 1914 deopt); |
| 1911 } else { | |
| 1912 __ movsd(result, FieldAddress(value, Double::value_offset())); | |
| 1913 } | 1915 } |
| 1914 } | 1916 } |
| 1915 | 1917 |
| 1916 | 1918 |
| 1917 LocationSummary* UnboxedDoubleBinaryOpInstr::MakeLocationSummary() const { | 1919 LocationSummary* UnboxedDoubleBinaryOpInstr::MakeLocationSummary() const { |
| 1918 const intptr_t kNumInputs = 2; | 1920 const intptr_t kNumInputs = 2; |
| 1919 const intptr_t kNumTemps = 0; | 1921 const intptr_t kNumTemps = 0; |
| 1920 LocationSummary* summary = | 1922 LocationSummary* summary = |
| 1921 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1923 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1922 summary->set_in(0, Location::RequiresXmmRegister()); | 1924 summary->set_in(0, Location::RequiresXmmRegister()); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 __ j(ABOVE_EQUAL, deopt); | 2283 __ j(ABOVE_EQUAL, deopt); |
| 2282 } | 2284 } |
| 2283 } | 2285 } |
| 2284 | 2286 |
| 2285 | 2287 |
| 2286 } // namespace dart | 2288 } // namespace dart |
| 2287 | 2289 |
| 2288 #undef __ | 2290 #undef __ |
| 2289 | 2291 |
| 2290 #endif // defined TARGET_ARCH_X64 | 2292 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |