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

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

Issue 16126003: Use stack locations instead of register for binary Smi operations when possible. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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) 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_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 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 if (!is_truncating()) { 2313 if (!is_truncating()) {
2314 summary->AddTemp(Location::RequiresRegister()); 2314 summary->AddTemp(Location::RequiresRegister());
2315 } 2315 }
2316 summary->set_out(Location::SameAsFirstInput()); 2316 summary->set_out(Location::SameAsFirstInput());
2317 return summary; 2317 return summary;
2318 } else { 2318 } else {
2319 const intptr_t kNumTemps = 0; 2319 const intptr_t kNumTemps = 0;
2320 LocationSummary* summary = 2320 LocationSummary* summary =
2321 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2321 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2322 summary->set_in(0, Location::RequiresRegister()); 2322 summary->set_in(0, Location::RequiresRegister());
2323 summary->set_in(1, Location::RegisterOrSmiConstant(right())); 2323 ConstantInstr* constant = right()->definition()->AsConstant();
2324 if (constant != NULL) {
2325 summary->set_in(1, Location::RegisterOrSmiConstant(right()));
2326 } else {
2327 summary->set_in(1, Location::PrefersRegister());
2328 }
2324 summary->set_out(Location::SameAsFirstInput()); 2329 summary->set_out(Location::SameAsFirstInput());
2325 return summary; 2330 return summary;
2326 } 2331 }
2327 } 2332 }
2328 2333
2329 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2334 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2330 if (op_kind() == Token::kSHL) { 2335 if (op_kind() == Token::kSHL) {
2331 EmitSmiShiftLeft(compiler, this); 2336 EmitSmiShiftLeft(compiler, this);
2332 return; 2337 return;
2333 } 2338 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2437 __ sarq(left, Immediate(value)); 2442 __ sarq(left, Immediate(value));
2438 __ SmiTag(left); 2443 __ SmiTag(left);
2439 break; 2444 break;
2440 } 2445 }
2441 2446
2442 default: 2447 default:
2443 UNREACHABLE(); 2448 UNREACHABLE();
2444 break; 2449 break;
2445 } 2450 }
2446 return; 2451 return;
2447 } 2452 } // locs()->in(1).IsConstant().
2448 2453
2454
2455 if (locs()->in(1).IsStackSlot()) {
2456 const Address& right = locs()->in(1).ToStackSlotAddress();
2457 switch (op_kind()) {
2458 case Token::kADD: {
2459 __ addq(left, right);
2460 if (deopt != NULL) __ j(OVERFLOW, deopt);
2461 break;
2462 }
2463 case Token::kSUB: {
2464 __ subq(left, right);
2465 if (deopt != NULL) __ j(OVERFLOW, deopt);
2466 break;
2467 }
2468 case Token::kMUL: {
2469 __ SmiUntag(left);
2470 __ imulq(left, right);
2471 if (deopt != NULL) __ j(OVERFLOW, deopt);
2472 break;
2473 }
2474 case Token::kBIT_AND: {
2475 // No overflow check.
2476 __ andq(left, right);
2477 break;
2478 }
2479 case Token::kBIT_OR: {
2480 // No overflow check.
2481 __ orq(left, right);
2482 break;
2483 }
2484 case Token::kBIT_XOR: {
2485 // No overflow check.
2486 __ xorq(left, right);
2487 break;
2488 }
2489 default:
2490 UNREACHABLE();
2491 break;
2492 }
2493 return;
2494 } // locs()->in(1).IsStackSlot().
2495
2496 // if locs()->in(1).IsRegister.
2449 Register right = locs()->in(1).reg(); 2497 Register right = locs()->in(1).reg();
2450 switch (op_kind()) { 2498 switch (op_kind()) {
2451 case Token::kADD: { 2499 case Token::kADD: {
2452 __ addq(left, right); 2500 __ addq(left, right);
2453 if (deopt != NULL) __ j(OVERFLOW, deopt); 2501 if (deopt != NULL) __ j(OVERFLOW, deopt);
2454 break; 2502 break;
2455 } 2503 }
2456 case Token::kSUB: { 2504 case Token::kSUB: {
2457 __ subq(left, right); 2505 __ subq(left, right);
2458 if (deopt != NULL) __ j(OVERFLOW, deopt); 2506 if (deopt != NULL) __ j(OVERFLOW, deopt);
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
4344 PcDescriptors::kOther, 4392 PcDescriptors::kOther,
4345 locs()); 4393 locs());
4346 __ Drop(2); // Discard type arguments and receiver. 4394 __ Drop(2); // Discard type arguments and receiver.
4347 } 4395 }
4348 4396
4349 } // namespace dart 4397 } // namespace dart
4350 4398
4351 #undef __ 4399 #undef __
4352 4400
4353 #endif // defined TARGET_ARCH_X64 4401 #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