Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.cc

Issue 575443002: Refactor generating lazy deoptimization descriptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 __ Branch(&stub_code->DeoptimizeLazyLabel()); 1096 __ Branch(&stub_code->DeoptimizeLazyLabel());
1097 } 1097 }
1098 } 1098 }
1099 1099
1100 1100
1101 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, 1101 void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
1102 const ExternalLabel* label, 1102 const ExternalLabel* label,
1103 RawPcDescriptors::Kind kind, 1103 RawPcDescriptors::Kind kind,
1104 LocationSummary* locs) { 1104 LocationSummary* locs) {
1105 __ BranchLinkPatchable(label); 1105 __ BranchLinkPatchable(label);
1106 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); 1106 RecordCallInfo(token_pos, kind, Isolate::kNoDeoptId, locs, 0);
1107 RecordSafepoint(locs);
1108 } 1107 }
1109 1108
1110 1109
1111 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, 1110 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
1112 intptr_t token_pos, 1111 intptr_t token_pos,
1113 const ExternalLabel* label, 1112 const ExternalLabel* label,
1114 RawPcDescriptors::Kind kind, 1113 RawPcDescriptors::Kind kind,
1115 LocationSummary* locs) { 1114 LocationSummary* locs) {
1116 __ BranchLinkPatchable(label); 1115 __ BranchLinkPatchable(label);
1117 AddCurrentDescriptor(kind, deopt_id, token_pos); 1116 RecordCallInfo(token_pos, kind, deopt_id, locs, locs->input_count());
1118 RecordSafepoint(locs);
1119 // Marks either the continuation point in unoptimized code or the
1120 // deoptimization point in optimized code, after call.
1121 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
1122 if (is_optimizing()) {
1123 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1124 } else {
1125 // Add deoptimization continuation point after the call and before the
1126 // arguments are removed.
1127 AddCurrentDescriptor(RawPcDescriptors::kDeopt,
1128 deopt_id_after, token_pos);
1129 }
1130 } 1117 }
1131 1118
1132 1119
1133 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, 1120 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos,
1134 intptr_t deopt_id, 1121 intptr_t deopt_id,
1135 const RuntimeEntry& entry, 1122 const RuntimeEntry& entry,
1136 intptr_t argument_count, 1123 intptr_t argument_count,
1137 LocationSummary* locs) { 1124 LocationSummary* locs) {
1138 __ CallRuntime(entry, argument_count); 1125 __ CallRuntime(entry, argument_count);
1139 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); 1126 RecordCallInfo(token_pos, RawPcDescriptors::kOther, deopt_id, locs, 0);
Vyacheslav Egorov (Google) 2014/09/15 14:35:56 this seems fragile that some of the call instructi
Florian Schneider 2014/09/15 15:46:31 I agree - the problem is that deoptimization envir
1140 RecordSafepoint(locs);
1141 if (deopt_id != Isolate::kNoDeoptId) {
1142 // Marks either the continuation point in unoptimized code or the
1143 // deoptimization point in optimized code, after call.
1144 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
1145 if (is_optimizing()) {
1146 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1147 } else {
1148 // Add deoptimization continuation point after the call and before the
1149 // arguments are removed.
1150 AddCurrentDescriptor(RawPcDescriptors::kDeopt,
1151 deopt_id_after,
1152 token_pos);
1153 }
1154 }
1155 } 1127 }
1156 1128
1157 1129
1158 void FlowGraphCompiler::EmitEdgeCounter() { 1130 void FlowGraphCompiler::EmitEdgeCounter() {
1159 // We do not check for overflow when incrementing the edge counter. The 1131 // We do not check for overflow when incrementing the edge counter. The
1160 // function should normally be optimized long before the counter can 1132 // function should normally be optimized long before the counter can
1161 // overflow; and though we do not reset the counters when we optimize or 1133 // overflow; and though we do not reset the counters when we optimize or
1162 // deoptimize, there is a bound on the number of 1134 // deoptimize, there is a bound on the number of
1163 // optimization/deoptimization cycles we will attempt. 1135 // optimization/deoptimization cycles we will attempt.
1164 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld)); 1136 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 // proper target for the given name and arguments descriptor. If the 1236 // proper target for the given name and arguments descriptor. If the
1265 // illegal class id was found, the target is a cache miss handler that can 1237 // illegal class id was found, the target is a cache miss handler that can
1266 // be invoked as a normal Dart function. 1238 // be invoked as a normal Dart function.
1267 __ add(IP, R2, Operand(R3, LSL, 2)); 1239 __ add(IP, R2, Operand(R3, LSL, 2));
1268 __ ldr(R0, FieldAddress(IP, base + kWordSize)); 1240 __ ldr(R0, FieldAddress(IP, base + kWordSize));
1269 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); 1241 __ ldr(R1, FieldAddress(R0, Function::instructions_offset()));
1270 __ LoadObject(R5, ic_data); 1242 __ LoadObject(R5, ic_data);
1271 __ LoadObject(R4, arguments_descriptor); 1243 __ LoadObject(R4, arguments_descriptor);
1272 __ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag); 1244 __ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag);
1273 __ blx(R1); 1245 __ blx(R1);
1274 AddCurrentDescriptor(RawPcDescriptors::kOther, 1246 RecordCallInfo(
1275 Isolate::kNoDeoptId, token_pos); 1247 token_pos, RawPcDescriptors::kOther, deopt_id, locs, locs->input_count());
1276 RecordSafepoint(locs);
1277 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
1278 __ Drop(argument_count); 1248 __ Drop(argument_count);
1279 } 1249 }
1280 1250
1281 1251
1282 void FlowGraphCompiler::EmitUnoptimizedStaticCall( 1252 void FlowGraphCompiler::EmitUnoptimizedStaticCall(
1283 intptr_t argument_count, 1253 intptr_t argument_count,
1284 intptr_t deopt_id, 1254 intptr_t deopt_id,
1285 intptr_t token_pos, 1255 intptr_t token_pos,
1286 LocationSummary* locs, 1256 LocationSummary* locs,
1287 const ICData& ic_data) { 1257 const ICData& ic_data) {
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 DRegister dreg = EvenDRegisterOf(reg); 1772 DRegister dreg = EvenDRegisterOf(reg);
1803 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1773 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1804 } 1774 }
1805 1775
1806 1776
1807 #undef __ 1777 #undef __
1808 1778
1809 } // namespace dart 1779 } // namespace dart
1810 1780
1811 #endif // defined TARGET_ARCH_ARM 1781 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698