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