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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 // Preserve PP of caller. | 995 // Preserve PP of caller. |
996 __ mov(T1, PP); | 996 __ mov(T1, PP); |
997 // Temporarily setup pool pointer for this dart function. | 997 // Temporarily setup pool pointer for this dart function. |
998 __ lw(PP, Address(T2, -object_pool_pc_dist)); | 998 __ lw(PP, Address(T2, -object_pool_pc_dist)); |
999 // Load function object from object pool. | 999 // Load function object from object pool. |
1000 __ LoadObject(function_reg, function); // Uses PP. | 1000 __ LoadObject(function_reg, function); // Uses PP. |
1001 // Restore PP of caller. | 1001 // Restore PP of caller. |
1002 __ mov(PP, T1); | 1002 __ mov(PP, T1); |
1003 | 1003 |
1004 // Patch point is after the eventually inlined function object. | 1004 // Patch point is after the eventually inlined function object. |
1005 AddCurrentDescriptor(PcDescriptors::kEntryPatch, | 1005 entry_patch_pc_offset_ = assembler()->CodeSize(); |
1006 Isolate::kNoDeoptId, | 1006 |
1007 0); // No token position. | |
1008 intptr_t threshold = FLAG_optimization_counter_threshold; | 1007 intptr_t threshold = FLAG_optimization_counter_threshold; |
1009 __ lw(T1, FieldAddress(function_reg, Function::usage_counter_offset())); | 1008 __ lw(T1, FieldAddress(function_reg, Function::usage_counter_offset())); |
1010 if (is_optimizing()) { | 1009 if (is_optimizing()) { |
1011 // Reoptimization of an optimized function is triggered by counting in | 1010 // Reoptimization of an optimized function is triggered by counting in |
1012 // IC stubs, but not at the entry of the function. | 1011 // IC stubs, but not at the entry of the function. |
1013 threshold = FLAG_reoptimization_counter_threshold; | 1012 threshold = FLAG_reoptimization_counter_threshold; |
1014 } else { | 1013 } else { |
1015 __ addiu(T1, T1, Immediate(1)); | 1014 __ addiu(T1, T1, Immediate(1)); |
1016 __ sw(T1, FieldAddress(function_reg, Function::usage_counter_offset())); | 1015 __ sw(T1, FieldAddress(function_reg, Function::usage_counter_offset())); |
1017 } | 1016 } |
1018 | 1017 |
1019 // Skip Branch if T1 is less than the threshold. | 1018 // Skip Branch if T1 is less than the threshold. |
1020 Label dont_branch; | 1019 Label dont_branch; |
1021 __ BranchSignedLess(T1, threshold, &dont_branch); | 1020 __ BranchSignedLess(T1, threshold, &dont_branch); |
1022 | 1021 |
1023 ASSERT(function_reg == T0); | 1022 ASSERT(function_reg == T0); |
1024 __ Branch(&StubCode::OptimizeFunctionLabel()); | 1023 __ Branch(&StubCode::OptimizeFunctionLabel()); |
1025 | 1024 |
1026 __ Bind(&dont_branch); | 1025 __ Bind(&dont_branch); |
1027 | 1026 |
1028 } else if (!flow_graph().IsCompiledForOsr()) { | 1027 } else if (!flow_graph().IsCompiledForOsr()) { |
1029 AddCurrentDescriptor(PcDescriptors::kEntryPatch, | 1028 entry_patch_pc_offset_ = assembler()->CodeSize(); |
1030 Isolate::kNoDeoptId, | |
1031 0); // No token position. | |
1032 } | 1029 } |
1033 __ Comment("Enter frame"); | 1030 __ Comment("Enter frame"); |
1034 if (flow_graph().IsCompiledForOsr()) { | 1031 if (flow_graph().IsCompiledForOsr()) { |
1035 intptr_t extra_slots = StackSize() | 1032 intptr_t extra_slots = StackSize() |
1036 - flow_graph().num_stack_locals() | 1033 - flow_graph().num_stack_locals() |
1037 - flow_graph().num_copied_params(); | 1034 - flow_graph().num_copied_params(); |
1038 ASSERT(extra_slots >= 0); | 1035 ASSERT(extra_slots >= 0); |
1039 __ EnterOsrFrame(extra_slots * kWordSize); | 1036 __ EnterOsrFrame(extra_slots * kWordSize); |
1040 } else { | 1037 } else { |
1041 ASSERT(StackSize() >= 0); | 1038 ASSERT(StackSize() >= 0); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize)); | 1123 __ sw(TMP, Address(FP, (slot_base - i) * kWordSize)); |
1127 } | 1124 } |
1128 } | 1125 } |
1129 | 1126 |
1130 VisitBlocks(); | 1127 VisitBlocks(); |
1131 | 1128 |
1132 __ break_(0); | 1129 __ break_(0); |
1133 GenerateDeferredCode(); | 1130 GenerateDeferredCode(); |
1134 // Emit function patching code. This will be swapped with the first 5 bytes | 1131 // Emit function patching code. This will be swapped with the first 5 bytes |
1135 // at entry point. | 1132 // at entry point. |
1136 AddCurrentDescriptor(PcDescriptors::kPatchCode, | 1133 patch_code_pc_offset_ = assembler()->CodeSize(); |
1137 Isolate::kNoDeoptId, | |
1138 0); // No token position. | |
1139 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); | 1134 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); |
1140 AddCurrentDescriptor(PcDescriptors::kLazyDeoptJump, | 1135 |
1141 Isolate::kNoDeoptId, | 1136 if (is_optimizing()) { |
1142 0); // No token position. | 1137 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
1143 __ Branch(&StubCode::DeoptimizeLazyLabel()); | 1138 __ Branch(&StubCode::DeoptimizeLazyLabel()); |
| 1139 } |
1144 } | 1140 } |
1145 | 1141 |
1146 | 1142 |
1147 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, | 1143 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, |
1148 const ExternalLabel* label, | 1144 const ExternalLabel* label, |
1149 PcDescriptors::Kind kind, | 1145 PcDescriptors::Kind kind, |
1150 LocationSummary* locs) { | 1146 LocationSummary* locs) { |
1151 __ BranchLinkPatchable(label); | 1147 __ BranchLinkPatchable(label); |
1152 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 1148 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); |
1153 RecordSafepoint(locs); | 1149 RecordSafepoint(locs); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 __ AddImmediate(SP, kDoubleSize); | 1815 __ AddImmediate(SP, kDoubleSize); |
1820 } | 1816 } |
1821 | 1817 |
1822 | 1818 |
1823 #undef __ | 1819 #undef __ |
1824 | 1820 |
1825 | 1821 |
1826 } // namespace dart | 1822 } // namespace dart |
1827 | 1823 |
1828 #endif // defined TARGET_ARCH_MIPS | 1824 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |