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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 } | 1162 } |
1163 if (FLAG_stacktrace_filter != NULL && | 1163 if (FLAG_stacktrace_filter != NULL && |
1164 strstr(function_name, FLAG_stacktrace_filter) != NULL) { | 1164 strstr(function_name, FLAG_stacktrace_filter) != NULL) { |
1165 OS::PrintErr("*** Computing stacktrace (%s)\n", | 1165 OS::PrintErr("*** Computing stacktrace (%s)\n", |
1166 function.ToFullyQualifiedCString()); | 1166 function.ToFullyQualifiedCString()); |
1167 do_stacktrace = true; | 1167 do_stacktrace = true; |
1168 } | 1168 } |
1169 } | 1169 } |
1170 if (do_deopt) { | 1170 if (do_deopt) { |
1171 // TODO(turnidge): Consider using DeoptimizeAt instead. | 1171 // TODO(turnidge): Consider using DeoptimizeAt instead. |
1172 DeoptimizeAll(); | 1172 DeoptimizeFunctionsOnStack(); |
1173 } | 1173 } |
1174 if (do_stacktrace) { | 1174 if (do_stacktrace) { |
1175 String& var_name = String::Handle(); | 1175 String& var_name = String::Handle(); |
1176 Instance& var_value = Instance::Handle(); | 1176 Instance& var_value = Instance::Handle(); |
1177 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); | 1177 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); |
1178 intptr_t num_frames = stack->Length(); | 1178 intptr_t num_frames = stack->Length(); |
1179 for (intptr_t i = 0; i < num_frames; i++) { | 1179 for (intptr_t i = 0; i < num_frames; i++) { |
1180 ActivationFrame* frame = stack->FrameAt(i); | 1180 ActivationFrame* frame = stack->FrameAt(i); |
1181 const int num_vars = frame->NumLocalVariables(); | 1181 const int num_vars = frame->NumLocalVariables(); |
1182 intptr_t unused; | 1182 intptr_t unused; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 OS::PrintErr("InsertCallAt: %" Px " to %" Px " for %s\n", pc, | 1461 OS::PrintErr("InsertCallAt: %" Px " to %" Px " for %s\n", pc, |
1462 lazy_deopt_jump, name.ToCString()); | 1462 lazy_deopt_jump, name.ToCString()); |
1463 } | 1463 } |
1464 // Mark code as dead (do not GC its embedded objects). | 1464 // Mark code as dead (do not GC its embedded objects). |
1465 optimized_code.set_is_alive(false); | 1465 optimized_code.set_is_alive(false); |
1466 } | 1466 } |
1467 | 1467 |
1468 | 1468 |
1469 // Currently checks only that all optimized frames have kDeoptIndex | 1469 // Currently checks only that all optimized frames have kDeoptIndex |
1470 // and unoptimized code has the kDeoptAfter. | 1470 // and unoptimized code has the kDeoptAfter. |
1471 void DeoptimizeAll() { | 1471 void DeoptimizeFunctionsOnStack() { |
1472 DartFrameIterator iterator; | 1472 DartFrameIterator iterator; |
1473 StackFrame* frame = iterator.NextFrame(); | 1473 StackFrame* frame = iterator.NextFrame(); |
1474 Code& optimized_code = Code::Handle(); | 1474 Code& optimized_code = Code::Handle(); |
1475 while (frame != NULL) { | 1475 while (frame != NULL) { |
1476 optimized_code = frame->LookupDartCode(); | 1476 optimized_code = frame->LookupDartCode(); |
1477 if (optimized_code.is_optimized()) { | 1477 if (optimized_code.is_optimized()) { |
1478 DeoptimizeAt(optimized_code, frame->pc()); | 1478 DeoptimizeAt(optimized_code, frame->pc()); |
1479 } | 1479 } |
1480 frame = iterator.NextFrame(); | 1480 frame = iterator.NextFrame(); |
1481 } | 1481 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1673 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1674 const TypedData& new_data = | 1674 const TypedData& new_data = |
1675 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1675 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1676 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1676 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1677 typed_data_cell.SetAt(0, new_data); | 1677 typed_data_cell.SetAt(0, new_data); |
1678 arguments.SetReturn(new_data); | 1678 arguments.SetReturn(new_data); |
1679 } | 1679 } |
1680 | 1680 |
1681 | 1681 |
1682 } // namespace dart | 1682 } // namespace dart |
OLD | NEW |