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

Side by Side Diff: vm/object.h

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
« no previous file with comments | « vm/heap_profiler.cc ('k') | vm/object.cc » ('j') | 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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 static Object& ZoneHandle() { 229 static Object& ZoneHandle() {
230 return ZoneHandle(Isolate::Current(), null_); 230 return ZoneHandle(Isolate::Current(), null_);
231 } 231 }
232 232
233 static Object& ZoneHandle(RawObject* raw_ptr) { 233 static Object& ZoneHandle(RawObject* raw_ptr) {
234 return ZoneHandle(Isolate::Current(), raw_ptr); 234 return ZoneHandle(Isolate::Current(), raw_ptr);
235 } 235 }
236 236
237 static RawObject* null() { return null_; } 237 static RawObject* null() { return null_; }
238 static RawArray* empty_array() { return empty_array_; }
srdjan 2012/08/09 18:43:54 Maybe replace all Array::Empty() with Object::empt
siva 2012/08/10 00:37:05 Done.
238 239
239 // The sentinel is a value that cannot be produced by Dart code. 240 // The sentinel is a value that cannot be produced by Dart code.
240 // It can be used to mark special values, for example to distinguish 241 // It can be used to mark special values, for example to distinguish
241 // "uninitialized" fields. 242 // "uninitialized" fields.
242 static RawInstance* sentinel() { return sentinel_; } 243 static RawInstance* sentinel() { return sentinel_; }
243 // Value marking that we are transitioning from sentinel, e.g., computing 244 // Value marking that we are transitioning from sentinel, e.g., computing
244 // a field value. Used to detect circular initialization. 245 // a field value. Used to detect circular initialization.
245 static RawInstance* transition_sentinel() { return transition_sentinel_; } 246 static RawInstance* transition_sentinel() { return transition_sentinel_; }
246 247
247 static RawClass* class_class() { return class_class_; } 248 static RawClass* class_class() { return class_class_; }
(...skipping 29 matching lines...) Expand all
277 static RawClass* context_scope_class() { return context_scope_class_; } 278 static RawClass* context_scope_class() { return context_scope_class_; }
278 static RawClass* api_error_class() { return api_error_class_; } 279 static RawClass* api_error_class() { return api_error_class_; }
279 static RawClass* language_error_class() { return language_error_class_; } 280 static RawClass* language_error_class() { return language_error_class_; }
280 static RawClass* unhandled_exception_class() { 281 static RawClass* unhandled_exception_class() {
281 return unhandled_exception_class_; 282 return unhandled_exception_class_;
282 } 283 }
283 static RawClass* unwind_error_class() { return unwind_error_class_; } 284 static RawClass* unwind_error_class() { return unwind_error_class_; }
284 static RawClass* icdata_class() { return icdata_class_; } 285 static RawClass* icdata_class() { return icdata_class_; }
285 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; } 286 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; }
286 287
287 static const char* GetSingletonClassName(intptr_t class_id);
288
289 static RawClass* CreateAndRegisterInterface(const char* cname, 288 static RawClass* CreateAndRegisterInterface(const char* cname,
290 const Script& script, 289 const Script& script,
291 const Library& lib); 290 const Library& lib);
292 static void RegisterClass(const Class& cls, 291 static void RegisterClass(const Class& cls,
293 const char* cname, 292 const char* cname,
294 const Script& script, 293 const Script& script,
295 const Library& lib); 294 const Library& lib);
296 295
297 static void RegisterPrivateClass(const Class& cls, 296 static void RegisterPrivateClass(const Class& cls,
298 const char* cname, 297 const char* cname,
299 const Script& script, 298 const Script& script,
300 const Library& lib); 299 const Library& lib);
301 300
302 static RawError* Init(Isolate* isolate); 301 static RawError* Init(Isolate* isolate);
303 static void InitFromSnapshot(Isolate* isolate); 302 static void InitFromSnapshot(Isolate* isolate);
304 static void InitOnce(); 303 static void InitOnce();
304 static void RegisterSingletonClassNames();
305 305
306 static intptr_t InstanceSize() { 306 static intptr_t InstanceSize() {
307 return RoundedAllocationSize(sizeof(RawObject)); 307 return RoundedAllocationSize(sizeof(RawObject));
308 } 308 }
309 309
310 static const ClassId kClassId = kObjectCid; 310 static const ClassId kClassId = kObjectCid;
311 311
312 // Different kinds of type tests. 312 // Different kinds of type tests.
313 enum TypeTestKind { 313 enum TypeTestKind {
314 kIsSubtypeOf = 0, 314 kIsSubtypeOf = 0,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 uword vtable_addr = reinterpret_cast<uword>(this); 369 uword vtable_addr = reinterpret_cast<uword>(this);
370 return reinterpret_cast<cpp_vtable*>(vtable_addr); 370 return reinterpret_cast<cpp_vtable*>(vtable_addr);
371 } 371 }
372 372
373 static cpp_vtable handle_vtable_; 373 static cpp_vtable handle_vtable_;
374 static cpp_vtable builtin_vtables_[kNumPredefinedCids]; 374 static cpp_vtable builtin_vtables_[kNumPredefinedCids];
375 375
376 // The static values below are singletons shared between the different 376 // The static values below are singletons shared between the different
377 // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_. 377 // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_.
378 static RawObject* null_; 378 static RawObject* null_;
379 static RawArray* empty_array_;
379 static RawInstance* sentinel_; 380 static RawInstance* sentinel_;
380 static RawInstance* transition_sentinel_; 381 static RawInstance* transition_sentinel_;
381 382
382 static RawClass* class_class_; // Class of the Class vm object. 383 static RawClass* class_class_; // Class of the Class vm object.
383 static RawClass* null_class_; // Class of the null object. 384 static RawClass* null_class_; // Class of the null object.
384 static RawClass* dynamic_class_; // Class of the 'Dynamic' type. 385 static RawClass* dynamic_class_; // Class of the 'Dynamic' type.
385 static RawClass* void_class_; // Class of the 'void' type. 386 static RawClass* void_class_; // Class of the 'void' type.
386 static RawClass* unresolved_class_class_; // Class of UnresolvedClass. 387 static RawClass* unresolved_class_class_; // Class of UnresolvedClass.
387 static RawClass* type_class_; // Class of Type. 388 static RawClass* type_class_; // Class of Type.
388 static RawClass* type_parameter_class_; // Class of TypeParameter vm object. 389 static RawClass* type_parameter_class_; // Class of TypeParameter vm object.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 681
681 RawCode* allocation_stub() const { 682 RawCode* allocation_stub() const {
682 return raw_ptr()->allocation_stub_; 683 return raw_ptr()->allocation_stub_;
683 } 684 }
684 void set_allocation_stub(const Code& value) const; 685 void set_allocation_stub(const Code& value) const;
685 686
686 RawArray* constants() const; 687 RawArray* constants() const;
687 688
688 void Finalize() const; 689 void Finalize() const;
689 690
691 // Initialize the functions cache array.
692 void InitFunctionsCache() const;
693
690 // Allocate a class used for VM internal objects. 694 // Allocate a class used for VM internal objects.
691 template <class FakeObject> static RawClass* New(); 695 template <class FakeObject> static RawClass* New();
692 696
693 // Allocate instance classes and interfaces. 697 // Allocate instance classes and interfaces.
694 static RawClass* New(const String& name, 698 static RawClass* New(const String& name,
695 const Script& script, 699 const Script& script,
696 intptr_t token_pos); 700 intptr_t token_pos);
697 static RawClass* NewInterface(const String& name, 701 static RawClass* NewInterface(const String& name,
698 const Script& script, 702 const Script& script,
699 intptr_t token_pos); 703 intptr_t token_pos);
(...skipping 4719 matching lines...) Expand 10 before | Expand all | Expand 10 after
5419 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5423 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5420 return false; 5424 return false;
5421 } 5425 }
5422 } 5426 }
5423 return true; 5427 return true;
5424 } 5428 }
5425 5429
5426 } // namespace dart 5430 } // namespace dart
5427 5431
5428 #endif // VM_OBJECT_H_ 5432 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/heap_profiler.cc ('k') | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698