Chromium Code Reviews| 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/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 53 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
| 54 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); | 54 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); |
| 55 | 55 |
| 56 DECLARE_FLAG(int, deoptimization_counter_threshold); | 56 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 57 DECLARE_FLAG(bool, enable_type_checks); | 57 DECLARE_FLAG(bool, enable_type_checks); |
| 58 DECLARE_FLAG(bool, report_usage_count); | 58 DECLARE_FLAG(bool, report_usage_count); |
| 59 | 59 |
| 60 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); | 60 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
| 61 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 61 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
| 62 | 62 |
| 63 DECLARE_FLAG(charp, deoptimize_filter); | |
| 64 | |
| 63 | 65 |
| 64 DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) { | 66 DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) { |
| 65 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); | 67 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); |
| 66 const String& function_name = String::Handle(function.name()); | 68 const String& function_name = String::Handle(function.name()); |
| 67 const String& class_name = | 69 const String& class_name = |
| 68 String::Handle(Class::Handle(function.Owner()).Name()); | 70 String::Handle(Class::Handle(function.Owner()).Name()); |
| 69 OS::PrintErr("> Entering '%s.%s'\n", | 71 OS::PrintErr("> Entering '%s.%s'\n", |
| 70 class_name.ToCString(), function_name.ToCString()); | 72 class_name.ToCString(), function_name.ToCString()); |
| 71 } | 73 } |
| 72 | 74 |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 if (optimized_code.raw() != original_code.raw()) { | 1218 if (optimized_code.raw() != original_code.raw()) { |
| 1217 // The OSR code does not work for calling the function, so restore the | 1219 // The OSR code does not work for calling the function, so restore the |
| 1218 // unoptimized code. Patch the stack frame to return into the OSR | 1220 // unoptimized code. Patch the stack frame to return into the OSR |
| 1219 // code. | 1221 // code. |
| 1220 uword optimized_entry = | 1222 uword optimized_entry = |
| 1221 Instructions::Handle(optimized_code.instructions()).EntryPoint(); | 1223 Instructions::Handle(optimized_code.instructions()).EntryPoint(); |
| 1222 function.AttachCode(original_code); | 1224 function.AttachCode(original_code); |
| 1223 frame->set_pc(optimized_entry); | 1225 frame->set_pc(optimized_entry); |
| 1224 } | 1226 } |
| 1225 } | 1227 } |
| 1228 | |
| 1229 if (FLAG_deoptimize_filter != NULL) { | |
| 1230 DartFrameIterator iterator; | |
| 1231 StackFrame* frame = iterator.NextFrame(); | |
| 1232 ASSERT(frame != NULL); | |
| 1233 const Code& code = Code::ZoneHandle(frame->LookupDartCode()); | |
|
srdjan
2014/04/04 17:55:23
'code' can be Code::Handle as code does not escape
| |
| 1234 ASSERT(!code.IsNull()); | |
| 1235 if (code.is_optimized()) { | |
| 1236 const Function& function = Function::Handle(code.function()); | |
| 1237 ASSERT(!function.IsNull()); | |
| 1238 if (strstr(function.ToFullyQualifiedCString(), | |
| 1239 FLAG_deoptimize_filter) != NULL) { | |
| 1240 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | |
| 1241 OS::PrintErr("*** Forcing deoptimization (%s)\n", | |
| 1242 function.ToFullyQualifiedCString()); | |
| 1243 DeoptimizeAll(); | |
| 1244 } | |
| 1245 } | |
| 1246 } | |
| 1247 } | |
| 1226 } | 1248 } |
| 1227 | 1249 |
| 1228 | 1250 |
| 1229 DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { | 1251 DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { |
| 1230 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(0)); | 1252 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(0)); |
| 1231 const Function& function = Function::CheckedHandle(arguments.ArgAt(1)); | 1253 const Function& function = Function::CheckedHandle(arguments.ArgAt(1)); |
| 1232 DartFrameIterator iterator; | 1254 DartFrameIterator iterator; |
| 1233 StackFrame* frame = iterator.NextFrame(); | 1255 StackFrame* frame = iterator.NextFrame(); |
| 1234 ASSERT(frame != NULL); | 1256 ASSERT(frame != NULL); |
| 1235 OS::PrintErr("IC call @%#" Px ": ICData: %p cnt:%" Pd " nchecks: %" Pd | 1257 OS::PrintErr("IC call @%#" Px ": ICData: %p cnt:%" Pd " nchecks: %" Pd |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1548 // of the given value. | 1570 // of the given value. |
| 1549 // Arg0: Field object; | 1571 // Arg0: Field object; |
| 1550 // Arg1: Value that is being stored. | 1572 // Arg1: Value that is being stored. |
| 1551 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1573 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1552 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1574 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1553 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1575 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1554 field.UpdateGuardedCidAndLength(value); | 1576 field.UpdateGuardedCidAndLength(value); |
| 1555 } | 1577 } |
| 1556 | 1578 |
| 1557 } // namespace dart | 1579 } // namespace dart |
| OLD | NEW |