| 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"); | |
| 39 DEFINE_FLAG(int, reoptimization_counter_threshold, 4000, | 35 DEFINE_FLAG(int, reoptimization_counter_threshold, 4000, |
| 40 "Counter threshold before a function gets reoptimized."); | 36 "Counter threshold before a function gets reoptimized."); |
| 41 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false, | 37 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false, |
| 42 "Debugging: stops program if deoptimizing same function too often"); | 38 "Debugging: stops program if deoptimizing same function too often"); |
| 43 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); | 39 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); |
| 44 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, | 40 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, |
| 45 "Trace deoptimization verbose"); | 41 "Trace deoptimization verbose"); |
| 46 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, | 42 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, |
| 47 "Traces all failed optimization attempts"); | 43 "Traces all failed optimization attempts"); |
| 48 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 44 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 if (FLAG_trace_optimization || FLAG_trace_field_guards) { | 1441 if (FLAG_trace_optimization || FLAG_trace_field_guards) { |
| 1446 THR_Print("Lazy disabling unboxing of %s\n", field.ToCString()); | 1442 THR_Print("Lazy disabling unboxing of %s\n", field.ToCString()); |
| 1447 } | 1443 } |
| 1448 field.set_is_unboxing_candidate(false); | 1444 field.set_is_unboxing_candidate(false); |
| 1449 field.DeoptimizeDependentCode(); | 1445 field.DeoptimizeDependentCode(); |
| 1450 // Get next field. | 1446 // Get next field. |
| 1451 field = isolate->GetDeoptimizingBoxedField(); | 1447 field = isolate->GetDeoptimizingBoxedField(); |
| 1452 } | 1448 } |
| 1453 } | 1449 } |
| 1454 // TODO(srdjan): Fix background compilation of regular expressions. | 1450 // TODO(srdjan): Fix background compilation of regular expressions. |
| 1455 if (FLAG_background_compilation && | 1451 if (FLAG_background_compilation) { |
| 1456 (!function.IsIrregexpFunction() || FLAG_regexp_opt_in_background)) { | |
| 1457 if (FLAG_enable_inlining_annotations) { | 1452 if (FLAG_enable_inlining_annotations) { |
| 1458 FATAL("Cannot enable inlining annotations and background compilation"); | 1453 FATAL("Cannot enable inlining annotations and background compilation"); |
| 1459 } | 1454 } |
| 1460 // Reduce the chance of triggering optimization while the function is | 1455 // Reduce the chance of triggering optimization while the function is |
| 1461 // being optimized in the background. INT_MIN should ensure that it takes | 1456 // being optimized in the background. INT_MIN should ensure that it takes |
| 1462 // long time to trigger optimization. | 1457 // long time to trigger optimization. |
| 1463 // Note that the background compilation queue rejects duplicate entries. | 1458 // Note that the background compilation queue rejects duplicate entries. |
| 1464 function.set_usage_counter(INT_MIN); | 1459 function.set_usage_counter(INT_MIN); |
| 1465 BackgroundCompiler::EnsureInit(thread); | 1460 BackgroundCompiler::EnsureInit(thread); |
| 1466 ASSERT(isolate->background_compiler() != NULL); | 1461 ASSERT(isolate->background_compiler() != NULL); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1874 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1880 const TypedData& new_data = | 1875 const TypedData& new_data = |
| 1881 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1876 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1882 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1877 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1883 typed_data_cell.SetAt(0, new_data); | 1878 typed_data_cell.SetAt(0, new_data); |
| 1884 arguments.SetReturn(new_data); | 1879 arguments.SetReturn(new_data); |
| 1885 } | 1880 } |
| 1886 | 1881 |
| 1887 | 1882 |
| 1888 } // namespace dart | 1883 } // namespace dart |
| OLD | NEW |