| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 50 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| 51 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, | 51 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, |
| 52 "Trace IC miss in optimized code"); | 52 "Trace IC miss in optimized code"); |
| 53 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, | 53 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, |
| 54 "Trace IC calls in optimized code."); | 54 "Trace IC calls in optimized code."); |
| 55 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 55 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
| 56 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 56 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
| 57 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); | 57 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); |
| 58 | 58 |
| 59 DECLARE_FLAG(int, deoptimization_counter_threshold); | 59 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 60 DECLARE_FLAG(bool, trace_compiler); |
| 60 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 61 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
| 61 | 62 |
| 62 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); | 63 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
| 63 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 64 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
| 64 | 65 |
| 65 DEFINE_FLAG(int, stacktrace_every, 0, | 66 DEFINE_FLAG(int, stacktrace_every, 0, |
| 66 "Compute debugger stacktrace on every N stack overflow checks"); | 67 "Compute debugger stacktrace on every N stack overflow checks"); |
| 67 DEFINE_FLAG(charp, stacktrace_filter, NULL, | 68 DEFINE_FLAG(charp, stacktrace_filter, NULL, |
| 68 "Compute stacktrace in named function on stack overflow checks"); | 69 "Compute stacktrace in named function on stack overflow checks"); |
| 69 DEFINE_FLAG(int, deoptimize_every, 0, | 70 DEFINE_FLAG(int, deoptimize_every, 0, |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 1467 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
| 1467 const Function& function = Function::CheckedHandle(zone, | 1468 const Function& function = Function::CheckedHandle(zone, |
| 1468 arguments.ArgAt(0)); | 1469 arguments.ArgAt(0)); |
| 1469 ASSERT(!function.IsNull()); | 1470 ASSERT(!function.IsNull()); |
| 1470 ASSERT(function.HasCode()); | 1471 ASSERT(function.HasCode()); |
| 1471 | 1472 |
| 1472 if (CanOptimizeFunction(function, isolate)) { | 1473 if (CanOptimizeFunction(function, isolate)) { |
| 1473 // Reset usage counter for reoptimization before calling optimizer to | 1474 // Reset usage counter for reoptimization before calling optimizer to |
| 1474 // prevent recursive triggering of function optimization. | 1475 // prevent recursive triggering of function optimization. |
| 1475 function.set_usage_counter(0); | 1476 function.set_usage_counter(0); |
| 1477 if (FLAG_trace_compiler) { |
| 1478 if (function.HasOptimizedCode()) { |
| 1479 ISL_Print("ReCompiling function: '%s' \n", |
| 1480 function.ToFullyQualifiedCString()); |
| 1481 } |
| 1482 } |
| 1476 const Error& error = Error::Handle( | 1483 const Error& error = Error::Handle( |
| 1477 isolate, Compiler::CompileOptimizedFunction(thread, function)); | 1484 isolate, Compiler::CompileOptimizedFunction(thread, function)); |
| 1478 if (!error.IsNull()) { | 1485 if (!error.IsNull()) { |
| 1479 Exceptions::PropagateError(error); | 1486 Exceptions::PropagateError(error); |
| 1480 } | 1487 } |
| 1481 const Code& optimized_code = Code::Handle(isolate, function.CurrentCode()); | 1488 const Code& optimized_code = Code::Handle(isolate, function.CurrentCode()); |
| 1482 ASSERT(!optimized_code.IsNull()); | 1489 ASSERT(!optimized_code.IsNull()); |
| 1483 } | 1490 } |
| 1484 arguments.SetReturn(Code::Handle(isolate, function.CurrentCode())); | 1491 arguments.SetReturn(Code::Handle(isolate, function.CurrentCode())); |
| 1485 } | 1492 } |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1855 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1849 const TypedData& new_data = | 1856 const TypedData& new_data = |
| 1850 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1857 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1851 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1858 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1852 typed_data_cell.SetAt(0, new_data); | 1859 typed_data_cell.SetAt(0, new_data); |
| 1853 arguments.SetReturn(new_data); | 1860 arguments.SetReturn(new_data); |
| 1854 } | 1861 } |
| 1855 | 1862 |
| 1856 | 1863 |
| 1857 } // namespace dart | 1864 } // namespace dart |
| OLD | NEW |