| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 default: | 463 default: |
| 464 UNREACHABLE(); | 464 UNREACHABLE(); |
| 465 return VS; | 465 return VS; |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 | 468 |
| 469 | 469 |
| 470 static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, | 470 static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, |
| 471 LocationSummary* locs, | 471 LocationSummary* locs, |
| 472 Token::Kind kind) { | 472 Token::Kind kind) { |
| 473 VRegister left = locs->in(0).fpu_reg(); | 473 const VRegister left = locs->in(0).fpu_reg(); |
| 474 VRegister right = locs->in(1).fpu_reg(); | 474 const VRegister right = locs->in(1).fpu_reg(); |
| 475 __ fcmpd(left, right); | 475 __ fcmpd(left, right); |
| 476 Condition true_condition = TokenKindToDoubleCondition(kind); | 476 Condition true_condition = TokenKindToDoubleCondition(kind); |
| 477 return true_condition; | 477 return true_condition; |
| 478 } | 478 } |
| 479 | 479 |
| 480 | 480 |
| 481 Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 481 Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, |
| 482 BranchLabels labels) { | 482 BranchLabels labels) { |
| 483 if (operation_cid() == kSmiCid) { | 483 if (operation_cid() == kSmiCid) { |
| 484 return EmitSmiComparisonOp(compiler, locs(), kind()); | 484 return EmitSmiComparisonOp(compiler, locs(), kind()); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(bool opt) const { | 764 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(bool opt) const { |
| 765 const intptr_t kNumInputs = 1; | 765 const intptr_t kNumInputs = 1; |
| 766 // TODO(fschneider): Allow immediate operands for the char code. | 766 // TODO(fschneider): Allow immediate operands for the char code. |
| 767 return LocationSummary::Make(kNumInputs, | 767 return LocationSummary::Make(kNumInputs, |
| 768 Location::RequiresRegister(), | 768 Location::RequiresRegister(), |
| 769 LocationSummary::kNoCall); | 769 LocationSummary::kNoCall); |
| 770 } | 770 } |
| 771 | 771 |
| 772 | 772 |
| 773 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 773 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 774 Register char_code = locs()->in(0).reg(); | 774 const Register char_code = locs()->in(0).reg(); |
| 775 Register result = locs()->out(0).reg(); | 775 const Register result = locs()->out(0).reg(); |
| 776 __ LoadImmediate(result, | 776 __ LoadImmediate(result, |
| 777 reinterpret_cast<uword>(Symbols::PredefinedAddress()), PP); | 777 reinterpret_cast<uword>(Symbols::PredefinedAddress()), PP); |
| 778 __ AddImmediate( | 778 __ AddImmediate( |
| 779 result, result, Symbols::kNullCharCodeSymbolOffset * kWordSize, PP); | 779 result, result, Symbols::kNullCharCodeSymbolOffset * kWordSize, PP); |
| 780 __ Asr(TMP, char_code, kSmiTagShift); // Untag to use scaled adress mode. | 780 __ Asr(TMP, char_code, kSmiTagShift); // Untag to use scaled adress mode. |
| 781 __ ldr(result, Address(result, TMP, UXTX, Address::Scaled)); | 781 __ ldr(result, Address(result, TMP, UXTX, Address::Scaled)); |
| 782 } | 782 } |
| 783 | 783 |
| 784 | 784 |
| 785 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const { | 785 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const { |
| 786 const intptr_t kNumInputs = 1; | 786 const intptr_t kNumInputs = 1; |
| 787 return LocationSummary::Make(kNumInputs, | 787 return LocationSummary::Make(kNumInputs, |
| 788 Location::RequiresRegister(), | 788 Location::RequiresRegister(), |
| 789 LocationSummary::kNoCall); | 789 LocationSummary::kNoCall); |
| 790 } | 790 } |
| 791 | 791 |
| 792 | 792 |
| 793 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 793 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 794 ASSERT(cid_ == kOneByteStringCid); | 794 ASSERT(cid_ == kOneByteStringCid); |
| 795 Register str = locs()->in(0).reg(); | 795 const Register str = locs()->in(0).reg(); |
| 796 Register result = locs()->out(0).reg(); | 796 const Register result = locs()->out(0).reg(); |
| 797 __ LoadFieldFromOffset(result, str, String::length_offset(), PP); | 797 __ LoadFieldFromOffset(result, str, String::length_offset(), PP); |
| 798 __ ldr(TMP, FieldAddress(str, OneByteString::data_offset()), kUnsignedByte); |
| 798 __ CompareImmediate(result, Smi::RawValue(1), PP); | 799 __ CompareImmediate(result, Smi::RawValue(1), PP); |
| 799 __ LoadImmediate(TMP, Smi::RawValue(-1), PP); | 800 __ LoadImmediate(result, -1, PP); |
| 800 __ ldr(TMP2, FieldAddress(str, OneByteString::data_offset()), kUnsignedByte); | 801 __ csel(result, TMP, result, EQ); |
| 801 __ csel(result, TMP, result, NE); | |
| 802 __ csel(result, TMP2, result, EQ); | |
| 803 __ SmiTag(result); | 802 __ SmiTag(result); |
| 804 } | 803 } |
| 805 | 804 |
| 806 | 805 |
| 807 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { | 806 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { |
| 808 const intptr_t kNumInputs = 1; | 807 const intptr_t kNumInputs = 1; |
| 809 const intptr_t kNumTemps = 0; | 808 const intptr_t kNumTemps = 0; |
| 810 LocationSummary* summary = | 809 LocationSummary* summary = |
| 811 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 810 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 812 summary->set_in(0, Location::RegisterLocation(R0)); | 811 summary->set_in(0, Location::RegisterLocation(R0)); |
| (...skipping 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4360 compiler->GenerateCall(token_pos(), | 4359 compiler->GenerateCall(token_pos(), |
| 4361 &label, | 4360 &label, |
| 4362 PcDescriptors::kOther, | 4361 PcDescriptors::kOther, |
| 4363 locs()); | 4362 locs()); |
| 4364 __ Drop(ArgumentCount()); // Discard arguments. | 4363 __ Drop(ArgumentCount()); // Discard arguments. |
| 4365 } | 4364 } |
| 4366 | 4365 |
| 4367 } // namespace dart | 4366 } // namespace dart |
| 4368 | 4367 |
| 4369 #endif // defined TARGET_ARCH_ARM64 | 4368 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |