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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 4426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4437 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4437 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4438 if (!compiler->CanFallThroughTo(normal_entry())) { | 4438 if (!compiler->CanFallThroughTo(normal_entry())) { |
4439 __ b(compiler->GetJumpLabel(normal_entry())); | 4439 __ b(compiler->GetJumpLabel(normal_entry())); |
4440 } | 4440 } |
4441 } | 4441 } |
4442 | 4442 |
4443 | 4443 |
4444 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4444 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4445 __ Bind(compiler->GetJumpLabel(this)); | 4445 __ Bind(compiler->GetJumpLabel(this)); |
4446 if (!compiler->is_optimizing()) { | 4446 if (!compiler->is_optimizing()) { |
| 4447 compiler->EmitEdgeCounter(); |
| 4448 // Add an edge counter. |
| 4449 // On ARM the deoptimization descriptor points after the edge counter |
| 4450 // code so that we can reuse the same pattern matching code as at call |
| 4451 // sites, which matches backwards from the end of the pattern. |
4447 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 4452 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
4448 deopt_id_, | 4453 deopt_id_, |
4449 Scanner::kDummyTokenIndex); | 4454 Scanner::kDummyTokenIndex); |
4450 // Add an edge counter. | |
4451 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | |
4452 counter.SetAt(0, Smi::Handle(Smi::New(0))); | |
4453 __ Comment("Edge counter"); | |
4454 __ LoadObject(R0, counter); | |
4455 __ ldr(IP, FieldAddress(R0, Array::element_offset(0))); | |
4456 __ adds(IP, IP, ShifterOperand(Smi::RawValue(1))); | |
4457 __ LoadImmediate(IP, Smi::RawValue(Smi::kMaxValue), VS); // If overflow. | |
4458 __ str(IP, FieldAddress(R0, Array::element_offset(0))); | |
4459 } | 4455 } |
4460 if (HasParallelMove()) { | 4456 if (HasParallelMove()) { |
4461 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 4457 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
4462 } | 4458 } |
4463 } | 4459 } |
4464 | 4460 |
4465 | 4461 |
4466 LocationSummary* GotoInstr::MakeLocationSummary() const { | 4462 LocationSummary* GotoInstr::MakeLocationSummary() const { |
4467 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 4463 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
4468 } | 4464 } |
4469 | 4465 |
4470 | 4466 |
4471 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4467 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4468 if (!compiler->is_optimizing()) { |
| 4469 compiler->EmitEdgeCounter(); |
| 4470 // Add a deoptimization descriptor for deoptimizing instructions that |
| 4471 // may be inserted before this instruction. On ARM this descriptor |
| 4472 // points after the edge counter code so that we can reuse the same |
| 4473 // pattern matching code as at call sites, which matches backwards from |
| 4474 // the end of the pattern. |
| 4475 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 4476 GetDeoptId(), |
| 4477 0); // No token position. |
| 4478 } |
4472 if (HasParallelMove()) { | 4479 if (HasParallelMove()) { |
4473 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 4480 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
4474 } | 4481 } |
4475 | 4482 |
4476 // We can fall through if the successor is the next block in the list. | 4483 // We can fall through if the successor is the next block in the list. |
4477 // Otherwise, we need a jump. | 4484 // Otherwise, we need a jump. |
4478 if (!compiler->CanFallThroughTo(successor())) { | 4485 if (!compiler->CanFallThroughTo(successor())) { |
4479 __ b(compiler->GetJumpLabel(successor())); | 4486 __ b(compiler->GetJumpLabel(successor())); |
4480 } | 4487 } |
4481 } | 4488 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4678 compiler->GenerateCall(token_pos(), | 4685 compiler->GenerateCall(token_pos(), |
4679 &label, | 4686 &label, |
4680 PcDescriptors::kOther, | 4687 PcDescriptors::kOther, |
4681 locs()); | 4688 locs()); |
4682 __ Drop(2); // Discard type arguments and receiver. | 4689 __ Drop(2); // Discard type arguments and receiver. |
4683 } | 4690 } |
4684 | 4691 |
4685 } // namespace dart | 4692 } // namespace dart |
4686 | 4693 |
4687 #endif // defined TARGET_ARCH_ARM | 4694 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |