| 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   __ or_(result, left, right); | 
|  | 2946   __ andi(CMPRES1, result, Immediate(kSmiTagMask)); | 
|  | 2947   __ bne(CMPRES1, ZR, slow_path->entry_label()); | 
|  | 2948   switch (op_kind()) { | 
|  | 2949     case Token::kADD: | 
|  | 2950       __ AdduDetectOverflow(result, left, right, CMPRES1); | 
|  | 2951       __ bltz(CMPRES1, slow_path->entry_label()); | 
|  | 2952       break; | 
|  | 2953     case Token::kSUB: | 
|  | 2954       __ SubuDetectOverflow(result, left, right, CMPRES1); | 
|  | 2955       __ bltz(CMPRES1, slow_path->entry_label()); | 
|  | 2956       break; | 
|  | 2957     case Token::kBIT_OR: | 
|  | 2958       // Operation part of combined smi check. | 
|  | 2959       break; | 
|  | 2960     case Token::kBIT_AND: | 
|  | 2961       __ and_(result, left, right); | 
|  | 2962       break; | 
|  | 2963     case Token::kBIT_XOR: | 
|  | 2964       __ xor_(result, left, right); | 
|  | 2965       break; | 
|  | 2966     default: | 
|  | 2967       UNIMPLEMENTED(); | 
|  | 2968   } | 
|  | 2969   __ Bind(slow_path->exit_label()); | 
|  | 2970 } | 
|  | 2971 | 
|  | 2972 | 
| 2888 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, | 2973 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, | 
| 2889                                                        bool opt) const { | 2974                                                        bool opt) const { | 
| 2890   const intptr_t kNumInputs = 2; | 2975   const intptr_t kNumInputs = 2; | 
| 2891   const intptr_t kNumTemps = | 2976   const intptr_t kNumTemps = | 
| 2892       ((op_kind() == Token::kADD) || | 2977       ((op_kind() == Token::kADD) || | 
| 2893        (op_kind() == Token::kMOD) || | 2978        (op_kind() == Token::kMOD) || | 
| 2894        (op_kind() == Token::kTRUNCDIV) || | 2979        (op_kind() == Token::kTRUNCDIV) || | 
| 2895        (((op_kind() == Token::kSHL) && can_overflow()) || | 2980        (((op_kind() == Token::kSHL) && can_overflow()) || | 
| 2896          (op_kind() == Token::kSHR))) ? 1 : 0; | 2981          (op_kind() == Token::kSHR))) ? 1 : 0; | 
| 2897   LocationSummary* summary = new(zone) LocationSummary( | 2982   LocationSummary* summary = new(zone) LocationSummary( | 
| (...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5598                                 1, | 5683                                 1, | 
| 5599                                 locs()); | 5684                                 locs()); | 
| 5600   __ lw(result, Address(SP, 1 * kWordSize)); | 5685   __ lw(result, Address(SP, 1 * kWordSize)); | 
| 5601   __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5686   __ addiu(SP, SP, Immediate(2 * kWordSize)); | 
| 5602 } | 5687 } | 
| 5603 | 5688 | 
| 5604 | 5689 | 
| 5605 }  // namespace dart | 5690 }  // namespace dart | 
| 5606 | 5691 | 
| 5607 #endif  // defined TARGET_ARCH_MIPS | 5692 #endif  // defined TARGET_ARCH_MIPS | 
| OLD | NEW | 
|---|