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

Unified Diff: runtime/vm/symbols.cc

Issue 428273002: Handle-like interface for HashTable. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/symbols.cc
===================================================================
--- runtime/vm/symbols.cc (revision 38793)
+++ runtime/vm/symbols.cc (working copy)
@@ -217,7 +217,7 @@
void Symbols::GetStats(Isolate* isolate, intptr_t* size, intptr_t* capacity) {
ASSERT(isolate != NULL);
- SymbolTable table(Array::Handle(isolate->object_store()->symbol_table()));
+ SymbolTable table(isolate, isolate->object_store()->symbol_table());
*size = table.NumOccupied();
*capacity = table.NumEntries();
table.Release();
@@ -228,13 +228,11 @@
// Should only be run by the vm isolate.
ASSERT(Isolate::Current() == Dart::vm_isolate());
Isolate* isolate = Dart::vm_isolate();
- Array& array = Array::Handle(isolate->object_store()->symbol_table());
- SymbolTable table(array);
+ SymbolTable table(isolate, isolate->object_store()->symbol_table());
bool present = table.Insert(str);
str.SetCanonical();
ASSERT(!present);
- isolate->object_store()->set_symbol_table(array);
- table.Release();
+ isolate->object_store()->set_symbol_table(table.Release());
}
@@ -283,21 +281,18 @@
// StringType can be StringSlice, Latin1Array, UTF16Array or UTF32Array.
template<typename StringType>
RawString* Symbols::NewSymbol(const StringType& str) {
- String& symbol = String::Handle();
+ Isolate* isolate = Isolate::Current();
+ String& symbol = String::Handle(isolate);
{
- Isolate* isolate = Dart::vm_isolate();
- Array& array = Array::Handle(isolate->object_store()->symbol_table());
- SymbolTable table(array);
+ Isolate* vm_isolate = Dart::vm_isolate();
+ SymbolTable table(isolate, vm_isolate->object_store()->symbol_table());
symbol ^= table.GetOrNull(str);
table.Release();
}
if (symbol.IsNull()) {
- Isolate* isolate = Isolate::Current();
- Array& array = Array::Handle(isolate->object_store()->symbol_table());
- SymbolTable table(array);
+ SymbolTable table(isolate, isolate->object_store()->symbol_table());
symbol ^= table.InsertNewOrGet(str);
- isolate->object_store()->set_symbol_table(array);
- table.Release();
+ isolate->object_store()->set_symbol_table(table.Release());
}
ASSERT(symbol.IsSymbol());
return symbol.raw();
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698