| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 // Load closure function code in T2. | 294 // Load closure function code in T2. |
| 295 // S4: arguments descriptor array. | 295 // S4: arguments descriptor array. |
| 296 // S5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 296 // S5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
| 297 ASSERT(locs()->in(0).reg() == T0); | 297 ASSERT(locs()->in(0).reg() == T0); |
| 298 __ LoadImmediate(S5, 0); | 298 __ LoadImmediate(S5, 0); |
| 299 __ lw(T2, FieldAddress(T0, Function::entry_point_offset())); | 299 __ lw(T2, FieldAddress(T0, Function::entry_point_offset())); |
| 300 __ lw(CODE_REG, FieldAddress(T0, Function::code_offset())); | 300 __ lw(CODE_REG, FieldAddress(T0, Function::code_offset())); |
| 301 __ jalr(T2); | 301 __ jalr(T2); |
| 302 compiler->RecordSafepoint(locs()); | 302 compiler->RecordSafepoint(locs()); |
| 303 compiler->EmitCatchEntryState(); |
| 303 // Marks either the continuation point in unoptimized code or the | 304 // Marks either the continuation point in unoptimized code or the |
| 304 // deoptimization point in optimized code, after call. | 305 // deoptimization point in optimized code, after call. |
| 305 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); | 306 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); |
| 306 if (compiler->is_optimizing()) { | 307 if (compiler->is_optimizing()) { |
| 307 compiler->AddDeoptIndexAtCall(deopt_id_after); | 308 compiler->AddDeoptIndexAtCall(deopt_id_after); |
| 308 } | 309 } |
| 309 // Add deoptimization continuation point after the call and before the | 310 // Add deoptimization continuation point after the call and before the |
| 310 // arguments are removed. | 311 // arguments are removed. |
| 311 // In optimized code this descriptor is needed for exception handling. | 312 // In optimized code this descriptor is needed for exception handling. |
| 312 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, | 313 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, |
| (...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2343 __ Pop(kResultReg); | 2344 __ Pop(kResultReg); |
| 2344 __ Bind(&done); | 2345 __ Bind(&done); |
| 2345 return; | 2346 return; |
| 2346 } | 2347 } |
| 2347 } | 2348 } |
| 2348 | 2349 |
| 2349 __ Bind(&slow_path); | 2350 __ Bind(&slow_path); |
| 2350 const Code& stub = Code::ZoneHandle(compiler->zone(), | 2351 const Code& stub = Code::ZoneHandle(compiler->zone(), |
| 2351 StubCode::AllocateArray_entry()->code()); | 2352 StubCode::AllocateArray_entry()->code()); |
| 2352 compiler->AddStubCallTarget(stub); | 2353 compiler->AddStubCallTarget(stub); |
| 2353 compiler->GenerateCall(token_pos(), *StubCode::AllocateArray_entry(), | 2354 compiler->GenerateCallWithDeopt(token_pos(), deopt_id(), |
| 2354 RawPcDescriptors::kOther, locs()); | 2355 *StubCode::AllocateArray_entry(), |
| 2356 RawPcDescriptors::kOther, locs()); |
| 2355 __ Bind(&done); | 2357 __ Bind(&done); |
| 2356 ASSERT(locs()->out(0).reg() == kResultReg); | 2358 ASSERT(locs()->out(0).reg() == kResultReg); |
| 2357 } | 2359 } |
| 2358 | 2360 |
| 2359 | 2361 |
| 2360 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, | 2362 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, |
| 2361 bool opt) const { | 2363 bool opt) const { |
| 2362 const intptr_t kNumInputs = 1; | 2364 const intptr_t kNumInputs = 1; |
| 2363 const intptr_t kNumTemps = | 2365 const intptr_t kNumTemps = |
| 2364 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 2 : 0); | 2366 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 2 : 0); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2956 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2958 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2957 if (Assembler::EmittingComments()) { | 2959 if (Assembler::EmittingComments()) { |
| 2958 __ Comment("slow path smi operation"); | 2960 __ Comment("slow path smi operation"); |
| 2959 } | 2961 } |
| 2960 __ Bind(entry_label()); | 2962 __ Bind(entry_label()); |
| 2961 LocationSummary* locs = instruction_->locs(); | 2963 LocationSummary* locs = instruction_->locs(); |
| 2962 Register result = locs->out(0).reg(); | 2964 Register result = locs->out(0).reg(); |
| 2963 locs->live_registers()->Remove(Location::RegisterLocation(result)); | 2965 locs->live_registers()->Remove(Location::RegisterLocation(result)); |
| 2964 | 2966 |
| 2965 compiler->SaveLiveRegisters(locs); | 2967 compiler->SaveLiveRegisters(locs); |
| 2968 if (instruction_->env() != NULL) { |
| 2969 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 2970 compiler->pending_deoptimization_env_ = env; |
| 2971 } |
| 2966 __ Push(locs->in(0).reg()); | 2972 __ Push(locs->in(0).reg()); |
| 2967 __ Push(locs->in(1).reg()); | 2973 __ Push(locs->in(1).reg()); |
| 2968 compiler->EmitMegamorphicInstanceCall( | 2974 compiler->EmitMegamorphicInstanceCall( |
| 2969 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), | 2975 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), |
| 2970 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), | 2976 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), |
| 2971 locs, try_index_, | 2977 locs, try_index_, |
| 2972 /* slow_path_argument_count = */ 2); | 2978 /* slow_path_argument_count = */ 2); |
| 2973 __ mov(result, V0); | 2979 __ mov(result, V0); |
| 2974 compiler->RestoreLiveRegisters(locs); | 2980 compiler->RestoreLiveRegisters(locs); |
| 2975 __ b(exit_label()); | 2981 __ b(exit_label()); |
| 2982 compiler->pending_deoptimization_env_ = NULL; |
| 2976 } | 2983 } |
| 2977 | 2984 |
| 2978 private: | 2985 private: |
| 2979 CheckedSmiOpInstr* instruction_; | 2986 CheckedSmiOpInstr* instruction_; |
| 2980 intptr_t try_index_; | 2987 intptr_t try_index_; |
| 2981 }; | 2988 }; |
| 2982 | 2989 |
| 2983 | 2990 |
| 2984 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, | 2991 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, |
| 2985 bool opt) const { | 2992 bool opt) const { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3087 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 3094 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3088 if (Assembler::EmittingComments()) { | 3095 if (Assembler::EmittingComments()) { |
| 3089 __ Comment("slow path smi operation"); | 3096 __ Comment("slow path smi operation"); |
| 3090 } | 3097 } |
| 3091 __ Bind(entry_label()); | 3098 __ Bind(entry_label()); |
| 3092 LocationSummary* locs = instruction_->locs(); | 3099 LocationSummary* locs = instruction_->locs(); |
| 3093 Register result = merged_ ? locs->temp(0).reg() : locs->out(0).reg(); | 3100 Register result = merged_ ? locs->temp(0).reg() : locs->out(0).reg(); |
| 3094 locs->live_registers()->Remove(Location::RegisterLocation(result)); | 3101 locs->live_registers()->Remove(Location::RegisterLocation(result)); |
| 3095 | 3102 |
| 3096 compiler->SaveLiveRegisters(locs); | 3103 compiler->SaveLiveRegisters(locs); |
| 3104 if (instruction_->env() != NULL) { |
| 3105 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 3106 compiler->pending_deoptimization_env_ = env; |
| 3107 } |
| 3097 __ Push(locs->in(0).reg()); | 3108 __ Push(locs->in(0).reg()); |
| 3098 __ Push(locs->in(1).reg()); | 3109 __ Push(locs->in(1).reg()); |
| 3099 compiler->EmitMegamorphicInstanceCall( | 3110 compiler->EmitMegamorphicInstanceCall( |
| 3100 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), | 3111 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), |
| 3101 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), | 3112 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), |
| 3102 locs, try_index_, | 3113 locs, try_index_, |
| 3103 /* slow_path_argument_count = */ 2); | 3114 /* slow_path_argument_count = */ 2); |
| 3104 __ mov(result, V0); | 3115 __ mov(result, V0); |
| 3105 compiler->RestoreLiveRegisters(locs); | 3116 compiler->RestoreLiveRegisters(locs); |
| 3117 compiler->pending_deoptimization_env_ = NULL; |
| 3106 if (merged_) { | 3118 if (merged_) { |
| 3107 __ BranchEqual(result, Bool::True(), instruction_->is_negated() | 3119 __ BranchEqual(result, Bool::True(), instruction_->is_negated() |
| 3108 ? labels_.false_label | 3120 ? labels_.false_label |
| 3109 : labels_.true_label); | 3121 : labels_.true_label); |
| 3110 __ b(instruction_->is_negated() ? labels_.true_label | 3122 __ b(instruction_->is_negated() ? labels_.true_label |
| 3111 : labels_.false_label); | 3123 : labels_.false_label); |
| 3112 } else { | 3124 } else { |
| 3113 __ b(exit_label()); | 3125 __ b(exit_label()); |
| 3114 } | 3126 } |
| 3115 } | 3127 } |
| (...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5124 public: | 5136 public: |
| 5125 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) | 5137 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) |
| 5126 : instruction_(instruction), try_index_(try_index) {} | 5138 : instruction_(instruction), try_index_(try_index) {} |
| 5127 | 5139 |
| 5128 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 5140 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5129 if (Assembler::EmittingComments()) { | 5141 if (Assembler::EmittingComments()) { |
| 5130 __ Comment("slow path check bound operation"); | 5142 __ Comment("slow path check bound operation"); |
| 5131 } | 5143 } |
| 5132 __ Bind(entry_label()); | 5144 __ Bind(entry_label()); |
| 5133 LocationSummary* locs = instruction_->locs(); | 5145 LocationSummary* locs = instruction_->locs(); |
| 5146 compiler->SaveLiveRegisters(locs); |
| 5134 __ Push(locs->in(0).reg()); | 5147 __ Push(locs->in(0).reg()); |
| 5135 __ Push(locs->in(1).reg()); | 5148 __ Push(locs->in(1).reg()); |
| 5136 __ CallRuntime(kRangeErrorRuntimeEntry, 2); | 5149 __ CallRuntime(kRangeErrorRuntimeEntry, 2); |
| 5137 compiler->AddDescriptor( | 5150 compiler->AddDescriptor( |
| 5138 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), | 5151 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), |
| 5139 instruction_->deopt_id(), instruction_->token_pos(), try_index_); | 5152 instruction_->deopt_id(), instruction_->token_pos(), try_index_); |
| 5153 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 5154 compiler->EmitCatchEntryState(env, try_index_); |
| 5140 __ break_(0); | 5155 __ break_(0); |
| 5141 } | 5156 } |
| 5142 | 5157 |
| 5143 private: | 5158 private: |
| 5144 GenericCheckBoundInstr* instruction_; | 5159 GenericCheckBoundInstr* instruction_; |
| 5145 intptr_t try_index_; | 5160 intptr_t try_index_; |
| 5146 }; | 5161 }; |
| 5147 | 5162 |
| 5148 | 5163 |
| 5149 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5164 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6011 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), | 6026 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), |
| 6012 kGrowRegExpStackRuntimeEntry, 1, locs()); | 6027 kGrowRegExpStackRuntimeEntry, 1, locs()); |
| 6013 __ lw(result, Address(SP, 1 * kWordSize)); | 6028 __ lw(result, Address(SP, 1 * kWordSize)); |
| 6014 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 6029 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 6015 } | 6030 } |
| 6016 | 6031 |
| 6017 | 6032 |
| 6018 } // namespace dart | 6033 } // namespace dart |
| 6019 | 6034 |
| 6020 #endif // defined TARGET_ARCH_MIPS | 6035 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |