Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2305 if (!is_truncating()) { | 2305 if (!is_truncating()) { |
| 2306 summary->AddTemp(Location::RequiresRegister()); | 2306 summary->AddTemp(Location::RequiresRegister()); |
| 2307 } | 2307 } |
| 2308 summary->set_out(Location::SameAsFirstInput()); | 2308 summary->set_out(Location::SameAsFirstInput()); |
| 2309 return summary; | 2309 return summary; |
| 2310 } else { | 2310 } else { |
| 2311 const intptr_t kNumTemps = 0; | 2311 const intptr_t kNumTemps = 0; |
| 2312 LocationSummary* summary = | 2312 LocationSummary* summary = |
| 2313 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2313 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2314 summary->set_in(0, Location::RequiresRegister()); | 2314 summary->set_in(0, Location::RequiresRegister()); |
| 2315 summary->set_in(1, Location::RegisterOrSmiConstant(right())); | 2315 ConstantInstr* constant = right()->definition()->AsConstant(); |
| 2316 if (constant != NULL) { | |
| 2317 summary->set_in(1, Location::RegisterOrSmiConstant(right())); | |
| 2318 } else { | |
| 2319 summary->set_in(1, Location::Any()); | |
|
Florian Schneider
2013/05/28 10:09:37
We also have Location::PrefersRegister() as an alt
srdjan
2013/05/28 10:39:01
Changed to PrefersRegister, no significant differe
| |
| 2320 } | |
| 2316 summary->set_out(Location::SameAsFirstInput()); | 2321 summary->set_out(Location::SameAsFirstInput()); |
| 2317 return summary; | 2322 return summary; |
| 2318 } | 2323 } |
| 2319 } | 2324 } |
| 2320 | 2325 |
| 2321 | 2326 |
| 2322 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2327 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2323 if (op_kind() == Token::kSHL) { | 2328 if (op_kind() == Token::kSHL) { |
| 2324 EmitSmiShiftLeft(compiler, this); | 2329 EmitSmiShiftLeft(compiler, this); |
| 2325 return; | 2330 return; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2426 __ sarl(left, Immediate(value)); | 2431 __ sarl(left, Immediate(value)); |
| 2427 __ SmiTag(left); | 2432 __ SmiTag(left); |
| 2428 break; | 2433 break; |
| 2429 } | 2434 } |
| 2430 | 2435 |
| 2431 default: | 2436 default: |
| 2432 UNREACHABLE(); | 2437 UNREACHABLE(); |
| 2433 break; | 2438 break; |
| 2434 } | 2439 } |
| 2435 return; | 2440 return; |
| 2436 } | 2441 } // if locs()->in(1).IsConstant() |
| 2437 | 2442 |
| 2443 if (locs()->in(1).IsStackSlot()) { | |
| 2444 const Address& right = locs()->in(1).ToStackSlotAddress(); | |
| 2445 switch (op_kind()) { | |
| 2446 case Token::kADD: { | |
| 2447 __ addl(left, right); | |
| 2448 if (deopt != NULL) __ j(OVERFLOW, deopt); | |
| 2449 break; | |
| 2450 } | |
| 2451 case Token::kSUB: { | |
| 2452 __ subl(left, right); | |
| 2453 if (deopt != NULL) __ j(OVERFLOW, deopt); | |
| 2454 break; | |
| 2455 } | |
| 2456 case Token::kMUL: { | |
| 2457 __ SmiUntag(left); | |
| 2458 __ imull(left, right); | |
| 2459 if (deopt != NULL) __ j(OVERFLOW, deopt); | |
| 2460 break; | |
| 2461 } | |
| 2462 case Token::kBIT_AND: { | |
| 2463 // No overflow check. | |
| 2464 __ andl(left, right); | |
| 2465 break; | |
| 2466 } | |
| 2467 case Token::kBIT_OR: { | |
| 2468 // No overflow check. | |
| 2469 __ orl(left, right); | |
| 2470 break; | |
| 2471 } | |
| 2472 case Token::kBIT_XOR: { | |
| 2473 // No overflow check. | |
| 2474 __ xorl(left, right); | |
| 2475 break; | |
| 2476 } | |
| 2477 default: | |
| 2478 UNREACHABLE(); | |
| 2479 } | |
| 2480 return; | |
| 2481 } // if locs()->in(1).IsStackSlot. | |
| 2482 | |
| 2483 // if locs()->in(1).IsRegister. | |
| 2438 Register right = locs()->in(1).reg(); | 2484 Register right = locs()->in(1).reg(); |
| 2439 switch (op_kind()) { | 2485 switch (op_kind()) { |
| 2440 case Token::kADD: { | 2486 case Token::kADD: { |
| 2441 __ addl(left, right); | 2487 __ addl(left, right); |
| 2442 if (deopt != NULL) __ j(OVERFLOW, deopt); | 2488 if (deopt != NULL) __ j(OVERFLOW, deopt); |
| 2443 break; | 2489 break; |
| 2444 } | 2490 } |
| 2445 case Token::kSUB: { | 2491 case Token::kSUB: { |
| 2446 __ subl(left, right); | 2492 __ subl(left, right); |
| 2447 if (deopt != NULL) __ j(OVERFLOW, deopt); | 2493 if (deopt != NULL) __ j(OVERFLOW, deopt); |
| (...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4700 PcDescriptors::kOther, | 4746 PcDescriptors::kOther, |
| 4701 locs()); | 4747 locs()); |
| 4702 __ Drop(2); // Discard type arguments and receiver. | 4748 __ Drop(2); // Discard type arguments and receiver. |
| 4703 } | 4749 } |
| 4704 | 4750 |
| 4705 } // namespace dart | 4751 } // namespace dart |
| 4706 | 4752 |
| 4707 #undef __ | 4753 #undef __ |
| 4708 | 4754 |
| 4709 #endif // defined TARGET_ARCH_IA32 | 4755 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |