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

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

Issue 11568044: Add DoubleToSmi optimistically, preventing boxing/unboxing of doubles and propagate smi-nessof the … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 compiler->GenerateStaticCall(instance_call()->deopt_id(), 2308 compiler->GenerateStaticCall(instance_call()->deopt_id(),
2309 instance_call()->token_pos(), 2309 instance_call()->token_pos(),
2310 target, 2310 target,
2311 kNumberOfArguments, 2311 kNumberOfArguments,
2312 Array::Handle(), // No argument names., 2312 Array::Handle(), // No argument names.,
2313 locs()); 2313 locs());
2314 __ Bind(&done); 2314 __ Bind(&done);
2315 } 2315 }
2316 2316
2317 2317
2318 LocationSummary* DoubleToSmiInstr::MakeLocationSummary() const {
2319 const intptr_t kNumInputs = 1;
2320 const intptr_t kNumTemps = 0;
2321 LocationSummary* result = new LocationSummary(
2322 kNumInputs, kNumTemps, LocationSummary::kNoCall);
2323 result->set_in(0, Location::RequiresXmmRegister());
2324 result->set_out(Location:: Location::RequiresRegister());
2325 return result;
2326 }
2327
2328
2329 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2330 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptDoubleToSmi);
2331 Register result = locs()->out().reg();
2332 XmmRegister value = locs()->in(0).xmm_reg();
2333 __ cvttsd2si(result, value);
2334 // Overflow is signalled with minint.
2335 Label do_call, done;
2336 // Check for overflow and that it fits into Smi.
2337 __ cmpl(result, Immediate(0xC0000000));
2338 __ j(NEGATIVE, deopt);
2339 __ SmiTag(result);
2340 }
2341
2342
2318 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { 2343 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const {
2319 return MakeCallSummary(); 2344 return MakeCallSummary();
2320 } 2345 }
2321 2346
2322 2347
2323 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2348 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2324 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 2349 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
2325 kDeoptPolymorphicInstanceCallTestFail); 2350 kDeoptPolymorphicInstanceCallTestFail);
2326 if (ic_data().NumberOfChecks() == 0) { 2351 if (ic_data().NumberOfChecks() == 0) {
2327 __ jmp(deopt); 2352 __ jmp(deopt);
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. 2817 __ pcmpeqq(XMM0, XMM0); // Generate all 1's.
2793 __ pxor(value, XMM0); 2818 __ pxor(value, XMM0);
2794 } 2819 }
2795 2820
2796 2821
2797 } // namespace dart 2822 } // namespace dart
2798 2823
2799 #undef __ 2824 #undef __
2800 2825
2801 #endif // defined TARGET_ARCH_X64 2826 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698