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

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

Issue 2949803002: New growth strategy for growable arrays (Closed)
Patch Set: Branch-free grow size computation. Renamed function names to be clearer. Created 3 years, 6 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/parser.cc ('k') | runtime/vm/profiler_test.cc » ('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 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 } else { 1765 } else {
1766 dropped_function_count_++; 1766 dropped_function_count_++;
1767 if (FLAG_trace_precompiler) { 1767 if (FLAG_trace_precompiler) {
1768 THR_Print("Dropping function %s\n", 1768 THR_Print("Dropping function %s\n",
1769 function.ToLibNamePrefixedQualifiedCString()); 1769 function.ToLibNamePrefixedQualifiedCString());
1770 } 1770 }
1771 } 1771 }
1772 } 1772 }
1773 1773
1774 if (retained_functions.Length() > 0) { 1774 if (retained_functions.Length() > 0) {
1775 functions = Array::MakeArray(retained_functions); 1775 functions = Array::MakeFixedLength(retained_functions);
1776 cls.SetFunctions(functions); 1776 cls.SetFunctions(functions);
1777 } else { 1777 } else {
1778 cls.SetFunctions(Object::empty_array()); 1778 cls.SetFunctions(Object::empty_array());
1779 } 1779 }
1780 } 1780 }
1781 } 1781 }
1782 1782
1783 closures = isolate()->object_store()->closure_functions(); 1783 closures = isolate()->object_store()->closure_functions();
1784 retained_functions = GrowableObjectArray::New(); 1784 retained_functions = GrowableObjectArray::New();
1785 for (intptr_t j = 0; j < closures.Length(); j++) { 1785 for (intptr_t j = 0; j < closures.Length(); j++) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 AddType(type); 1827 AddType(type);
1828 } else { 1828 } else {
1829 dropped_field_count_++; 1829 dropped_field_count_++;
1830 if (FLAG_trace_precompiler) { 1830 if (FLAG_trace_precompiler) {
1831 THR_Print("Dropping field %s\n", field.ToCString()); 1831 THR_Print("Dropping field %s\n", field.ToCString());
1832 } 1832 }
1833 } 1833 }
1834 } 1834 }
1835 1835
1836 if (retained_fields.Length() > 0) { 1836 if (retained_fields.Length() > 0) {
1837 fields = Array::MakeArray(retained_fields); 1837 fields = Array::MakeFixedLength(retained_fields);
1838 cls.SetFields(fields); 1838 cls.SetFields(fields);
1839 } else { 1839 } else {
1840 cls.SetFields(Object::empty_array()); 1840 cls.SetFields(Object::empty_array());
1841 } 1841 }
1842 } 1842 }
1843 } 1843 }
1844 } 1844 }
1845 1845
1846 1846
1847 void Precompiler::DropTypes() { 1847 void Precompiler::DropTypes() {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 for (intptr_t j = 0; j < constants.Length(); j++) { 1981 for (intptr_t j = 0; j < constants.Length(); j++) {
1982 constant ^= constants.At(j); 1982 constant ^= constants.At(j);
1983 bool retain = consts_to_retain_.HasKey(&constant); 1983 bool retain = consts_to_retain_.HasKey(&constant);
1984 if (retain) { 1984 if (retain) {
1985 retained_constants.Add(constant); 1985 retained_constants.Add(constant);
1986 } 1986 }
1987 } 1987 }
1988 intptr_t cid = cls.id(); 1988 intptr_t cid = cls.id();
1989 if ((cid == kMintCid) || (cid == kBigintCid) || (cid == kDoubleCid)) { 1989 if ((cid == kMintCid) || (cid == kBigintCid) || (cid == kDoubleCid)) {
1990 // Constants stored as a plain list, no rehashing needed. 1990 // Constants stored as a plain list, no rehashing needed.
1991 constants = Array::MakeArray(retained_constants); 1991 constants = Array::MakeFixedLength(retained_constants);
1992 cls.set_constants(constants); 1992 cls.set_constants(constants);
1993 } else { 1993 } else {
1994 // Rehash. 1994 // Rehash.
1995 cls.set_constants(Object::empty_array()); 1995 cls.set_constants(Object::empty_array());
1996 for (intptr_t j = 0; j < retained_constants.Length(); j++) { 1996 for (intptr_t j = 0; j < retained_constants.Length(); j++) {
1997 constant ^= retained_constants.At(j); 1997 constant ^= retained_constants.At(j);
1998 cls.InsertCanonicalConstant(Z, constant); 1998 cls.InsertCanonicalConstant(Z, constant);
1999 } 1999 }
2000 } 2000 }
2001 2001
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
3389 3389
3390 ASSERT(FLAG_precompiled_mode); 3390 ASSERT(FLAG_precompiled_mode);
3391 const bool optimized = function.IsOptimizable(); // False for natives. 3391 const bool optimized = function.IsOptimizable(); // False for natives.
3392 DartPrecompilationPipeline pipeline(zone, field_type_map); 3392 DartPrecompilationPipeline pipeline(zone, field_type_map);
3393 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); 3393 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized);
3394 } 3394 }
3395 3395
3396 #endif // DART_PRECOMPILER 3396 #endif // DART_PRECOMPILER
3397 3397
3398 } // namespace dart 3398 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698