| 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/handles_impl.h" | 8 #include "vm/handles_impl.h" |
| 9 #include "vm/hash_table.h" | 9 #include "vm/hash_table.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 379 |
| 380 | 380 |
| 381 RawString* Symbols::FromConcat(const String& str1, const String& str2) { | 381 RawString* Symbols::FromConcat(const String& str1, const String& str2) { |
| 382 return NewSymbol(ConcatString(str1, str2)); | 382 return NewSymbol(ConcatString(str1, str2)); |
| 383 } | 383 } |
| 384 | 384 |
| 385 | 385 |
| 386 // StringType can be StringSlice, ConcatString, or {Latin1,UTF16,UTF32}Array. | 386 // StringType can be StringSlice, ConcatString, or {Latin1,UTF16,UTF32}Array. |
| 387 template<typename StringType> | 387 template<typename StringType> |
| 388 RawString* Symbols::NewSymbol(const StringType& str) { | 388 RawString* Symbols::NewSymbol(const StringType& str) { |
| 389 Isolate* isolate = Isolate::Current(); | 389 Thread* thread = Thread::Current(); |
| 390 String& symbol = String::Handle(isolate); | 390 Isolate* isolate = thread->isolate(); |
| 391 String& symbol = String::Handle(thread->zone()); |
| 391 { | 392 { |
| 392 Isolate* vm_isolate = Dart::vm_isolate(); | 393 Isolate* vm_isolate = Dart::vm_isolate(); |
| 393 SymbolTable table(isolate, vm_isolate->object_store()->symbol_table()); | 394 SymbolTable table(isolate, vm_isolate->object_store()->symbol_table()); |
| 394 symbol ^= table.GetOrNull(str); | 395 symbol ^= table.GetOrNull(str); |
| 395 table.Release(); | 396 table.Release(); |
| 396 } | 397 } |
| 397 if (symbol.IsNull()) { | 398 if (symbol.IsNull()) { |
| 398 SymbolTable table(isolate, isolate->object_store()->symbol_table()); | 399 SymbolTable table(isolate, isolate->object_store()->symbol_table()); |
| 399 symbol ^= table.InsertNewOrGet(str); | 400 symbol ^= table.InsertNewOrGet(str); |
| 400 isolate->object_store()->set_symbol_table(table.Release()); | 401 isolate->object_store()->set_symbol_table(table.Release()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { | 458 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { |
| 458 ASSERT(IsVMSymbolId(object_id)); | 459 ASSERT(IsVMSymbolId(object_id)); |
| 459 intptr_t i = (object_id - kMaxPredefinedObjectIds); | 460 intptr_t i = (object_id - kMaxPredefinedObjectIds); |
| 460 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { | 461 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { |
| 461 return symbol_handles_[i]->raw(); | 462 return symbol_handles_[i]->raw(); |
| 462 } | 463 } |
| 463 return Object::null(); | 464 return Object::null(); |
| 464 } | 465 } |
| 465 | 466 |
| 466 } // namespace dart | 467 } // namespace dart |
| OLD | NEW |