OLD | NEW |
1 | 1 |
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. | 6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
7 #if defined(TARGET_ARCH_ARM) | 7 #if defined(TARGET_ARCH_ARM) |
8 | 8 |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 | 10 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // R0: Function. | 234 // R0: Function. |
235 ASSERT(locs()->in(0).reg() == R0); | 235 ASSERT(locs()->in(0).reg() == R0); |
236 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); | 236 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); |
237 __ ldr(R2, FieldAddress(R0, Function::entry_point_offset())); | 237 __ ldr(R2, FieldAddress(R0, Function::entry_point_offset())); |
238 | 238 |
239 // R2: instructions entry point. | 239 // R2: instructions entry point. |
240 // R9: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 240 // R9: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
241 __ LoadImmediate(R9, 0); | 241 __ LoadImmediate(R9, 0); |
242 __ blx(R2); | 242 __ blx(R2); |
243 compiler->RecordSafepoint(locs()); | 243 compiler->RecordSafepoint(locs()); |
| 244 compiler->EmitCatchEntryState(); |
244 // Marks either the continuation point in unoptimized code or the | 245 // Marks either the continuation point in unoptimized code or the |
245 // deoptimization point in optimized code, after call. | 246 // deoptimization point in optimized code, after call. |
246 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); | 247 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); |
247 if (compiler->is_optimizing()) { | 248 if (compiler->is_optimizing()) { |
248 compiler->AddDeoptIndexAtCall(deopt_id_after); | 249 compiler->AddDeoptIndexAtCall(deopt_id_after); |
249 } | 250 } |
250 // Add deoptimization continuation point after the call and before the | 251 // Add deoptimization continuation point after the call and before the |
251 // arguments are removed. | 252 // arguments are removed. |
252 // In optimized code this descriptor is needed for exception handling. | 253 // In optimized code this descriptor is needed for exception handling. |
253 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, | 254 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, |
(...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 kAllocateArrayRuntimeEntry, 2, locs()); | 2470 kAllocateArrayRuntimeEntry, 2, locs()); |
2470 __ Drop(2); | 2471 __ Drop(2); |
2471 __ Pop(kResultReg); | 2472 __ Pop(kResultReg); |
2472 __ Bind(&done); | 2473 __ Bind(&done); |
2473 return; | 2474 return; |
2474 } | 2475 } |
2475 } | 2476 } |
2476 const Code& stub = Code::ZoneHandle(compiler->zone(), | 2477 const Code& stub = Code::ZoneHandle(compiler->zone(), |
2477 StubCode::AllocateArray_entry()->code()); | 2478 StubCode::AllocateArray_entry()->code()); |
2478 compiler->AddStubCallTarget(stub); | 2479 compiler->AddStubCallTarget(stub); |
2479 compiler->GenerateCall(token_pos(), *StubCode::AllocateArray_entry(), | 2480 compiler->GenerateCallWithDeopt(token_pos(), deopt_id(), |
2480 RawPcDescriptors::kOther, locs()); | 2481 *StubCode::AllocateArray_entry(), |
| 2482 RawPcDescriptors::kOther, locs()); |
2481 ASSERT(locs()->out(0).reg() == kResultReg); | 2483 ASSERT(locs()->out(0).reg() == kResultReg); |
2482 } | 2484 } |
2483 | 2485 |
2484 | 2486 |
2485 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, | 2487 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, |
2486 bool opt) const { | 2488 bool opt) const { |
2487 const intptr_t kNumInputs = 1; | 2489 const intptr_t kNumInputs = 1; |
2488 const intptr_t kNumTemps = | 2490 const intptr_t kNumTemps = |
2489 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 3 : 0); | 2491 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 3 : 0); |
2490 | 2492 |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3120 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 3122 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
3121 if (Assembler::EmittingComments()) { | 3123 if (Assembler::EmittingComments()) { |
3122 __ Comment("slow path smi operation"); | 3124 __ Comment("slow path smi operation"); |
3123 } | 3125 } |
3124 __ Bind(entry_label()); | 3126 __ Bind(entry_label()); |
3125 LocationSummary* locs = instruction_->locs(); | 3127 LocationSummary* locs = instruction_->locs(); |
3126 Register result = locs->out(0).reg(); | 3128 Register result = locs->out(0).reg(); |
3127 locs->live_registers()->Remove(Location::RegisterLocation(result)); | 3129 locs->live_registers()->Remove(Location::RegisterLocation(result)); |
3128 | 3130 |
3129 compiler->SaveLiveRegisters(locs); | 3131 compiler->SaveLiveRegisters(locs); |
| 3132 if (instruction_->env() != NULL) { |
| 3133 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 3134 compiler->pending_deoptimization_env_ = env; |
| 3135 } |
3130 __ Push(locs->in(0).reg()); | 3136 __ Push(locs->in(0).reg()); |
3131 __ Push(locs->in(1).reg()); | 3137 __ Push(locs->in(1).reg()); |
3132 compiler->EmitMegamorphicInstanceCall( | 3138 compiler->EmitMegamorphicInstanceCall( |
3133 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), | 3139 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), |
3134 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), | 3140 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), |
3135 locs, try_index_, | 3141 locs, try_index_, |
3136 /* slow_path_argument_count = */ 2); | 3142 /* slow_path_argument_count = */ 2); |
3137 __ mov(result, Operand(R0)); | 3143 __ mov(result, Operand(R0)); |
3138 compiler->RestoreLiveRegisters(locs); | 3144 compiler->RestoreLiveRegisters(locs); |
3139 __ b(exit_label()); | 3145 __ b(exit_label()); |
| 3146 compiler->pending_deoptimization_env_ = NULL; |
3140 } | 3147 } |
3141 | 3148 |
3142 private: | 3149 private: |
3143 CheckedSmiOpInstr* instruction_; | 3150 CheckedSmiOpInstr* instruction_; |
3144 intptr_t try_index_; | 3151 intptr_t try_index_; |
3145 }; | 3152 }; |
3146 | 3153 |
3147 | 3154 |
3148 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, | 3155 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, |
3149 bool opt) const { | 3156 bool opt) const { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3254 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 3261 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
3255 if (Assembler::EmittingComments()) { | 3262 if (Assembler::EmittingComments()) { |
3256 __ Comment("slow path smi operation"); | 3263 __ Comment("slow path smi operation"); |
3257 } | 3264 } |
3258 __ Bind(entry_label()); | 3265 __ Bind(entry_label()); |
3259 LocationSummary* locs = instruction_->locs(); | 3266 LocationSummary* locs = instruction_->locs(); |
3260 Register result = merged_ ? locs->temp(0).reg() : locs->out(0).reg(); | 3267 Register result = merged_ ? locs->temp(0).reg() : locs->out(0).reg(); |
3261 locs->live_registers()->Remove(Location::RegisterLocation(result)); | 3268 locs->live_registers()->Remove(Location::RegisterLocation(result)); |
3262 | 3269 |
3263 compiler->SaveLiveRegisters(locs); | 3270 compiler->SaveLiveRegisters(locs); |
| 3271 if (instruction_->env() != NULL) { |
| 3272 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 3273 compiler->pending_deoptimization_env_ = env; |
| 3274 } |
3264 __ Push(locs->in(0).reg()); | 3275 __ Push(locs->in(0).reg()); |
3265 __ Push(locs->in(1).reg()); | 3276 __ Push(locs->in(1).reg()); |
3266 compiler->EmitMegamorphicInstanceCall( | 3277 compiler->EmitMegamorphicInstanceCall( |
3267 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), | 3278 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), |
3268 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), | 3279 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), |
3269 locs, try_index_, | 3280 locs, try_index_, |
3270 /* slow_path_argument_count = */ 2); | 3281 /* slow_path_argument_count = */ 2); |
3271 __ mov(result, Operand(R0)); | 3282 __ mov(result, Operand(R0)); |
3272 compiler->RestoreLiveRegisters(locs); | 3283 compiler->RestoreLiveRegisters(locs); |
| 3284 compiler->pending_deoptimization_env_ = NULL; |
3273 if (merged_) { | 3285 if (merged_) { |
3274 __ CompareObject(result, Bool::True()); | 3286 __ CompareObject(result, Bool::True()); |
3275 __ b( | 3287 __ b( |
3276 instruction_->is_negated() ? labels_.false_label : labels_.true_label, | 3288 instruction_->is_negated() ? labels_.false_label : labels_.true_label, |
3277 EQ); | 3289 EQ); |
3278 __ b(instruction_->is_negated() ? labels_.true_label | 3290 __ b(instruction_->is_negated() ? labels_.true_label |
3279 : labels_.false_label); | 3291 : labels_.false_label); |
3280 } else { | 3292 } else { |
3281 __ b(exit_label()); | 3293 __ b(exit_label()); |
3282 } | 3294 } |
(...skipping 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6392 public: | 6404 public: |
6393 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) | 6405 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) |
6394 : instruction_(instruction), try_index_(try_index) {} | 6406 : instruction_(instruction), try_index_(try_index) {} |
6395 | 6407 |
6396 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 6408 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
6397 if (Assembler::EmittingComments()) { | 6409 if (Assembler::EmittingComments()) { |
6398 __ Comment("slow path check bound operation"); | 6410 __ Comment("slow path check bound operation"); |
6399 } | 6411 } |
6400 __ Bind(entry_label()); | 6412 __ Bind(entry_label()); |
6401 LocationSummary* locs = instruction_->locs(); | 6413 LocationSummary* locs = instruction_->locs(); |
| 6414 compiler->SaveLiveRegisters(locs); |
6402 __ Push(locs->in(0).reg()); | 6415 __ Push(locs->in(0).reg()); |
6403 __ Push(locs->in(1).reg()); | 6416 __ Push(locs->in(1).reg()); |
6404 __ CallRuntime(kRangeErrorRuntimeEntry, 2); | 6417 __ CallRuntime(kRangeErrorRuntimeEntry, 2); |
6405 compiler->AddDescriptor( | 6418 compiler->AddDescriptor( |
6406 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), | 6419 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), |
6407 instruction_->deopt_id(), instruction_->token_pos(), try_index_); | 6420 instruction_->deopt_id(), instruction_->token_pos(), try_index_); |
6408 compiler->RecordSafepoint(locs, 2); | 6421 compiler->RecordSafepoint(locs, 2); |
| 6422 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 6423 compiler->EmitCatchEntryState(env, try_index_); |
6409 __ bkpt(0); | 6424 __ bkpt(0); |
6410 } | 6425 } |
6411 | 6426 |
6412 private: | 6427 private: |
6413 GenericCheckBoundInstr* instruction_; | 6428 GenericCheckBoundInstr* instruction_; |
6414 intptr_t try_index_; | 6429 intptr_t try_index_; |
6415 }; | 6430 }; |
6416 | 6431 |
6417 | 6432 |
6418 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6433 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7226 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), | 7241 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), |
7227 kGrowRegExpStackRuntimeEntry, 1, locs()); | 7242 kGrowRegExpStackRuntimeEntry, 1, locs()); |
7228 __ Drop(1); | 7243 __ Drop(1); |
7229 __ Pop(result); | 7244 __ Pop(result); |
7230 } | 7245 } |
7231 | 7246 |
7232 | 7247 |
7233 } // namespace dart | 7248 } // namespace dart |
7234 | 7249 |
7235 #endif // defined TARGET_ARCH_ARM | 7250 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |