Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: runtime/vm/code_generator.cc

Issue 1454553004: Create code and instruction object, and install them in the background compilation thread while br… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698