Chromium Code Reviews| 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/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 2748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2759 __ lslv(temp, left, TMP); | 2759 __ lslv(temp, left, TMP); |
| 2760 __ asrv(TMP2, temp, TMP); | 2760 __ asrv(TMP2, temp, TMP); |
| 2761 __ CompareRegisters(left, TMP2); | 2761 __ CompareRegisters(left, TMP2); |
| 2762 __ b(deopt, NE); // Overflow. | 2762 __ b(deopt, NE); // Overflow. |
| 2763 // Shift for result now we know there is no overflow. | 2763 // Shift for result now we know there is no overflow. |
| 2764 __ lslv(result, left, TMP); | 2764 __ lslv(result, left, TMP); |
| 2765 } | 2765 } |
| 2766 } | 2766 } |
| 2767 | 2767 |
| 2768 | 2768 |
| 2769 class CheckedSmiSlowPath : public SlowPathCode { | |
| 2770 public: | |
| 2771 CheckedSmiSlowPath(CheckedSmiOpInstr* instruction, intptr_t try_index) | |
| 2772 : instruction_(instruction), try_index_(try_index) { } | |
| 2773 | |
| 2774 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 2775 if (Assembler::EmittingComments()) { | |
| 2776 __ Comment("slow path smi operation"); | |
| 2777 } | |
| 2778 __ Bind(entry_label()); | |
| 2779 LocationSummary* locs = instruction_->locs(); | |
| 2780 Register result = locs->out(0).reg(); | |
| 2781 locs->live_registers()->Remove(Location::RegisterLocation(result)); | |
| 2782 | |
| 2783 compiler->SaveLiveRegisters(locs); | |
| 2784 __ Push(locs->in(0).reg()); | |
| 2785 __ Push(locs->in(1).reg()); | |
| 2786 compiler->EmitMegamorphicInstanceCall( | |
| 2787 *instruction_->call()->ic_data(), | |
| 2788 instruction_->call()->ArgumentCount(), | |
| 2789 instruction_->call()->deopt_id(), | |
| 2790 instruction_->call()->token_pos(), | |
| 2791 locs, | |
| 2792 try_index_, | |
| 2793 /* slow_path_argument_count = */ 2); | |
| 2794 __ mov(result, R0); | |
| 2795 compiler->RestoreLiveRegisters(locs); | |
| 2796 __ b(exit_label()); | |
| 2797 } | |
| 2798 | |
| 2799 private: | |
| 2800 CheckedSmiOpInstr* instruction_; | |
| 2801 intptr_t try_index_; | |
| 2802 }; | |
| 2803 | |
| 2804 | |
| 2805 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, | |
| 2806 bool opt) const { | |
| 2807 const intptr_t kNumInputs = 2; | |
| 2808 const intptr_t kNumTemps = 0; | |
| 2809 LocationSummary* summary = new(zone) LocationSummary( | |
| 2810 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | |
| 2811 summary->set_in(0, Location::RequiresRegister()); | |
| 2812 summary->set_in(1, Location::RequiresRegister()); | |
| 2813 summary->set_out(0, Location::RequiresRegister()); | |
| 2814 return summary; | |
| 2815 } | |
| 2816 | |
| 2817 | |
| 2818 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 2819 CheckedSmiSlowPath* slow_path = | |
| 2820 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); | |
| 2821 compiler->AddSlowPathCode(slow_path); | |
| 2822 // Test operands if necessary. | |
| 2823 Register left = locs()->in(0).reg(); | |
| 2824 Register right = locs()->in(1).reg(); | |
| 2825 Register result = locs()->out(0).reg(); | |
| 2826 __ tsti(left, Immediate(kSmiTagMask)); | |
|
Vyacheslav Egorov (Google)
2016/03/04 13:30:36
ditto from _arm
Florian Schneider
2016/03/04 16:55:09
Done.
| |
| 2827 __ b(slow_path->entry_label(), NE); | |
| 2828 __ tsti(right, Immediate(kSmiTagMask)); | |
| 2829 __ b(slow_path->entry_label(), NE); | |
| 2830 switch (op_kind()) { | |
| 2831 case Token::kADD: | |
| 2832 __ adds(result, left, Operand(right)); | |
| 2833 __ b(slow_path->entry_label(), VS); | |
| 2834 break; | |
| 2835 case Token::kSUB: | |
| 2836 __ subs(result, left, Operand(right)); | |
| 2837 __ b(slow_path->entry_label(), VS); | |
| 2838 break; | |
| 2839 case Token::kBIT_OR: | |
| 2840 __ orr(result, left, Operand(right)); | |
| 2841 break; | |
| 2842 case Token::kBIT_AND: | |
| 2843 __ and_(result, left, Operand(right)); | |
| 2844 break; | |
| 2845 case Token::kBIT_XOR: | |
| 2846 __ eor(result, left, Operand(right)); | |
| 2847 break; | |
| 2848 default: | |
| 2849 UNIMPLEMENTED(); | |
| 2850 } | |
| 2851 __ Bind(slow_path->exit_label()); | |
| 2852 } | |
| 2853 | |
| 2854 | |
| 2769 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, | 2855 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, |
| 2770 bool opt) const { | 2856 bool opt) const { |
| 2771 const intptr_t kNumInputs = 2; | 2857 const intptr_t kNumInputs = 2; |
| 2772 const intptr_t kNumTemps = | 2858 const intptr_t kNumTemps = |
| 2773 (((op_kind() == Token::kSHL) && can_overflow()) || | 2859 (((op_kind() == Token::kSHL) && can_overflow()) || |
| 2774 (op_kind() == Token::kSHR)) ? 1 : 0; | 2860 (op_kind() == Token::kSHR)) ? 1 : 0; |
| 2775 LocationSummary* summary = new(zone) LocationSummary( | 2861 LocationSummary* summary = new(zone) LocationSummary( |
| 2776 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2862 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2777 if (op_kind() == Token::kTRUNCDIV) { | 2863 if (op_kind() == Token::kTRUNCDIV) { |
| 2778 summary->set_in(0, Location::RequiresRegister()); | 2864 summary->set_in(0, Location::RequiresRegister()); |
| (...skipping 2803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5582 1, | 5668 1, |
| 5583 locs()); | 5669 locs()); |
| 5584 __ Drop(1); | 5670 __ Drop(1); |
| 5585 __ Pop(result); | 5671 __ Pop(result); |
| 5586 } | 5672 } |
| 5587 | 5673 |
| 5588 | 5674 |
| 5589 } // namespace dart | 5675 } // namespace dart |
| 5590 | 5676 |
| 5591 #endif // defined TARGET_ARCH_ARM64 | 5677 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |