| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 52 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| 53 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, | 53 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, |
| 54 "Trace IC miss in optimized code"); | 54 "Trace IC miss in optimized code"); |
| 55 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, | 55 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, |
| 56 "Trace IC calls in optimized code."); | 56 "Trace IC calls in optimized code."); |
| 57 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 57 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
| 58 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 58 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
| 59 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); | 59 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); |
| 60 | 60 |
| 61 DECLARE_FLAG(int, deoptimization_counter_threshold); | 61 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 62 DECLARE_FLAG(bool, enable_inlining_annotations); |
| 62 DECLARE_FLAG(bool, trace_compiler); | 63 DECLARE_FLAG(bool, trace_compiler); |
| 63 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 64 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
| 64 DECLARE_FLAG(int, max_polymorphic_checks); | 65 DECLARE_FLAG(int, max_polymorphic_checks); |
| 65 | 66 |
| 66 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); | 67 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
| 67 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 68 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
| 68 | 69 |
| 69 DEFINE_FLAG(int, stacktrace_every, 0, | 70 DEFINE_FLAG(int, stacktrace_every, 0, |
| 70 "Compute debugger stacktrace on every N stack overflow checks"); | 71 "Compute debugger stacktrace on every N stack overflow checks"); |
| 71 DEFINE_FLAG(charp, stacktrace_filter, NULL, | 72 DEFINE_FLAG(charp, stacktrace_filter, NULL, |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 // The requesting function can be already optimized (reoptimization). | 1481 // The requesting function can be already optimized (reoptimization). |
| 1481 // Returns the Code object where to continue execution. | 1482 // Returns the Code object where to continue execution. |
| 1482 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 1483 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
| 1483 const Function& function = Function::CheckedHandle(zone, | 1484 const Function& function = Function::CheckedHandle(zone, |
| 1484 arguments.ArgAt(0)); | 1485 arguments.ArgAt(0)); |
| 1485 ASSERT(!function.IsNull()); | 1486 ASSERT(!function.IsNull()); |
| 1486 ASSERT(function.HasCode()); | 1487 ASSERT(function.HasCode()); |
| 1487 | 1488 |
| 1488 if (CanOptimizeFunction(function, thread)) { | 1489 if (CanOptimizeFunction(function, thread)) { |
| 1489 if (FLAG_background_compilation) { | 1490 if (FLAG_background_compilation) { |
| 1491 if (FLAG_enable_inlining_annotations) { |
| 1492 FATAL("Cannot enable inlining annotations and background compilation"); |
| 1493 } |
| 1490 // Reduce the chance of triggering optimization while the function is | 1494 // Reduce the chance of triggering optimization while the function is |
| 1491 // being optimized in the background. INT_MIN should ensure that it takes | 1495 // being optimized in the background. INT_MIN should ensure that it takes |
| 1492 // long time to trigger optimization. | 1496 // long time to trigger optimization. |
| 1493 // Note that the background compilation queue rejects duplicate entries. | 1497 // Note that the background compilation queue rejects duplicate entries. |
| 1494 function.set_usage_counter(INT_MIN); | 1498 function.set_usage_counter(INT_MIN); |
| 1495 BackgroundCompiler::EnsureInit(thread); | 1499 BackgroundCompiler::EnsureInit(thread); |
| 1496 ASSERT(isolate->background_compiler() != NULL); | 1500 ASSERT(isolate->background_compiler() != NULL); |
| 1497 isolate->background_compiler()->CompileOptimized(function); | 1501 isolate->background_compiler()->CompileOptimized(function); |
| 1498 // Install all generated optimized code in the mutator thread (this one). | 1502 // Install all generated optimized code in the mutator thread (this one). |
| 1499 isolate->background_compiler()->InstallGeneratedCode(); | 1503 isolate->background_compiler()->InstallGeneratedCode(); |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1885 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1882 const TypedData& new_data = | 1886 const TypedData& new_data = |
| 1883 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1887 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1884 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1888 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1885 typed_data_cell.SetAt(0, new_data); | 1889 typed_data_cell.SetAt(0, new_data); |
| 1886 arguments.SetReturn(new_data); | 1890 arguments.SetReturn(new_data); |
| 1887 } | 1891 } |
| 1888 | 1892 |
| 1889 | 1893 |
| 1890 } // namespace dart | 1894 } // namespace dart |
| OLD | NEW |