| OLD | NEW |
| 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 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 Assembler::kFarJump, | 2406 Assembler::kFarJump, |
| 2407 out_reg); | 2407 out_reg); |
| 2408 __ Bind(slow_path->exit_label()); | 2408 __ Bind(slow_path->exit_label()); |
| 2409 __ movsd(FieldAddress(out_reg, Mint::value_offset()), value); | 2409 __ movsd(FieldAddress(out_reg, Mint::value_offset()), value); |
| 2410 __ Bind(&done); | 2410 __ Bind(&done); |
| 2411 } | 2411 } |
| 2412 | 2412 |
| 2413 | 2413 |
| 2414 LocationSummary* UnboxedMintBinaryOpInstr::MakeLocationSummary() const { | 2414 LocationSummary* UnboxedMintBinaryOpInstr::MakeLocationSummary() const { |
| 2415 const intptr_t kNumInputs = 2; | 2415 const intptr_t kNumInputs = 2; |
| 2416 const intptr_t kNumTemps = 0; | 2416 switch (op_kind()) { |
| 2417 LocationSummary* summary = | 2417 case Token::kBIT_AND: |
| 2418 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2418 case Token::kBIT_OR: |
| 2419 summary->set_in(0, Location::RequiresXmmRegister()); | 2419 case Token::kBIT_XOR: { |
| 2420 summary->set_in(1, Location::RequiresXmmRegister()); | 2420 const intptr_t kNumTemps = 0; |
| 2421 summary->set_out(Location::SameAsFirstInput()); | 2421 LocationSummary* summary = |
| 2422 return summary; | 2422 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2423 summary->set_in(0, Location::RequiresXmmRegister()); |
| 2424 summary->set_in(1, Location::RequiresXmmRegister()); |
| 2425 summary->set_out(Location::SameAsFirstInput()); |
| 2426 return summary; |
| 2427 } |
| 2428 case Token::kADD: |
| 2429 case Token::kSUB: { |
| 2430 const intptr_t kNumTemps = 2; |
| 2431 LocationSummary* summary = |
| 2432 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2433 summary->set_in(0, Location::RequiresXmmRegister()); |
| 2434 summary->set_in(1, Location::RequiresXmmRegister()); |
| 2435 summary->set_temp(0, Location::RegisterLocation(EAX)); |
| 2436 summary->set_temp(1, Location::RegisterLocation(EDX)); |
| 2437 summary->set_out(Location::SameAsFirstInput()); |
| 2438 return summary; |
| 2439 } |
| 2440 default: |
| 2441 UNREACHABLE(); |
| 2442 return NULL; |
| 2443 } |
| 2423 } | 2444 } |
| 2424 | 2445 |
| 2425 | 2446 |
| 2426 void UnboxedMintBinaryOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2447 void UnboxedMintBinaryOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2427 XmmRegister left = locs()->in(0).xmm_reg(); | 2448 XmmRegister left = locs()->in(0).xmm_reg(); |
| 2428 XmmRegister right = locs()->in(1).xmm_reg(); | 2449 XmmRegister right = locs()->in(1).xmm_reg(); |
| 2429 | 2450 |
| 2430 ASSERT(locs()->out().xmm_reg() == left); | 2451 ASSERT(locs()->out().xmm_reg() == left); |
| 2431 | 2452 |
| 2432 switch (op_kind()) { | 2453 switch (op_kind()) { |
| 2433 case Token::kBIT_AND: __ andpd(left, right); break; | 2454 case Token::kBIT_AND: __ andpd(left, right); break; |
| 2434 case Token::kBIT_OR: __ orpd(left, right); break; | 2455 case Token::kBIT_OR: __ orpd(left, right); break; |
| 2435 case Token::kBIT_XOR: __ xorpd(left, right); break; | 2456 case Token::kBIT_XOR: __ xorpd(left, right); break; |
| 2457 case Token::kADD: |
| 2458 case Token::kSUB: { |
| 2459 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
| 2460 kDeoptBinaryMintOp); |
| 2461 Label done, overflow; |
| 2462 __ pextrd(EAX, right, Immediate(0)); // Lower half left |
| 2463 __ pextrd(EDX, right, Immediate(1)); // Upper half left |
| 2464 __ subl(ESP, Immediate(2 * kWordSize)); |
| 2465 __ movq(Address(ESP, 0), left); |
| 2466 if (op_kind() == Token::kADD) { |
| 2467 __ addl(Address(ESP, 0), EAX); |
| 2468 __ adcl(Address(ESP, 4), EDX); |
| 2469 } else { |
| 2470 __ subl(Address(ESP, 0), EAX); |
| 2471 __ sbbl(Address(ESP, 4), EDX); |
| 2472 } |
| 2473 __ j(OVERFLOW, &overflow); |
| 2474 __ movq(left, Address(ESP, 0)); |
| 2475 __ addl(ESP, Immediate(2 * kWordSize)); |
| 2476 __ jmp(&done); |
| 2477 __ Bind(&overflow); |
| 2478 __ addl(ESP, Immediate(2 * kWordSize)); |
| 2479 __ jmp(deopt); |
| 2480 __ Bind(&done); |
| 2481 break; |
| 2482 } |
| 2436 default: UNREACHABLE(); | 2483 default: UNREACHABLE(); |
| 2437 } | 2484 } |
| 2438 } | 2485 } |
| 2439 | 2486 |
| 2440 | |
| 2441 | |
| 2442 } // namespace dart | 2487 } // namespace dart |
| 2443 | 2488 |
| 2444 #undef __ | 2489 #undef __ |
| 2445 | 2490 |
| 2446 #endif // defined TARGET_ARCH_X64 | 2491 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |