Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: runtime/vm/intermediate_language_arm64.cc

Issue 1756403002: VM: Add smi fast path operations for precompiled code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 __ orr(result, left, Operand(right));
2827 __ tsti(result, Immediate(kSmiTagMask));
2828 __ b(slow_path->entry_label(), NE);
2829 switch (op_kind()) {
2830 case Token::kADD:
2831 __ adds(result, left, Operand(right));
2832 __ b(slow_path->entry_label(), VS);
2833 break;
2834 case Token::kSUB:
2835 __ subs(result, left, Operand(right));
2836 __ b(slow_path->entry_label(), VS);
2837 break;
2838 case Token::kBIT_OR:
2839 // Operation part of combined smi check.
2840 break;
2841 case Token::kBIT_AND:
2842 __ and_(result, left, Operand(right));
2843 break;
2844 case Token::kBIT_XOR:
2845 __ eor(result, left, Operand(right));
2846 break;
2847 default:
2848 UNIMPLEMENTED();
2849 }
2850 __ Bind(slow_path->exit_label());
2851 }
2852
2853
2769 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, 2854 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
2770 bool opt) const { 2855 bool opt) const {
2771 const intptr_t kNumInputs = 2; 2856 const intptr_t kNumInputs = 2;
2772 const intptr_t kNumTemps = 2857 const intptr_t kNumTemps =
2773 (((op_kind() == Token::kSHL) && can_overflow()) || 2858 (((op_kind() == Token::kSHL) && can_overflow()) ||
2774 (op_kind() == Token::kSHR)) ? 1 : 0; 2859 (op_kind() == Token::kSHR)) ? 1 : 0;
2775 LocationSummary* summary = new(zone) LocationSummary( 2860 LocationSummary* summary = new(zone) LocationSummary(
2776 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2861 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2777 if (op_kind() == Token::kTRUNCDIV) { 2862 if (op_kind() == Token::kTRUNCDIV) {
2778 summary->set_in(0, Location::RequiresRegister()); 2863 summary->set_in(0, Location::RequiresRegister());
(...skipping 2803 matching lines...) Expand 10 before | Expand all | Expand 10 after
5582 1, 5667 1,
5583 locs()); 5668 locs());
5584 __ Drop(1); 5669 __ Drop(1);
5585 __ Pop(result); 5670 __ Pop(result);
5586 } 5671 }
5587 5672
5588 5673
5589 } // namespace dart 5674 } // namespace dart
5590 5675
5591 #endif // defined TARGET_ARCH_ARM64 5676 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698