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

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

Issue 2199263004: Revert "Tree-shaker: Use insertion in the work queue instead of "was compiled" as the criterion to … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months 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 | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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/precompiler.h" 5 #include "vm/precompiler.h"
6 6
7 #include "vm/aot_optimizer.h" 7 #include "vm/aot_optimizer.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/branch_optimizer.h" 10 #include "vm/branch_optimizer.h"
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 // such as const constructors compiled by the parser. 611 // such as const constructors compiled by the parser.
612 THR_Print("Already has code: %s (%s, %s)\n", 612 THR_Print("Already has code: %s (%s, %s)\n",
613 function.ToLibNamePrefixedQualifiedCString(), 613 function.ToLibNamePrefixedQualifiedCString(),
614 function.token_pos().ToCString(), 614 function.token_pos().ToCString(),
615 Function::KindToCString(function.kind())); 615 Function::KindToCString(function.kind()));
616 } 616 }
617 } 617 }
618 618
619 ASSERT(function.HasCode()); 619 ASSERT(function.HasCode());
620 AddCalleesOf(function); 620 AddCalleesOf(function);
621 AddTypesOf(function);
622 } 621 }
623 622
624 623
625 void Precompiler::AddCalleesOf(const Function& function) { 624 void Precompiler::AddCalleesOf(const Function& function) {
626 ASSERT(function.HasCode()); 625 ASSERT(function.HasCode());
627 626
628 const Code& code = Code::Handle(Z, function.CurrentCode()); 627 const Code& code = Code::Handle(Z, function.CurrentCode());
629 628
630 const Array& table = Array::Handle(Z, code.static_calls_target_table()); 629 const Array& table = Array::Handle(Z, code.static_calls_target_table());
631 Object& entry = Object::Handle(Z); 630 Object& entry = Object::Handle(Z);
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate); 1376 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
1378 while (it.HasNext()) { 1377 while (it.HasNext()) {
1379 cls = it.GetNextClass(); 1378 cls = it.GetNextClass();
1380 if (cls.IsDynamicClass()) { 1379 if (cls.IsDynamicClass()) {
1381 continue; // class 'dynamic' is in the read-only VM isolate. 1380 continue; // class 'dynamic' is in the read-only VM isolate.
1382 } 1381 }
1383 1382
1384 functions = cls.functions(); 1383 functions = cls.functions();
1385 for (intptr_t j = 0; j < functions.Length(); j++) { 1384 for (intptr_t j = 0; j < functions.Length(); j++) {
1386 function ^= functions.At(j); 1385 function ^= functions.At(j);
1387 bool retain = functions_to_retain_.Lookup(&function) != NULL; 1386 bool retain = function.HasCode();
1388 if (!retain && function.HasImplicitClosureFunction()) { 1387 if (!retain && function.HasImplicitClosureFunction()) {
1389 // It can happen that all uses of an implicit closure inline their 1388 // It can happen that all uses of an implicit closure inline their
1390 // target function, leaving the target function uncompiled. Keep 1389 // target function, leaving the target function uncompiled. Keep
1391 // the target function anyway so we can enumerate it to bind its 1390 // the target function anyway so we can enumerate it to bind its
1392 // static calls, etc. 1391 // static calls, etc.
1393 function2 = function.ImplicitClosureFunction(); 1392 function2 = function.ImplicitClosureFunction();
1394 retain = function2.HasCode(); 1393 retain = function2.HasCode();
1395 } 1394 }
1396 if (retain) { 1395 if (retain) {
1397 function.DropUncompiledImplicitClosureFunction(); 1396 function.DropUncompiledImplicitClosureFunction();
1397 AddTypesOf(function);
1398 } 1398 }
1399 } 1399 }
1400 } 1400 }
1401 } 1401 }
1402 1402
1403 closures = isolate()->object_store()->closure_functions(); 1403 closures = isolate()->object_store()->closure_functions();
1404 for (intptr_t j = 0; j < closures.Length(); j++) { 1404 for (intptr_t j = 0; j < closures.Length(); j++) {
1405 function ^= closures.At(j); 1405 function ^= closures.At(j);
1406 bool retain = functions_to_retain_.Lookup(&function) != NULL; 1406 bool retain = function.HasCode();
1407 if (retain) { 1407 if (retain) {
1408 AddTypesOf(function);
1409
1408 cls = function.Owner(); 1410 cls = function.Owner();
1409 AddTypesOf(cls); 1411 AddTypesOf(cls);
1410 1412
1411 // It can happen that all uses of a function are inlined, leaving 1413 // It can happen that all uses of a function are inlined, leaving
1412 // a compiled local function with an uncompiled parent. Retain such 1414 // a compiled local function with an uncompiled parent. Retain such
1413 // parents and their enclosing classes and libraries. 1415 // parents and their enclosing classes and libraries.
1414 function = function.parent_function(); 1416 function = function.parent_function();
1415 while (!function.IsNull()) { 1417 while (!function.IsNull()) {
1416 AddTypesOf(function); 1418 AddTypesOf(function);
1417 function = function.parent_function(); 1419 function = function.parent_function();
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 CompilationPipeline::New(thread->zone(), function); 2950 CompilationPipeline::New(thread->zone(), function);
2949 2951
2950 ASSERT(FLAG_precompiled_mode); 2952 ASSERT(FLAG_precompiled_mode);
2951 const bool optimized = function.IsOptimizable(); // False for natives. 2953 const bool optimized = function.IsOptimizable(); // False for natives.
2952 return PrecompileFunctionHelper(pipeline, function, optimized); 2954 return PrecompileFunctionHelper(pipeline, function, optimized);
2953 } 2955 }
2954 2956
2955 #endif // DART_PRECOMPILER 2957 #endif // DART_PRECOMPILER
2956 2958
2957 } // namespace dart 2959 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698