| 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_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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 89 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 90 ASSERT(fp_sp_dist <= 0); | 90 ASSERT(fp_sp_dist <= 0); |
| 91 __ movq(RDI, RSP); | 91 __ movq(RDI, RSP); |
| 92 __ subq(RDI, RBP); | 92 __ subq(RDI, RBP); |
| 93 __ CompareImmediate(RDI, Immediate(fp_sp_dist), PP); | 93 __ CompareImmediate(RDI, Immediate(fp_sp_dist), PP); |
| 94 __ j(EQUAL, &done, Assembler::kNearJump); | 94 __ j(EQUAL, &done, Assembler::kNearJump); |
| 95 __ int3(); | 95 __ int3(); |
| 96 __ Bind(&done); | 96 __ Bind(&done); |
| 97 } | 97 } |
| 98 #endif | 98 #endif |
| 99 | 99 __ LeaveDartFrame(); |
| 100 __ ReturnPatchable(); | 100 __ ret(); |
| 101 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, | |
| 102 Isolate::kNoDeoptId, | |
| 103 token_pos()); | |
| 104 } | 101 } |
| 105 | 102 |
| 106 | 103 |
| 107 static Condition NegateCondition(Condition condition) { | 104 static Condition NegateCondition(Condition condition) { |
| 108 switch (condition) { | 105 switch (condition) { |
| 109 case EQUAL: return NOT_EQUAL; | 106 case EQUAL: return NOT_EQUAL; |
| 110 case NOT_EQUAL: return EQUAL; | 107 case NOT_EQUAL: return EQUAL; |
| 111 case LESS: return GREATER_EQUAL; | 108 case LESS: return GREATER_EQUAL; |
| 112 case LESS_EQUAL: return GREATER; | 109 case LESS_EQUAL: return GREATER; |
| 113 case GREATER: return LESS_EQUAL; | 110 case GREATER: return LESS_EQUAL; |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 return LocationSummary::Make(kNumInputs, | 655 return LocationSummary::Make(kNumInputs, |
| 659 Location::RequiresRegister(), | 656 Location::RequiresRegister(), |
| 660 LocationSummary::kNoCall); | 657 LocationSummary::kNoCall); |
| 661 } | 658 } |
| 662 | 659 |
| 663 | 660 |
| 664 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 661 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 665 Register char_code = locs()->in(0).reg(); | 662 Register char_code = locs()->in(0).reg(); |
| 666 Register result = locs()->out().reg(); | 663 Register result = locs()->out().reg(); |
| 667 __ LoadImmediate(result, | 664 __ LoadImmediate(result, |
| 668 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())), PP); | 665 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())), PP); |
| 669 __ movq(result, Address(result, | 666 __ movq(result, Address(result, |
| 670 char_code, | 667 char_code, |
| 671 TIMES_HALF_WORD_SIZE, // Char code is a smi. | 668 TIMES_HALF_WORD_SIZE, // Char code is a smi. |
| 672 Symbols::kNullCharCodeSymbolOffset * kWordSize)); | 669 Symbols::kNullCharCodeSymbolOffset * kWordSize)); |
| 673 } | 670 } |
| 674 | 671 |
| 675 | 672 |
| 673 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(bool opt) const { |
| 674 const intptr_t kNumInputs = 1; |
| 675 return LocationSummary::Make(kNumInputs, |
| 676 Location::RequiresRegister(), |
| 677 LocationSummary::kNoCall); |
| 678 } |
| 679 |
| 680 |
| 681 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 682 ASSERT(cid_ == kOneByteStringCid); |
| 683 Register str = locs()->in(0).reg(); |
| 684 Register result = locs()->out().reg(); |
| 685 Label is_one, done; |
| 686 __ movq(result, FieldAddress(str, String::length_offset())); |
| 687 __ cmpq(result, Immediate(Smi::RawValue(1))); |
| 688 __ j(EQUAL, &is_one, Assembler::kNearJump); |
| 689 __ movq(result, Immediate(Smi::RawValue(-1))); |
| 690 __ jmp(&done); |
| 691 __ Bind(&is_one); |
| 692 __ movzxb(result, FieldAddress(str, OneByteString::data_offset())); |
| 693 __ SmiTag(result); |
| 694 __ Bind(&done); |
| 695 } |
| 696 |
| 697 |
| 676 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { | 698 LocationSummary* StringInterpolateInstr::MakeLocationSummary(bool opt) const { |
| 677 const intptr_t kNumInputs = 1; | 699 const intptr_t kNumInputs = 1; |
| 678 const intptr_t kNumTemps = 0; | 700 const intptr_t kNumTemps = 0; |
| 679 LocationSummary* summary = | 701 LocationSummary* summary = |
| 680 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 702 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 681 summary->set_in(0, Location::RegisterLocation(RAX)); | 703 summary->set_in(0, Location::RegisterLocation(RAX)); |
| 682 summary->set_out(Location::RegisterLocation(RAX)); | 704 summary->set_out(Location::RegisterLocation(RAX)); |
| 683 return summary; | 705 return summary; |
| 684 } | 706 } |
| 685 | 707 |
| (...skipping 4253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4939 PcDescriptors::kOther, | 4961 PcDescriptors::kOther, |
| 4940 locs()); | 4962 locs()); |
| 4941 __ Drop(2); // Discard type arguments and receiver. | 4963 __ Drop(2); // Discard type arguments and receiver. |
| 4942 } | 4964 } |
| 4943 | 4965 |
| 4944 } // namespace dart | 4966 } // namespace dart |
| 4945 | 4967 |
| 4946 #undef __ | 4968 #undef __ |
| 4947 | 4969 |
| 4948 #endif // defined TARGET_ARCH_X64 | 4970 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |