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

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

Issue 11573044: Inline Doubles truncate and round. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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) 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 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 __ cvttsd2si(result, value); 2333 __ cvttsd2si(result, value);
2334 // Overflow is signalled with minint. 2334 // Overflow is signalled with minint.
2335 Label do_call, done; 2335 Label do_call, done;
2336 // Check for overflow and that it fits into Smi. 2336 // Check for overflow and that it fits into Smi.
2337 __ cmpl(result, Immediate(0xC0000000)); 2337 __ cmpl(result, Immediate(0xC0000000));
2338 __ j(NEGATIVE, deopt); 2338 __ j(NEGATIVE, deopt);
2339 __ SmiTag(result); 2339 __ SmiTag(result);
2340 } 2340 }
2341 2341
2342 2342
2343 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary() const {
2344 const intptr_t kNumInputs = 1;
2345 const intptr_t kNumTemps =
2346 (recognized_kind() == MethodRecognizer::kDoubleRound) ? 1 : 0;
2347 LocationSummary* result =
2348 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2349 result->set_in(0, Location::RequiresXmmRegister());
2350 result->set_out(Location::RequiresXmmRegister());
2351 if (recognized_kind() == MethodRecognizer::kDoubleRound) {
2352 result->set_temp(0, Location::RequiresXmmRegister());
2353 }
2354 return result;
2355 }
2356
2357
2358 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2359 XmmRegister value = locs()->in(0).xmm_reg();
2360 XmmRegister result = locs()->out().xmm_reg();
2361 if (recognized_kind() == MethodRecognizer::kDoubleTruncate) {
2362 __ roundsd(result, value, Assembler::kRoundToZero);
2363 } else {
2364 XmmRegister temp = locs()->temp(0).xmm_reg();
2365 __ DoubleRound(result, value, temp);
2366 }
2367 }
2368
2369
2343 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { 2370 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const {
2344 return MakeCallSummary(); 2371 return MakeCallSummary();
2345 } 2372 }
2346 2373
2347 2374
2348 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2375 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2349 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 2376 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
2350 kDeoptPolymorphicInstanceCallTestFail); 2377 kDeoptPolymorphicInstanceCallTestFail);
2351 if (ic_data().NumberOfChecks() == 0) { 2378 if (ic_data().NumberOfChecks() == 0) {
2352 __ jmp(deopt); 2379 __ jmp(deopt);
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. 2844 __ pcmpeqq(XMM0, XMM0); // Generate all 1's.
2818 __ pxor(value, XMM0); 2845 __ pxor(value, XMM0);
2819 } 2846 }
2820 2847
2821 2848
2822 } // namespace dart 2849 } // namespace dart
2823 2850
2824 #undef __ 2851 #undef __
2825 2852
2826 #endif // defined TARGET_ARCH_X64 2853 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698