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 14 matching lines...) Expand all Loading... |
25 #include "vm/thread_registry.h" | 25 #include "vm/thread_registry.h" |
26 #include "vm/verifier.h" | 26 #include "vm/verifier.h" |
27 | 27 |
28 namespace dart { | 28 namespace dart { |
29 | 29 |
30 DEFINE_FLAG(int, max_subtype_cache_entries, 100, | 30 DEFINE_FLAG(int, max_subtype_cache_entries, 100, |
31 "Maximum number of subtype cache entries (number of checks cached)."); | 31 "Maximum number of subtype cache entries (number of checks cached)."); |
32 DEFINE_FLAG(int, regexp_optimization_counter_threshold, 1000, | 32 DEFINE_FLAG(int, regexp_optimization_counter_threshold, 1000, |
33 "RegExp's usage-counter value before it is optimized, -1 means never"); | 33 "RegExp's usage-counter value before it is optimized, -1 means never"); |
34 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); | 34 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); |
| 35 // TODO(srdjan): Remove this flag once background compilation of regular |
| 36 // expressions is possible. |
| 37 DEFINE_FLAG(bool, regexp_opt_in_background, false, |
| 38 "Optimize reg-exp functions in background"); |
35 DEFINE_FLAG(int, reoptimization_counter_threshold, 4000, | 39 DEFINE_FLAG(int, reoptimization_counter_threshold, 4000, |
36 "Counter threshold before a function gets reoptimized."); | 40 "Counter threshold before a function gets reoptimized."); |
37 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false, | 41 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false, |
38 "Debugging: stops program if deoptimizing same function too often"); | 42 "Debugging: stops program if deoptimizing same function too often"); |
39 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); | 43 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); |
40 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, | 44 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, |
41 "Trace deoptimization verbose"); | 45 "Trace deoptimization verbose"); |
42 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, | 46 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, |
43 "Traces all failed optimization attempts"); | 47 "Traces all failed optimization attempts"); |
44 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 48 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 if (FLAG_trace_optimization || FLAG_trace_field_guards) { | 1458 if (FLAG_trace_optimization || FLAG_trace_field_guards) { |
1455 THR_Print("Lazy disabling unboxing of %s\n", field.ToCString()); | 1459 THR_Print("Lazy disabling unboxing of %s\n", field.ToCString()); |
1456 } | 1460 } |
1457 field.set_is_unboxing_candidate(false); | 1461 field.set_is_unboxing_candidate(false); |
1458 field.DeoptimizeDependentCode(); | 1462 field.DeoptimizeDependentCode(); |
1459 // Get next field. | 1463 // Get next field. |
1460 field = isolate->GetDeoptimizingBoxedField(); | 1464 field = isolate->GetDeoptimizingBoxedField(); |
1461 } | 1465 } |
1462 } | 1466 } |
1463 // TODO(srdjan): Fix background compilation of regular expressions. | 1467 // TODO(srdjan): Fix background compilation of regular expressions. |
1464 if (FLAG_background_compilation) { | 1468 if (FLAG_background_compilation && |
| 1469 (!function.IsIrregexpFunction() || FLAG_regexp_opt_in_background)) { |
1465 if (FLAG_enable_inlining_annotations) { | 1470 if (FLAG_enable_inlining_annotations) { |
1466 FATAL("Cannot enable inlining annotations and background compilation"); | 1471 FATAL("Cannot enable inlining annotations and background compilation"); |
1467 } | 1472 } |
1468 // Reduce the chance of triggering optimization while the function is | 1473 // Reduce the chance of triggering optimization while the function is |
1469 // being optimized in the background. INT_MIN should ensure that it takes | 1474 // being optimized in the background. INT_MIN should ensure that it takes |
1470 // long time to trigger optimization. | 1475 // long time to trigger optimization. |
1471 // Note that the background compilation queue rejects duplicate entries. | 1476 // Note that the background compilation queue rejects duplicate entries. |
1472 function.set_usage_counter(INT_MIN); | 1477 function.set_usage_counter(INT_MIN); |
1473 BackgroundCompiler::EnsureInit(thread); | 1478 BackgroundCompiler::EnsureInit(thread); |
1474 ASSERT(isolate->background_compiler() != NULL); | 1479 ASSERT(isolate->background_compiler() != NULL); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1892 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1888 const TypedData& new_data = | 1893 const TypedData& new_data = |
1889 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1894 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1890 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1895 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1891 typed_data_cell.SetAt(0, new_data); | 1896 typed_data_cell.SetAt(0, new_data); |
1892 arguments.SetReturn(new_data); | 1897 arguments.SetReturn(new_data); |
1893 } | 1898 } |
1894 | 1899 |
1895 | 1900 |
1896 } // namespace dart | 1901 } // namespace dart |
OLD | NEW |