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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 "Trace IC miss in optimized code"); | 58 "Trace IC miss in optimized code"); |
59 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, | 59 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, |
60 "Trace IC calls in optimized code."); | 60 "Trace IC calls in optimized code."); |
61 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 61 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
62 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 62 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
63 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); | 63 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); |
64 | 64 |
65 DECLARE_FLAG(int, max_deoptimization_counter_threshold); | 65 DECLARE_FLAG(int, max_deoptimization_counter_threshold); |
66 DECLARE_FLAG(bool, enable_inlining_annotations); | 66 DECLARE_FLAG(bool, enable_inlining_annotations); |
67 DECLARE_FLAG(bool, trace_compiler); | 67 DECLARE_FLAG(bool, trace_compiler); |
| 68 DECLARE_FLAG(bool, trace_field_guards); |
| 69 DECLARE_FLAG(bool, trace_optimization); |
68 DECLARE_FLAG(bool, trace_optimizing_compiler); | 70 DECLARE_FLAG(bool, trace_optimizing_compiler); |
69 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 71 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
70 DECLARE_FLAG(int, max_polymorphic_checks); | 72 DECLARE_FLAG(int, max_polymorphic_checks); |
71 DECLARE_FLAG(bool, precompilation); | 73 DECLARE_FLAG(bool, precompilation); |
72 | 74 |
73 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); | 75 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
74 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 76 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
75 | 77 |
76 DEFINE_FLAG(int, stacktrace_every, 0, | 78 DEFINE_FLAG(int, stacktrace_every, 0, |
77 "Compute debugger stacktrace on every N stack overflow checks"); | 79 "Compute debugger stacktrace on every N stack overflow checks"); |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 // This is called from function that needs to be optimized. | 1489 // This is called from function that needs to be optimized. |
1488 // The requesting function can be already optimized (reoptimization). | 1490 // The requesting function can be already optimized (reoptimization). |
1489 // Returns the Code object where to continue execution. | 1491 // Returns the Code object where to continue execution. |
1490 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 1492 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
1491 const Function& function = Function::CheckedHandle(zone, | 1493 const Function& function = Function::CheckedHandle(zone, |
1492 arguments.ArgAt(0)); | 1494 arguments.ArgAt(0)); |
1493 ASSERT(!function.IsNull()); | 1495 ASSERT(!function.IsNull()); |
1494 ASSERT(function.HasCode()); | 1496 ASSERT(function.HasCode()); |
1495 | 1497 |
1496 if (CanOptimizeFunction(function, thread)) { | 1498 if (CanOptimizeFunction(function, thread)) { |
| 1499 if (FLAG_background_compilation) { |
| 1500 Field& field = Field::Handle(zone, isolate->GetDeoptimizingBoxedField()); |
| 1501 while (!field.IsNull()) { |
| 1502 if (FLAG_trace_optimization || FLAG_trace_field_guards) { |
| 1503 THR_Print("Lazy disabling unboxing of %s\n", field.ToCString()); |
| 1504 } |
| 1505 field.set_is_unboxing_candidate(false); |
| 1506 field.DeoptimizeDependentCode(); |
| 1507 // Get next field. |
| 1508 field = isolate->GetDeoptimizingBoxedField(); |
| 1509 } |
| 1510 } |
1497 // TODO(srdjan): Fix background compilation of regular expressions. | 1511 // TODO(srdjan): Fix background compilation of regular expressions. |
1498 if (FLAG_background_compilation && | 1512 if (FLAG_background_compilation && |
1499 (!function.IsIrregexpFunction() || FLAG_regexp_opt_in_background)) { | 1513 (!function.IsIrregexpFunction() || FLAG_regexp_opt_in_background)) { |
1500 if (FLAG_enable_inlining_annotations) { | 1514 if (FLAG_enable_inlining_annotations) { |
1501 FATAL("Cannot enable inlining annotations and background compilation"); | 1515 FATAL("Cannot enable inlining annotations and background compilation"); |
1502 } | 1516 } |
1503 // Reduce the chance of triggering optimization while the function is | 1517 // Reduce the chance of triggering optimization while the function is |
1504 // being optimized in the background. INT_MIN should ensure that it takes | 1518 // being optimized in the background. INT_MIN should ensure that it takes |
1505 // long time to trigger optimization. | 1519 // long time to trigger optimization. |
1506 // Note that the background compilation queue rejects duplicate entries. | 1520 // Note that the background compilation queue rejects duplicate entries. |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1920 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1907 const TypedData& new_data = | 1921 const TypedData& new_data = |
1908 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1922 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1909 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1923 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1910 typed_data_cell.SetAt(0, new_data); | 1924 typed_data_cell.SetAt(0, new_data); |
1911 arguments.SetReturn(new_data); | 1925 arguments.SetReturn(new_data); |
1912 } | 1926 } |
1913 | 1927 |
1914 | 1928 |
1915 } // namespace dart | 1929 } // namespace dart |
OLD | NEW |