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; |
| 340 const double kMaxLoad = 0.90; |
| 341 HashTables::EnsureLoadFactor(kMinLoad, kMaxLoad, unified_table); |
| 342 |
339 return unified_table.Release().raw(); | 343 return unified_table.Release().raw(); |
340 } | 344 } |
341 | 345 |
342 void Symbols::Compact(Isolate* isolate) { | 346 void Symbols::Compact(Isolate* isolate) { |
343 ASSERT(isolate != Dart::vm_isolate()); | 347 ASSERT(isolate != Dart::vm_isolate()); |
344 Zone* zone = Thread::Current()->zone(); | 348 Zone* zone = Thread::Current()->zone(); |
345 | 349 |
346 // 1. Drop the symbol table and do a full garbage collection. | 350 // 1. Drop the symbol table and do a full garbage collection. |
347 isolate->object_store()->set_symbol_table(Object::empty_array()); | 351 isolate->object_store()->set_symbol_table(Object::empty_array()); |
348 isolate->heap()->CollectAllGarbage(); | 352 isolate->heap()->CollectAllGarbage(); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 RawObject* Symbols::GetPredefinedSymbol(intptr_t object_id) { | 693 RawObject* Symbols::GetPredefinedSymbol(intptr_t object_id) { |
690 ASSERT(IsPredefinedSymbolId(object_id)); | 694 ASSERT(IsPredefinedSymbolId(object_id)); |
691 intptr_t i = (object_id - kMaxPredefinedObjectIds); | 695 intptr_t i = (object_id - kMaxPredefinedObjectIds); |
692 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { | 696 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { |
693 return symbol_handles_[i]->raw(); | 697 return symbol_handles_[i]->raw(); |
694 } | 698 } |
695 return Object::null(); | 699 return Object::null(); |
696 } | 700 } |
697 | 701 |
698 } // namespace dart | 702 } // namespace dart |
OLD | NEW |