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/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 3820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3831 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3831 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3832 if (!compiler->CanFallThroughTo(normal_entry())) { | 3832 if (!compiler->CanFallThroughTo(normal_entry())) { |
3833 __ b(compiler->GetJumpLabel(normal_entry())); | 3833 __ b(compiler->GetJumpLabel(normal_entry())); |
3834 } | 3834 } |
3835 } | 3835 } |
3836 | 3836 |
3837 | 3837 |
3838 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3838 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3839 __ Bind(compiler->GetJumpLabel(this)); | 3839 __ Bind(compiler->GetJumpLabel(this)); |
3840 if (!compiler->is_optimizing()) { | 3840 if (!compiler->is_optimizing()) { |
3841 compiler->EmitEdgeCounter(); | |
3842 // On MIPS the deoptimization descriptor points after the edge counter | |
3843 // code so that we can reuse the same pattern matching code as at call | |
3844 // sites, which matches backwards from the end of the pattern. | |
3841 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 3845 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
3842 deopt_id_, | 3846 deopt_id_, |
3843 Scanner::kDummyTokenIndex); | 3847 Scanner::kDummyTokenIndex); |
3844 // Add an edge counter. | |
3845 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); | |
3846 counter.SetAt(0, Smi::Handle(Smi::New(0))); | |
3847 Label done; | |
3848 __ Comment("Edge counter"); | |
3849 __ LoadObject(T0, counter); | |
3850 __ lw(T1, FieldAddress(T0, Array::element_offset(0))); | |
3851 __ AddImmediateDetectOverflow(T1, T1, Smi::RawValue(1), CMPRES, T2); | |
3852 __ bgez(CMPRES, &done); | |
3853 __ delay_slot()->sw(T1, FieldAddress(T0, Array::element_offset(0))); | |
3854 __ LoadImmediate(TMP1, Smi::RawValue(Smi::kMaxValue)); | |
3855 __ sw(TMP1, FieldAddress(T0, Array::element_offset(0))); // If overflow. | |
3856 __ Bind(&done); | |
3857 } | 3848 } |
3858 if (HasParallelMove()) { | 3849 if (HasParallelMove()) { |
3859 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 3850 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
3860 } | 3851 } |
3861 } | 3852 } |
3862 | 3853 |
3863 | 3854 |
3864 LocationSummary* GotoInstr::MakeLocationSummary() const { | 3855 LocationSummary* GotoInstr::MakeLocationSummary() const { |
3865 return new LocationSummary(0, 0, LocationSummary::kNoCall); | 3856 return new LocationSummary(0, 0, LocationSummary::kNoCall); |
3866 } | 3857 } |
3867 | 3858 |
3868 | 3859 |
3869 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3860 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3870 __ TraceSimMsg("GotoInstr"); | 3861 __ TraceSimMsg("GotoInstr"); |
3862 if (!compiler->is_optimizing()) { | |
3863 compiler->EmitEdgeCounter(); | |
3864 // Add a deoptimization descriptor for deoptimizing instructions that | |
3865 // may be inserted before this instruction. On MIPS this descriptor | |
3866 // points after the edge counter code so that we can reuse the same | |
3867 // pattern matching code as at call sites, which matches backwards from | |
3868 // the end of the pattern. | |
3869 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | |
3870 GetDeoptId(), | |
3871 0); // No token position. | |
Florian Schneider
2013/10/01 10:10:02
Use Scanner::kDummyTokenIndex?
| |
3872 } | |
3871 if (HasParallelMove()) { | 3873 if (HasParallelMove()) { |
3872 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 3874 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
3873 } | 3875 } |
3874 | 3876 |
3875 // We can fall through if the successor is the next block in the list. | 3877 // We can fall through if the successor is the next block in the list. |
3876 // Otherwise, we need a jump. | 3878 // Otherwise, we need a jump. |
3877 if (!compiler->CanFallThroughTo(successor())) { | 3879 if (!compiler->CanFallThroughTo(successor())) { |
3878 __ b(compiler->GetJumpLabel(successor())); | 3880 __ b(compiler->GetJumpLabel(successor())); |
3879 } | 3881 } |
3880 } | 3882 } |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4113 compiler->GenerateCall(token_pos(), | 4115 compiler->GenerateCall(token_pos(), |
4114 &label, | 4116 &label, |
4115 PcDescriptors::kOther, | 4117 PcDescriptors::kOther, |
4116 locs()); | 4118 locs()); |
4117 __ Drop(2); // Discard type arguments and receiver. | 4119 __ Drop(2); // Discard type arguments and receiver. |
4118 } | 4120 } |
4119 | 4121 |
4120 } // namespace dart | 4122 } // namespace dart |
4121 | 4123 |
4122 #endif // defined TARGET_ARCH_MIPS | 4124 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |