| 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_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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 __ jmp(&done); | 566 __ jmp(&done); |
| 567 __ Bind(&non_null_compare); // Receiver is not null. | 567 __ Bind(&non_null_compare); // Receiver is not null. |
| 568 __ pushq(left); | 568 __ pushq(left); |
| 569 __ pushq(right); | 569 __ pushq(right); |
| 570 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, | 570 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, |
| 571 deopt_id, token_pos); | 571 deopt_id, token_pos); |
| 572 __ Bind(&done); | 572 __ Bind(&done); |
| 573 } | 573 } |
| 574 | 574 |
| 575 | 575 |
| 576 Immediate SmiConstantToImmediate(const Object& constant) { | |
| 577 ASSERT(constant.IsSmi()); | |
| 578 return Immediate(reinterpret_cast<int64_t>(constant.raw())); | |
| 579 } | |
| 580 | |
| 581 | |
| 582 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, | 576 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, |
| 583 const LocationSummary& locs, | 577 const LocationSummary& locs, |
| 584 Token::Kind kind, | 578 Token::Kind kind, |
| 585 BranchInstr* branch) { | 579 BranchInstr* branch) { |
| 586 Location left = locs.in(0); | 580 Location left = locs.in(0); |
| 587 Location right = locs.in(1); | 581 Location right = locs.in(1); |
| 588 | 582 |
| 589 Condition true_condition = TokenKindToSmiCondition(kind); | 583 Condition true_condition = TokenKindToSmiCondition(kind); |
| 590 | 584 |
| 591 if (left.IsConstant() && right.IsConstant()) { | 585 if (left.IsConstant() && right.IsConstant()) { |
| 592 // TODO(vegorov): should be eliminated earlier by constant propagation. | 586 // TODO(vegorov): should be eliminated earlier by constant propagation. |
| 593 const bool result = FlowGraphCompiler::EvaluateCondition( | 587 const bool result = FlowGraphCompiler::EvaluateCondition( |
| 594 true_condition, | 588 true_condition, |
| 595 Smi::Cast(left.constant()).Value(), | 589 Smi::Cast(left.constant()).Value(), |
| 596 Smi::Cast(right.constant()).Value()); | 590 Smi::Cast(right.constant()).Value()); |
| 597 | 591 |
| 598 if (branch != NULL) { | 592 if (branch != NULL) { |
| 599 branch->EmitBranchOnValue(compiler, result); | 593 branch->EmitBranchOnValue(compiler, result); |
| 600 } else { | 594 } else { |
| 601 __ LoadObject(locs.out().reg(), result ? compiler->bool_true() | 595 __ LoadObject(locs.out().reg(), result ? compiler->bool_true() |
| 602 : compiler->bool_false()); | 596 : compiler->bool_false()); |
| 603 } | 597 } |
| 604 | 598 |
| 605 return; | 599 return; |
| 606 } | 600 } |
| 607 | 601 |
| 608 if (left.IsConstant()) { | 602 if (left.IsConstant()) { |
| 609 __ cmpq(right.reg(), SmiConstantToImmediate(left.constant())); | 603 __ CompareObject(right.reg(), left.constant()); |
| 610 true_condition = FlowGraphCompiler::FlipCondition(true_condition); | 604 true_condition = FlowGraphCompiler::FlipCondition(true_condition); |
| 611 } else if (right.IsConstant()) { | 605 } else if (right.IsConstant()) { |
| 612 __ cmpq(left.reg(), SmiConstantToImmediate(right.constant())); | 606 __ CompareObject(left.reg(), right.constant()); |
| 613 } else { | 607 } else { |
| 614 __ cmpq(left.reg(), right.reg()); | 608 __ cmpq(left.reg(), right.reg()); |
| 615 } | 609 } |
| 616 | 610 |
| 617 if (branch != NULL) { | 611 if (branch != NULL) { |
| 618 branch->EmitBranchOnCondition(compiler, true_condition); | 612 branch->EmitBranchOnCondition(compiler, true_condition); |
| 619 } else { | 613 } else { |
| 620 Register result = locs.out().reg(); | 614 Register result = locs.out().reg(); |
| 621 Label done, is_true; | 615 Label done, is_true; |
| 622 __ j(true_condition, &is_true); | 616 __ j(true_condition, &is_true); |
| (...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 void UnboxedMintBinaryOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2276 void UnboxedMintBinaryOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2283 UNIMPLEMENTED(); | 2277 UNIMPLEMENTED(); |
| 2284 } | 2278 } |
| 2285 | 2279 |
| 2286 | 2280 |
| 2287 } // namespace dart | 2281 } // namespace dart |
| 2288 | 2282 |
| 2289 #undef __ | 2283 #undef __ |
| 2290 | 2284 |
| 2291 #endif // defined TARGET_ARCH_X64 | 2285 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |