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 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 FATAL("Cannot enable inlining annotations and background compilation"); | 1492 FATAL("Cannot enable inlining annotations and background compilation"); |
1493 } | 1493 } |
1494 // Reduce the chance of triggering optimization while the function is | 1494 // Reduce the chance of triggering optimization while the function is |
1495 // 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 |
1496 // long time to trigger optimization. | 1496 // long time to trigger optimization. |
1497 // Note that the background compilation queue rejects duplicate entries. | 1497 // Note that the background compilation queue rejects duplicate entries. |
1498 function.set_usage_counter(INT_MIN); | 1498 function.set_usage_counter(INT_MIN); |
1499 BackgroundCompiler::EnsureInit(thread); | 1499 BackgroundCompiler::EnsureInit(thread); |
1500 ASSERT(isolate->background_compiler() != NULL); | 1500 ASSERT(isolate->background_compiler() != NULL); |
1501 isolate->background_compiler()->CompileOptimized(function); | 1501 isolate->background_compiler()->CompileOptimized(function); |
1502 // Install all generated optimized code in the mutator thread (this one). | |
1503 isolate->background_compiler()->InstallGeneratedCode(); | |
1504 // Continue in the same code. | 1502 // Continue in the same code. |
1505 arguments.SetReturn(Code::Handle(zone, function.CurrentCode())); | 1503 arguments.SetReturn(Code::Handle(zone, function.CurrentCode())); |
1506 return; | 1504 return; |
1507 } | 1505 } |
1508 | 1506 |
1509 // Reset usage counter for reoptimization before calling optimizer to | 1507 // Reset usage counter for reoptimization before calling optimizer to |
1510 // prevent recursive triggering of function optimization. | 1508 // prevent recursive triggering of function optimization. |
1511 function.set_usage_counter(0); | 1509 function.set_usage_counter(0); |
1512 if (FLAG_trace_compiler) { | 1510 if (FLAG_trace_compiler) { |
1513 if (function.HasOptimizedCode()) { | 1511 if (function.HasOptimizedCode()) { |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1883 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1886 const TypedData& new_data = | 1884 const TypedData& new_data = |
1887 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1885 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1888 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1886 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1889 typed_data_cell.SetAt(0, new_data); | 1887 typed_data_cell.SetAt(0, new_data); |
1890 arguments.SetReturn(new_data); | 1888 arguments.SetReturn(new_data); |
1891 } | 1889 } |
1892 | 1890 |
1893 | 1891 |
1894 } // namespace dart | 1892 } // namespace dart |
OLD | NEW |