| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/symbols.h" | 5 #include "vm/symbols.h" |
| 6 | 6 |
| 7 #include "vm/handles.h" | 7 #include "vm/handles.h" |
| 8 #include "vm/hash_table.h" | 8 #include "vm/hash_table.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 SymbolTable::Iterator iter(&table); | 330 SymbolTable::Iterator iter(&table); |
| 331 while (iter.MoveNext()) { | 331 while (iter.MoveNext()) { |
| 332 symbol ^= table.GetKey(iter.Current()); | 332 symbol ^= table.GetKey(iter.Current()); |
| 333 ASSERT(!symbol.IsNull()); | 333 ASSERT(!symbol.IsNull()); |
| 334 bool present = unified_table.Insert(symbol); | 334 bool present = unified_table.Insert(symbol); |
| 335 ASSERT(!present); | 335 ASSERT(!present); |
| 336 } | 336 } |
| 337 table.Release(); | 337 table.Release(); |
| 338 | 338 |
| 339 const double kMinLoad = 0.90; | 339 // TODO(30378): The default load factor of 0.75 / 2 burns ~100KB, but |
| 340 const double kMaxLoad = 0.90; | 340 // increasing the load factor regresses Flutter's hot restart time. |
| 341 HashTables::EnsureLoadFactor(kMinLoad, kMaxLoad, unified_table); | 341 // const double kMinLoad = 0.90; |
| 342 // const double kMaxLoad = 0.90; |
| 343 // HashTables::EnsureLoadFactor(kMinLoad, kMaxLoad, unified_table); |
| 342 | 344 |
| 343 return unified_table.Release().raw(); | 345 return unified_table.Release().raw(); |
| 344 } | 346 } |
| 345 | 347 |
| 346 void Symbols::Compact(Isolate* isolate) { | 348 void Symbols::Compact(Isolate* isolate) { |
| 347 ASSERT(isolate != Dart::vm_isolate()); | 349 ASSERT(isolate != Dart::vm_isolate()); |
| 348 Zone* zone = Thread::Current()->zone(); | 350 Zone* zone = Thread::Current()->zone(); |
| 349 | 351 |
| 350 // 1. Drop the symbol table and do a full garbage collection. | 352 // 1. Drop the symbol table and do a full garbage collection. |
| 351 isolate->object_store()->set_symbol_table(Object::empty_array()); | 353 isolate->object_store()->set_symbol_table(Object::empty_array()); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 RawObject* Symbols::GetPredefinedSymbol(intptr_t object_id) { | 699 RawObject* Symbols::GetPredefinedSymbol(intptr_t object_id) { |
| 698 ASSERT(IsPredefinedSymbolId(object_id)); | 700 ASSERT(IsPredefinedSymbolId(object_id)); |
| 699 intptr_t i = (object_id - kMaxPredefinedObjectIds); | 701 intptr_t i = (object_id - kMaxPredefinedObjectIds); |
| 700 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { | 702 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { |
| 701 return symbol_handles_[i]->raw(); | 703 return symbol_handles_[i]->raw(); |
| 702 } | 704 } |
| 703 return Object::null(); | 705 return Object::null(); |
| 704 } | 706 } |
| 705 | 707 |
| 706 } // namespace dart | 708 } // namespace dart |
| OLD | NEW |