Chromium Code Reviews| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2878 // Overflow test (preserve left, right, and temp); | 2878 // Overflow test (preserve left, right, and temp); |
| 2879 __ sllv(CMPRES1, left, temp); | 2879 __ sllv(CMPRES1, left, temp); |
| 2880 __ srav(CMPRES1, CMPRES1, temp); | 2880 __ srav(CMPRES1, CMPRES1, temp); |
| 2881 __ bne(CMPRES1, left, deopt); // Overflow. | 2881 __ bne(CMPRES1, left, deopt); // Overflow. |
| 2882 // Shift for result now we know there is no overflow. | 2882 // Shift for result now we know there is no overflow. |
| 2883 __ sllv(result, left, temp); | 2883 __ sllv(result, left, temp); |
| 2884 } | 2884 } |
| 2885 } | 2885 } |
| 2886 | 2886 |
| 2887 | 2887 |
| 2888 class CheckedSmiSlowPath : public SlowPathCode { | |
| 2889 public: | |
| 2890 CheckedSmiSlowPath(CheckedSmiOpInstr* instruction, intptr_t try_index) | |
| 2891 : instruction_(instruction), try_index_(try_index) { } | |
| 2892 | |
| 2893 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 2894 if (Assembler::EmittingComments()) { | |
| 2895 __ Comment("slow path smi operation"); | |
| 2896 } | |
| 2897 __ Bind(entry_label()); | |
| 2898 LocationSummary* locs = instruction_->locs(); | |
| 2899 Register result = locs->out(0).reg(); | |
| 2900 locs->live_registers()->Remove(Location::RegisterLocation(result)); | |
| 2901 | |
| 2902 compiler->SaveLiveRegisters(locs); | |
| 2903 __ Push(locs->in(0).reg()); | |
| 2904 __ Push(locs->in(1).reg()); | |
| 2905 compiler->EmitMegamorphicInstanceCall( | |
| 2906 *instruction_->call()->ic_data(), | |
| 2907 instruction_->call()->ArgumentCount(), | |
| 2908 instruction_->call()->deopt_id(), | |
| 2909 instruction_->call()->token_pos(), | |
| 2910 locs, | |
| 2911 try_index_, | |
| 2912 /* slow_path_argument_count = */ 2); | |
| 2913 __ mov(result, V0); | |
| 2914 compiler->RestoreLiveRegisters(locs); | |
| 2915 __ b(exit_label()); | |
| 2916 } | |
| 2917 | |
| 2918 private: | |
| 2919 CheckedSmiOpInstr* instruction_; | |
| 2920 intptr_t try_index_; | |
| 2921 }; | |
| 2922 | |
| 2923 | |
| 2924 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, | |
| 2925 bool opt) const { | |
| 2926 const intptr_t kNumInputs = 2; | |
| 2927 const intptr_t kNumTemps = 0; | |
| 2928 LocationSummary* summary = new(zone) LocationSummary( | |
| 2929 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | |
| 2930 summary->set_in(0, Location::RequiresRegister()); | |
| 2931 summary->set_in(1, Location::RequiresRegister()); | |
| 2932 summary->set_out(0, Location::RequiresRegister()); | |
| 2933 return summary; | |
| 2934 } | |
| 2935 | |
| 2936 | |
| 2937 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 2938 CheckedSmiSlowPath* slow_path = | |
| 2939 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); | |
| 2940 compiler->AddSlowPathCode(slow_path); | |
| 2941 // Test operands if necessary. | |
| 2942 Register left = locs()->in(0).reg(); | |
| 2943 Register right = locs()->in(1).reg(); | |
| 2944 Register result = locs()->out(0).reg(); | |
| 2945 __ andi(CMPRES1, left, Immediate(kSmiTagMask)); | |
|
Vyacheslav Egorov (Google)
2016/03/04 13:30:36
ditto from arm
Florian Schneider
2016/03/04 16:55:09
Done.
| |
| 2946 __ bne(CMPRES1, ZR, slow_path->entry_label()); | |
| 2947 __ andi(CMPRES1, right, Immediate(kSmiTagMask)); | |
| 2948 __ bne(CMPRES1, ZR, slow_path->entry_label()); | |
| 2949 switch (op_kind()) { | |
| 2950 case Token::kADD: | |
| 2951 __ mov(result, left); | |
|
Vyacheslav Egorov (Google)
2016/03/04 13:30:36
Is this needed?
Florian Schneider
2016/03/04 16:55:09
Oops. Left over... removed.
| |
| 2952 __ AdduDetectOverflow(result, left, right, CMPRES1); | |
| 2953 __ bltz(CMPRES1, slow_path->entry_label()); | |
| 2954 break; | |
| 2955 case Token::kSUB: | |
| 2956 __ SubuDetectOverflow(result, left, right, CMPRES1); | |
| 2957 __ bltz(CMPRES1, slow_path->entry_label()); | |
| 2958 break; | |
| 2959 case Token::kBIT_OR: | |
| 2960 __ or_(result, left, right); | |
| 2961 break; | |
| 2962 case Token::kBIT_AND: | |
| 2963 __ and_(result, left, right); | |
| 2964 break; | |
| 2965 case Token::kBIT_XOR: | |
| 2966 __ xor_(result, left, right); | |
| 2967 break; | |
| 2968 default: | |
| 2969 UNIMPLEMENTED(); | |
| 2970 } | |
| 2971 __ Bind(slow_path->exit_label()); | |
| 2972 } | |
| 2973 | |
| 2974 | |
| 2888 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, | 2975 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, |
| 2889 bool opt) const { | 2976 bool opt) const { |
| 2890 const intptr_t kNumInputs = 2; | 2977 const intptr_t kNumInputs = 2; |
| 2891 const intptr_t kNumTemps = | 2978 const intptr_t kNumTemps = |
| 2892 ((op_kind() == Token::kADD) || | 2979 ((op_kind() == Token::kADD) || |
| 2893 (op_kind() == Token::kMOD) || | 2980 (op_kind() == Token::kMOD) || |
| 2894 (op_kind() == Token::kTRUNCDIV) || | 2981 (op_kind() == Token::kTRUNCDIV) || |
| 2895 (((op_kind() == Token::kSHL) && can_overflow()) || | 2982 (((op_kind() == Token::kSHL) && can_overflow()) || |
| 2896 (op_kind() == Token::kSHR))) ? 1 : 0; | 2983 (op_kind() == Token::kSHR))) ? 1 : 0; |
| 2897 LocationSummary* summary = new(zone) LocationSummary( | 2984 LocationSummary* summary = new(zone) LocationSummary( |
| (...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5598 1, | 5685 1, |
| 5599 locs()); | 5686 locs()); |
| 5600 __ lw(result, Address(SP, 1 * kWordSize)); | 5687 __ lw(result, Address(SP, 1 * kWordSize)); |
| 5601 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5688 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 5602 } | 5689 } |
| 5603 | 5690 |
| 5604 | 5691 |
| 5605 } // namespace dart | 5692 } // namespace dart |
| 5606 | 5693 |
| 5607 #endif // defined TARGET_ARCH_MIPS | 5694 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |