| 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 22 matching lines...) Expand all Loading... |
| 33 " native entries."); | 33 " native entries."); |
| 34 DEFINE_FLAG(bool, background_compilation, false, | 34 DEFINE_FLAG(bool, background_compilation, false, |
| 35 "Run optimizing compilation in background"); | 35 "Run optimizing compilation in background"); |
| 36 DEFINE_FLAG(int, max_subtype_cache_entries, 100, | 36 DEFINE_FLAG(int, max_subtype_cache_entries, 100, |
| 37 "Maximum number of subtype cache entries (number of checks cached)."); | 37 "Maximum number of subtype cache entries (number of checks cached)."); |
| 38 DEFINE_FLAG(int, optimization_counter_threshold, 30000, | 38 DEFINE_FLAG(int, optimization_counter_threshold, 30000, |
| 39 "Function's usage-counter value before it is optimized, -1 means never"); | 39 "Function's usage-counter value before it is optimized, -1 means never"); |
| 40 DEFINE_FLAG(int, regexp_optimization_counter_threshold, 1000, | 40 DEFINE_FLAG(int, regexp_optimization_counter_threshold, 1000, |
| 41 "RegExp's usage-counter value before it is optimized, -1 means never"); | 41 "RegExp's usage-counter value before it is optimized, -1 means never"); |
| 42 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); | 42 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); |
| 43 // TODO(srdjan): Remove this flag once background compilation of regular |
| 44 // expressions is possible. |
| 45 DEFINE_FLAG(bool, regexp_opt_in_background, false, |
| 46 "Optimize reg-exp functions in background"); |
| 43 DEFINE_FLAG(int, reoptimization_counter_threshold, 4000, | 47 DEFINE_FLAG(int, reoptimization_counter_threshold, 4000, |
| 44 "Counter threshold before a function gets reoptimized."); | 48 "Counter threshold before a function gets reoptimized."); |
| 45 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false, | 49 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false, |
| 46 "Debugging: stops program if deoptimizing same function too often"); | 50 "Debugging: stops program if deoptimizing same function too often"); |
| 47 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); | 51 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); |
| 48 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, | 52 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, |
| 49 "Trace deoptimization verbose"); | 53 "Trace deoptimization verbose"); |
| 50 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, | 54 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, |
| 51 "Traces all failed optimization attempts"); | 55 "Traces all failed optimization attempts"); |
| 52 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 56 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 // This is called from function that needs to be optimized. | 1487 // This is called from function that needs to be optimized. |
| 1484 // The requesting function can be already optimized (reoptimization). | 1488 // The requesting function can be already optimized (reoptimization). |
| 1485 // Returns the Code object where to continue execution. | 1489 // Returns the Code object where to continue execution. |
| 1486 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 1490 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
| 1487 const Function& function = Function::CheckedHandle(zone, | 1491 const Function& function = Function::CheckedHandle(zone, |
| 1488 arguments.ArgAt(0)); | 1492 arguments.ArgAt(0)); |
| 1489 ASSERT(!function.IsNull()); | 1493 ASSERT(!function.IsNull()); |
| 1490 ASSERT(function.HasCode()); | 1494 ASSERT(function.HasCode()); |
| 1491 | 1495 |
| 1492 if (CanOptimizeFunction(function, thread)) { | 1496 if (CanOptimizeFunction(function, thread)) { |
| 1493 if (FLAG_background_compilation) { | 1497 // TODO(srdjan): Fix background compilation of regular expressions. |
| 1498 if (FLAG_background_compilation && |
| 1499 (!function.IsIrregexpFunction() || FLAG_regexp_opt_in_background)) { |
| 1494 if (FLAG_enable_inlining_annotations) { | 1500 if (FLAG_enable_inlining_annotations) { |
| 1495 FATAL("Cannot enable inlining annotations and background compilation"); | 1501 FATAL("Cannot enable inlining annotations and background compilation"); |
| 1496 } | 1502 } |
| 1497 // Reduce the chance of triggering optimization while the function is | 1503 // Reduce the chance of triggering optimization while the function is |
| 1498 // being optimized in the background. INT_MIN should ensure that it takes | 1504 // being optimized in the background. INT_MIN should ensure that it takes |
| 1499 // long time to trigger optimization. | 1505 // long time to trigger optimization. |
| 1500 // Note that the background compilation queue rejects duplicate entries. | 1506 // Note that the background compilation queue rejects duplicate entries. |
| 1501 function.set_usage_counter(INT_MIN); | 1507 function.set_usage_counter(INT_MIN); |
| 1502 BackgroundCompiler::EnsureInit(thread); | 1508 BackgroundCompiler::EnsureInit(thread); |
| 1503 ASSERT(isolate->background_compiler() != NULL); | 1509 ASSERT(isolate->background_compiler() != NULL); |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1906 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1901 const TypedData& new_data = | 1907 const TypedData& new_data = |
| 1902 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1908 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1903 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1909 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1904 typed_data_cell.SetAt(0, new_data); | 1910 typed_data_cell.SetAt(0, new_data); |
| 1905 arguments.SetReturn(new_data); | 1911 arguments.SetReturn(new_data); |
| 1906 } | 1912 } |
| 1907 | 1913 |
| 1908 | 1914 |
| 1909 } // namespace dart | 1915 } // namespace dart |
| OLD | NEW |