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

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

Issue 2412653002: VM Propagate receiver type from calls to unique selectors in AOT compilation. (Closed)
Patch Set: addressed comments, added test Created 4 years, 2 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 | « runtime/vm/intermediate_language.h ('k') | tests/language/vm/unique_selector_test.dart » ('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) 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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 // Regular function. Enter both getter and non getter name. 1488 // Regular function. Enter both getter and non getter name.
1489 AddNameToFunctionsTable(zone(), &table, fname, function); 1489 AddNameToFunctionsTable(zone(), &table, fname, function);
1490 fname = Field::GetterName(fname); 1490 fname = Field::GetterName(fname);
1491 AddNameToFunctionsTable(zone(), &table, fname, function); 1491 AddNameToFunctionsTable(zone(), &table, fname, function);
1492 } 1492 }
1493 } 1493 }
1494 } 1494 }
1495 } 1495 }
1496 } 1496 }
1497 1497
1498 // Locate all entries with one function only, and whose owner is neither 1498 // Locate all entries with one function only
1499 // subclassed nor implemented.
1500 Table::Iterator iter(&table); 1499 Table::Iterator iter(&table);
1501 String& key = String::Handle(Z); 1500 String& key = String::Handle(Z);
1502 UniqueFunctionsSet functions_set(HashTables::New<UniqueFunctionsSet>(20)); 1501 UniqueFunctionsSet functions_set(HashTables::New<UniqueFunctionsSet>(20));
1503 while (iter.MoveNext()) { 1502 while (iter.MoveNext()) {
1504 intptr_t curr_key = iter.Current(); 1503 intptr_t curr_key = iter.Current();
1505 key ^= table.GetKey(curr_key); 1504 key ^= table.GetKey(curr_key);
1506 farray ^= table.GetOrNull(key); 1505 farray ^= table.GetOrNull(key);
1507 ASSERT(!farray.IsNull()); 1506 ASSERT(!farray.IsNull());
1508 if (farray.Length() == 1) { 1507 if (farray.Length() == 1) {
1509 function ^= farray.At(0); 1508 function ^= farray.At(0);
1510 cls = function.Owner(); 1509 cls = function.Owner();
1511 if (!CHA::IsImplemented(cls) && !CHA::HasSubclasses(cls)) { 1510 functions_set.Insert(function);
1512 functions_set.Insert(function);
1513 }
1514 } 1511 }
1515 } 1512 }
1516 1513
1517 if (FLAG_print_unique_targets) { 1514 if (FLAG_print_unique_targets) {
1518 UniqueFunctionsSet::Iterator unique_iter(&functions_set); 1515 UniqueFunctionsSet::Iterator unique_iter(&functions_set);
1519 while (unique_iter.MoveNext()) { 1516 while (unique_iter.MoveNext()) {
1520 intptr_t curr_key = unique_iter.Current(); 1517 intptr_t curr_key = unique_iter.Current();
1521 function ^= functions_set.GetKey(curr_key); 1518 function ^= functions_set.GetKey(curr_key);
1522 THR_Print("* %s\n", function.ToQualifiedCString()); 1519 THR_Print("* %s\n", function.ToQualifiedCString());
1523 } 1520 }
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 3340
3344 ASSERT(FLAG_precompiled_mode); 3341 ASSERT(FLAG_precompiled_mode);
3345 const bool optimized = function.IsOptimizable(); // False for natives. 3342 const bool optimized = function.IsOptimizable(); // False for natives.
3346 DartPrecompilationPipeline pipeline(zone, field_type_map); 3343 DartPrecompilationPipeline pipeline(zone, field_type_map);
3347 return PrecompileFunctionHelper(&pipeline, function, optimized); 3344 return PrecompileFunctionHelper(&pipeline, function, optimized);
3348 } 3345 }
3349 3346
3350 #endif // DART_PRECOMPILER 3347 #endif // DART_PRECOMPILER
3351 3348
3352 } // namespace dart 3349 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | tests/language/vm/unique_selector_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698