OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.h" |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 return; | 1292 return; |
1293 } else { | 1293 } else { |
1294 // TODO(turnidge): Unwind the stack. | 1294 // TODO(turnidge): Unwind the stack. |
1295 UNIMPLEMENTED(); | 1295 UNIMPLEMENTED(); |
1296 } | 1296 } |
1297 } | 1297 } |
1298 } | 1298 } |
1299 } | 1299 } |
1300 | 1300 |
1301 | 1301 |
1302 static void PrintCaller(const char* msg) { | |
1303 DartFrameIterator iterator; | |
1304 StackFrame* top_frame = iterator.NextFrame(); | |
1305 ASSERT(top_frame != NULL); | |
1306 const Function& top_function = Function::Handle( | |
1307 top_frame->LookupDartFunction()); | |
1308 OS::PrintErr("Failed: '%s' %s @ %#"Px"\n", | |
1309 msg, top_function.ToFullyQualifiedCString(), top_frame->pc()); | |
1310 StackFrame* caller_frame = iterator.NextFrame(); | |
1311 if (caller_frame != NULL) { | |
1312 const Function& caller_function = Function::Handle( | |
1313 caller_frame->LookupDartFunction()); | |
1314 const Code& code = Code::Handle(caller_frame->LookupDartCode()); | |
1315 OS::PrintErr(" -> caller: %s (%s)\n", | |
1316 caller_function.ToFullyQualifiedCString(), | |
1317 code.is_optimized() ? "optimized" : "unoptimized"); | |
1318 } | |
1319 } | |
1320 | |
1321 | |
1322 DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { | 1302 DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { |
1323 ASSERT(arguments.ArgCount() == | 1303 ASSERT(arguments.ArgCount() == |
1324 kTraceICCallRuntimeEntry.argument_count()); | 1304 kTraceICCallRuntimeEntry.argument_count()); |
1325 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(0)); | 1305 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(0)); |
1326 const Function& function = Function::CheckedHandle(arguments.ArgAt(1)); | 1306 const Function& function = Function::CheckedHandle(arguments.ArgAt(1)); |
1327 DartFrameIterator iterator; | 1307 DartFrameIterator iterator; |
1328 StackFrame* frame = iterator.NextFrame(); | 1308 StackFrame* frame = iterator.NextFrame(); |
1329 ASSERT(frame != NULL); | 1309 ASSERT(frame != NULL); |
1330 OS::PrintErr("IC call @%#"Px": ICData: %p cnt:%"Pd" nchecks: %"Pd" %s %s\n", | 1310 OS::PrintErr("IC call @%#"Px": ICData: %p cnt:%"Pd" nchecks: %"Pd" %s %s\n", |
1331 frame->pc(), | 1311 frame->pc(), |
(...skipping 17 matching lines...) Expand all Loading... |
1349 if (isolate->debugger()->HasBreakpoint(function)) { | 1329 if (isolate->debugger()->HasBreakpoint(function)) { |
1350 // We cannot set breakpoints in optimized code, so do not optimize | 1330 // We cannot set breakpoints in optimized code, so do not optimize |
1351 // the function. | 1331 // the function. |
1352 function.set_usage_counter(0); | 1332 function.set_usage_counter(0); |
1353 arguments.SetReturn(Code::Handle(function.CurrentCode())); | 1333 arguments.SetReturn(Code::Handle(function.CurrentCode())); |
1354 return; | 1334 return; |
1355 } | 1335 } |
1356 if (function.deoptimization_counter() >= | 1336 if (function.deoptimization_counter() >= |
1357 FLAG_deoptimization_counter_threshold) { | 1337 FLAG_deoptimization_counter_threshold) { |
1358 if (FLAG_trace_failed_optimization_attempts) { | 1338 if (FLAG_trace_failed_optimization_attempts) { |
1359 PrintCaller("Too Many Deoptimizations"); | 1339 OS::PrintErr("Too Many Deoptimizations: %s\n", |
| 1340 function.ToFullyQualifiedCString()); |
1360 } | 1341 } |
1361 // TODO(srdjan): Investigate excessive deoptimization. | 1342 // TODO(srdjan): Investigate excessive deoptimization. |
1362 function.set_usage_counter(kLowInvocationCount); | 1343 function.set_usage_counter(kLowInvocationCount); |
1363 arguments.SetReturn(Code::Handle(function.CurrentCode())); | 1344 arguments.SetReturn(Code::Handle(function.CurrentCode())); |
1364 return; | 1345 return; |
1365 } | 1346 } |
1366 if ((FLAG_optimization_filter != NULL) && | 1347 if ((FLAG_optimization_filter != NULL) && |
1367 (strstr(function.ToFullyQualifiedCString(), | 1348 (strstr(function.ToFullyQualifiedCString(), |
1368 FLAG_optimization_filter) == NULL)) { | 1349 FLAG_optimization_filter) == NULL)) { |
1369 function.set_usage_counter(kLowInvocationCount); | 1350 function.set_usage_counter(kLowInvocationCount); |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 return; | 1775 return; |
1795 } | 1776 } |
1796 HeapTrace* heap_trace = Isolate::Current()->heap()->trace(); | 1777 HeapTrace* heap_trace = Isolate::Current()->heap()->trace(); |
1797 heap_trace->TraceStoreIntoObject(RawObject::ToAddr(object), | 1778 heap_trace->TraceStoreIntoObject(RawObject::ToAddr(object), |
1798 field_addr, | 1779 field_addr, |
1799 RawObject::ToAddr(value)); | 1780 RawObject::ToAddr(value)); |
1800 } | 1781 } |
1801 END_LEAF_RUNTIME_ENTRY | 1782 END_LEAF_RUNTIME_ENTRY |
1802 | 1783 |
1803 } // namespace dart | 1784 } // namespace dart |
OLD | NEW |