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

Side by Side Diff: vm/symbols.cc

Issue 10827249: - Register canonical names for internal VM classes and get rid of the method GetSingletonClassName (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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
« vm/object.h ('K') | « vm/symbols.h ('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/isolate.h" 7 #include "vm/isolate.h"
8 #include "vm/object.h" 8 #include "vm/object.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 #include "vm/raw_object.h" 10 #include "vm/raw_object.h"
(...skipping 30 matching lines...) Expand all
41 ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kMaxId); 41 ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kMaxId);
42 const Array& symbol_table = 42 const Array& symbol_table =
43 Array::Handle(isolate->object_store()->symbol_table()); 43 Array::Handle(isolate->object_store()->symbol_table());
44 OneByteString& str = OneByteString::Handle(); 44 OneByteString& str = OneByteString::Handle();
45 45
46 for (intptr_t i = 1; i < Symbols::kMaxId; i++) { 46 for (intptr_t i = 1; i < Symbols::kMaxId; i++) {
47 str = OneByteString::New(names[i], Heap::kOld); 47 str = OneByteString::New(names[i], Heap::kOld);
48 Add(symbol_table, str); 48 Add(symbol_table, str);
49 predefined_[i] = str.raw(); 49 predefined_[i] = str.raw();
50 } 50 }
51 Object::RegisterSingletonClassNames();
51 } 52 }
52 53
53 54
54 void Symbols::SetupSymbolTable(Isolate* isolate) { 55 void Symbols::SetupSymbolTable(Isolate* isolate) {
55 ASSERT(isolate != NULL); 56 ASSERT(isolate != NULL);
56 57
57 // Setup the symbol table used within the String class. 58 // Setup the symbol table used within the String class.
58 const int initial_size = (isolate == Dart::vm_isolate()) ? 59 const int initial_size = (isolate == Dart::vm_isolate()) ?
59 kInitialVMIsolateSymtabSize : kInitialSymtabSize; 60 kInitialVMIsolateSymtabSize : kInitialSymtabSize;
60 const Array& array = Array::Handle(Array::New(initial_size + 1)); 61 const Array& array = Array::Handle(Array::New(initial_size + 1));
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 306 }
306 307
307 308
308 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { 309 RawObject* Symbols::GetVMSymbol(intptr_t object_id) {
309 ASSERT(IsVMSymbolId(object_id)); 310 ASSERT(IsVMSymbolId(object_id));
310 intptr_t i = (object_id - kMaxPredefinedObjectIds); 311 intptr_t i = (object_id - kMaxPredefinedObjectIds);
311 return (i > 0 && i < Symbols::kMaxId) ? predefined_[i] : Object::null(); 312 return (i > 0 && i < Symbols::kMaxId) ? predefined_[i] : Object::null();
312 } 313 }
313 314
314 } // namespace dart 315 } // namespace dart
OLDNEW
« vm/object.h ('K') | « vm/symbols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698