Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 10909272: Avoid using a temp register when unboxing a known smi. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 compiler->double_class(), 1903 compiler->double_class(),
1904 slow_path->entry_label(), 1904 slow_path->entry_label(),
1905 Assembler::kFarJump, 1905 Assembler::kFarJump,
1906 out_reg); 1906 out_reg);
1907 __ Bind(slow_path->exit_label()); 1907 __ Bind(slow_path->exit_label());
1908 __ movsd(FieldAddress(out_reg, Double::value_offset()), value); 1908 __ movsd(FieldAddress(out_reg, Double::value_offset()), value);
1909 } 1909 }
1910 1910
1911 1911
1912 LocationSummary* UnboxDoubleInstr::MakeLocationSummary() const { 1912 LocationSummary* UnboxDoubleInstr::MakeLocationSummary() const {
1913 const intptr_t v_cid = value()->ResultCid();
1914
1915 const intptr_t kNumInputs = 1; 1913 const intptr_t kNumInputs = 1;
1916 const intptr_t kNumTemps = (v_cid != kDoubleCid) ? 1 : 0; 1914 const intptr_t kNumTemps = CanDeoptimize() ? 1 : 0;
1917 LocationSummary* summary = 1915 LocationSummary* summary =
1918 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1916 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1919 summary->set_in(0, Location::RequiresRegister()); 1917 summary->set_in(0, Location::RequiresRegister());
1920 if (v_cid != kDoubleCid) summary->set_temp(0, Location::RequiresRegister()); 1918 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister());
1921 summary->set_out(Location::RequiresXmmRegister()); 1919 summary->set_out(Location::RequiresXmmRegister());
1922 return summary; 1920 return summary;
1923 } 1921 }
1924 1922
1925 1923
1926 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1924 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1927 const intptr_t v_cid = value()->ResultCid(); 1925 const intptr_t value_cid = value()->ResultCid();
1928
1929 const Register value = locs()->in(0).reg(); 1926 const Register value = locs()->in(0).reg();
1930 const XmmRegister result = locs()->out().xmm_reg(); 1927 const XmmRegister result = locs()->out().xmm_reg();
1931 if (v_cid != kDoubleCid) { 1928
1929 if (value_cid == kDoubleCid) {
1930 __ movsd(result, FieldAddress(value, Double::value_offset()));
1931 } else if (value_cid == kSmiCid) {
1932 __ SmiUntag(value); // Untag input before conversion.
1933 __ cvtsi2sd(result, value);
1934 __ SmiTag(value); // Restore input register.
1935 } else {
1932 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptBinaryDoubleOp); 1936 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptBinaryDoubleOp);
1933 compiler->LoadDoubleOrSmiToXmm(result, 1937 compiler->LoadDoubleOrSmiToXmm(result,
1934 value, 1938 value,
1935 locs()->temp(0).reg(), 1939 locs()->temp(0).reg(),
1936 deopt); 1940 deopt);
1937 } else {
1938 __ movsd(result, FieldAddress(value, Double::value_offset()));
1939 } 1941 }
1940 } 1942 }
1941 1943
1942 1944
1943 LocationSummary* UnboxedDoubleBinaryOpInstr::MakeLocationSummary() const { 1945 LocationSummary* UnboxedDoubleBinaryOpInstr::MakeLocationSummary() const {
1944 const intptr_t kNumInputs = 2; 1946 const intptr_t kNumInputs = 2;
1945 const intptr_t kNumTemps = 0; 1947 const intptr_t kNumTemps = 0;
1946 LocationSummary* summary = 1948 LocationSummary* summary =
1947 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1949 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1948 summary->set_in(0, Location::RequiresXmmRegister()); 1950 summary->set_in(0, Location::RequiresXmmRegister());
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 __ j(ABOVE_EQUAL, deopt); 2308 __ j(ABOVE_EQUAL, deopt);
2307 } 2309 }
2308 } 2310 }
2309 2311
2310 2312
2311 } // namespace dart 2313 } // namespace dart
2312 2314
2313 #undef __ 2315 #undef __
2314 2316
2315 #endif // defined TARGET_ARCH_X64 2317 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698