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

Unified Diff: runtime/vm/symbols.cc

Issue 1292433004: Migrate to Zone-based handle allocation in hash table and symbol table. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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/hash_table.h ('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
diff --git a/runtime/vm/symbols.cc b/runtime/vm/symbols.cc
index 7cafda2542bb1e98851bb50d4ea94525b2fc0fe7..6e7c6d3c9c154ea0f792a0ac9fca81469cdb3f08 100644
--- a/runtime/vm/symbols.cc
+++ b/runtime/vm/symbols.cc
@@ -197,6 +197,7 @@ void Symbols::InitOnce(Isolate* vm_isolate) {
// Should only be run by the vm isolate.
ASSERT(Isolate::Current() == Dart::vm_isolate());
ASSERT(vm_isolate == Dart::vm_isolate());
+ Zone* zone = Thread::Current()->zone();
// Create and setup a symbol table in the vm isolate.
SetupSymbolTable(vm_isolate);
@@ -204,7 +205,7 @@ void Symbols::InitOnce(Isolate* vm_isolate) {
// Create all predefined symbols.
ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kNullCharId);
- SymbolTable table(vm_isolate, vm_isolate->object_store()->symbol_table());
+ SymbolTable table(zone, vm_isolate->object_store()->symbol_table());
// First set up all the predefined string symbols.
// Create symbols for language keywords. Some keywords are equal to
@@ -244,8 +245,9 @@ void Symbols::InitOnceFromSnapshot(Isolate* vm_isolate) {
// Should only be run by the vm isolate.
ASSERT(Isolate::Current() == Dart::vm_isolate());
ASSERT(vm_isolate == Dart::vm_isolate());
+ Zone* zone = Thread::Current()->zone();
- SymbolTable table(vm_isolate, vm_isolate->object_store()->symbol_table());
+ SymbolTable table(zone, vm_isolate->object_store()->symbol_table());
// Lookup all the predefined string symbols and language keyword symbols
// and cache them in the read only handles for fast access.
@@ -282,11 +284,13 @@ void Symbols::InitOnceFromSnapshot(Isolate* vm_isolate) {
void Symbols::AddPredefinedSymbolsToIsolate() {
// Should only be run by regular Dart isolates.
- Isolate* isolate = Isolate::Current();
+ Thread* thread = Thread::Current();
+ Isolate* isolate = thread->isolate();
+ Zone* zone = thread->zone();
ASSERT(isolate != Dart::vm_isolate());
String& str = String::Handle(isolate);
- SymbolTable table(isolate, isolate->object_store()->symbol_table());
+ SymbolTable table(zone, isolate->object_store()->symbol_table());
// Set up all the predefined string symbols and create symbols for
// language keywords.
@@ -329,7 +333,7 @@ void Symbols::SetupSymbolTable(Isolate* isolate) {
void Symbols::GetStats(Isolate* isolate, intptr_t* size, intptr_t* capacity) {
ASSERT(isolate != NULL);
- SymbolTable table(isolate, isolate->object_store()->symbol_table());
+ SymbolTable table(isolate->object_store()->symbol_table());
*size = table.NumOccupied();
*capacity = table.NumEntries();
table.Release();
@@ -386,16 +390,18 @@ RawString* Symbols::FromConcat(const String& str1, const String& str2) {
// StringType can be StringSlice, ConcatString, or {Latin1,UTF16,UTF32}Array.
template<typename StringType>
RawString* Symbols::NewSymbol(const StringType& str) {
- Isolate* isolate = Isolate::Current();
+ Thread* thread = Thread::Current();
+ Isolate* isolate = thread->isolate();
+ Zone* zone = thread->zone();
String& symbol = String::Handle(isolate);
{
Isolate* vm_isolate = Dart::vm_isolate();
- SymbolTable table(isolate, vm_isolate->object_store()->symbol_table());
+ SymbolTable table(zone, vm_isolate->object_store()->symbol_table());
symbol ^= table.GetOrNull(str);
table.Release();
}
if (symbol.IsNull()) {
- SymbolTable table(isolate, isolate->object_store()->symbol_table());
+ SymbolTable table(zone, isolate->object_store()->symbol_table());
symbol ^= table.InsertNewOrGet(str);
isolate->object_store()->set_symbol_table(table.Release());
}
« no previous file with comments | « runtime/vm/hash_table.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698