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

Side by Side Diff: runtime/vm/intermediate_language_x64.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_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 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 compiler->GenerateStaticCall(instance_call()->deopt_id(), 2197 compiler->GenerateStaticCall(instance_call()->deopt_id(),
2198 instance_call()->token_pos(), 2198 instance_call()->token_pos(),
2199 target, 2199 target,
2200 kNumberOfArguments, 2200 kNumberOfArguments,
2201 Array::Handle(), // No argument names. 2201 Array::Handle(), // No argument names.
2202 locs()); 2202 locs());
2203 __ Bind(&done); 2203 __ Bind(&done);
2204 } 2204 }
2205 2205
2206 2206
2207 LocationSummary* DoubleToSmiInstr::MakeLocationSummary() const {
2208 const intptr_t kNumInputs = 1;
2209 const intptr_t kNumTemps = 1;
2210 LocationSummary* result = new LocationSummary(
2211 kNumInputs, kNumTemps, LocationSummary::kNoCall);
2212 result->set_in(0, Location::RequiresXmmRegister());
2213 result->set_out(Location:: Location::RequiresRegister());
2214 result->set_temp(0, Location::RequiresRegister());
2215 return result;
2216 }
2217
2218
2219 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2220 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptDoubleToSmi);
2221 Register result = locs()->out().reg();
2222 XmmRegister value = locs()->in(0).xmm_reg();
2223 Register temp = locs()->temp(0).reg();
2224
2225 __ cvttsd2siq(result, value);
2226 // Overflow is signalled with minint.
2227 Label do_call, done;
2228 // Check for overflow and that it fits into Smi.
2229 __ movq(temp, result);
2230 __ shlq(temp, Immediate(1));
2231 __ j(OVERFLOW, deopt);
2232 __ SmiTag(result);
2233 }
2234
2235
2207 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { 2236 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const {
2208 return MakeCallSummary(); 2237 return MakeCallSummary();
2209 } 2238 }
2210 2239
2211 2240
2212 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2241 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2213 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 2242 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
2214 kDeoptPolymorphicInstanceCallTestFail); 2243 kDeoptPolymorphicInstanceCallTestFail);
2215 if (ic_data().NumberOfChecks() == 0) { 2244 if (ic_data().NumberOfChecks() == 0) {
2216 __ jmp(deopt); 2245 __ jmp(deopt);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 2464
2436 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2465 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2437 UNIMPLEMENTED(); 2466 UNIMPLEMENTED();
2438 } 2467 }
2439 2468
2440 } // namespace dart 2469 } // namespace dart
2441 2470
2442 #undef __ 2471 #undef __
2443 2472
2444 #endif // defined TARGET_ARCH_X64 2473 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698