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

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

Issue 562203005: Inline toDouble calls on mints (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
OLDNEW
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" // 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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 4994 matching lines...) Expand 10 before | Expand all | Expand 10 after
5005 5005
5006 5006
5007 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5007 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5008 Register value = locs()->in(0).reg(); 5008 Register value = locs()->in(0).reg();
5009 FpuRegister result = locs()->out(0).fpu_reg(); 5009 FpuRegister result = locs()->out(0).fpu_reg();
5010 __ SmiUntag(value); 5010 __ SmiUntag(value);
5011 __ cvtsi2sd(result, value); 5011 __ cvtsi2sd(result, value);
5012 } 5012 }
5013 5013
5014 5014
5015 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Isolate* isolate,
5016 bool opt) const {
5017 const intptr_t kNumInputs = 1;
5018 const intptr_t kNumTemps = 0;
5019 LocationSummary* result = new(isolate) LocationSummary(
5020 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5021 result->set_in(0, Location::Pair(Location::RequiresRegister(),
5022 Location::RequiresRegister()));
5023 result->set_out(0, Location::RequiresFpuRegister());
5024 return result;
5025 }
5026
5027
5028 void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5029 PairLocation* pair = locs()->in(0).AsPairLocation();
5030 Register result1 = pair->At(0).reg();
5031 Register result2 = pair->At(1).reg();
5032
5033 FpuRegister result = locs()->out(0).fpu_reg();
5034
5035 // Push hi.
5036 __ pushl(result2);
5037 // Push lo.
5038 __ pushl(result1);
5039 // Perform conversion from Mint to double.
5040 __ fildl(Address(ESP, 0));
5041 // Pop FPU stack onto regular stack.
5042 __ fstpl(Address(ESP, 0));
5043 // Copy into result.
5044 __ movsd(result, Address(ESP, 0));
5045 // Pop args.
5046 __ addl(ESP, Immediate(2 * kWordSize));
5047 }
5048
5049
5015 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Isolate* isolate, 5050 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Isolate* isolate,
5016 bool opt) const { 5051 bool opt) const {
5017 const intptr_t kNumInputs = 1; 5052 const intptr_t kNumInputs = 1;
5018 const intptr_t kNumTemps = 0; 5053 const intptr_t kNumTemps = 0;
5019 LocationSummary* result = new(isolate) LocationSummary( 5054 LocationSummary* result = new(isolate) LocationSummary(
5020 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 5055 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
5021 result->set_in(0, Location::RegisterLocation(ECX)); 5056 result->set_in(0, Location::RegisterLocation(ECX));
5022 result->set_out(0, Location::RegisterLocation(EAX)); 5057 result->set_out(0, Location::RegisterLocation(EAX));
5023 return result; 5058 return result;
5024 } 5059 }
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
6956 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6991 __ movl(EDX, Immediate(kInvalidObjectPointer));
6957 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6992 __ movl(EDX, Immediate(kInvalidObjectPointer));
6958 #endif 6993 #endif
6959 } 6994 }
6960 6995
6961 } // namespace dart 6996 } // namespace dart
6962 6997
6963 #undef __ 6998 #undef __
6964 6999
6965 #endif // defined TARGET_ARCH_IA32 7000 #endif // defined TARGET_ARCH_IA32
OLDNEW
« runtime/vm/intermediate_language.cc ('K') | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698