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

Side by Side Diff: runtime/vm/symbols.cc

Issue 474033002: Ensure that hash for a symbol is not set to 0 when it is made external. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 SymbolTable table(isolate, vm_isolate->object_store()->symbol_table()); 326 SymbolTable table(isolate, vm_isolate->object_store()->symbol_table());
327 symbol ^= table.GetOrNull(str); 327 symbol ^= table.GetOrNull(str);
328 table.Release(); 328 table.Release();
329 } 329 }
330 if (symbol.IsNull()) { 330 if (symbol.IsNull()) {
331 SymbolTable table(isolate, isolate->object_store()->symbol_table()); 331 SymbolTable table(isolate, isolate->object_store()->symbol_table());
332 symbol ^= table.InsertNewOrGet(str); 332 symbol ^= table.InsertNewOrGet(str);
333 isolate->object_store()->set_symbol_table(table.Release()); 333 isolate->object_store()->set_symbol_table(table.Release());
334 } 334 }
335 ASSERT(symbol.IsSymbol()); 335 ASSERT(symbol.IsSymbol());
336 ASSERT(symbol.HasHash());
336 return symbol.raw(); 337 return symbol.raw();
337 } 338 }
338 339
339 340
340 RawString* Symbols::New(const String& str) { 341 RawString* Symbols::New(const String& str) {
341 if (str.IsSymbol()) { 342 if (str.IsSymbol()) {
342 return str.raw(); 343 return str.raw();
343 } 344 }
344 return New(str, 0, str.Length()); 345 return New(str, 0, str.Length());
345 } 346 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { 390 RawObject* Symbols::GetVMSymbol(intptr_t object_id) {
390 ASSERT(IsVMSymbolId(object_id)); 391 ASSERT(IsVMSymbolId(object_id));
391 intptr_t i = (object_id - kMaxPredefinedObjectIds); 392 intptr_t i = (object_id - kMaxPredefinedObjectIds);
392 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { 393 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) {
393 return symbol_handles_[i]->raw(); 394 return symbol_handles_[i]->raw();
394 } 395 }
395 return Object::null(); 396 return Object::null();
396 } 397 }
397 398
398 } // namespace dart 399 } // namespace dart
OLDNEW
« 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