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 #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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 static RawClass* context_scope_class() { return context_scope_class_; } | 278 static RawClass* context_scope_class() { return context_scope_class_; } |
279 static RawClass* api_error_class() { return api_error_class_; } | 279 static RawClass* api_error_class() { return api_error_class_; } |
280 static RawClass* language_error_class() { return language_error_class_; } | 280 static RawClass* language_error_class() { return language_error_class_; } |
281 static RawClass* unhandled_exception_class() { | 281 static RawClass* unhandled_exception_class() { |
282 return unhandled_exception_class_; | 282 return unhandled_exception_class_; |
283 } | 283 } |
284 static RawClass* unwind_error_class() { return unwind_error_class_; } | 284 static RawClass* unwind_error_class() { return unwind_error_class_; } |
285 static RawClass* icdata_class() { return icdata_class_; } | 285 static RawClass* icdata_class() { return icdata_class_; } |
286 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; } | 286 static RawClass* subtypetestcache_class() { return subtypetestcache_class_; } |
287 | 287 |
288 static RawClass* CreateAndRegisterInterface(const char* cname, | |
289 const Script& script, | |
290 const Library& lib); | |
291 static void RegisterClass(const Class& cls, | |
292 const char* cname, | |
293 const Script& script, | |
294 const Library& lib); | |
295 | |
296 static void RegisterPrivateClass(const Class& cls, | |
297 const char* cname, | |
298 const Script& script, | |
299 const Library& lib); | |
300 | |
301 static RawError* Init(Isolate* isolate); | 288 static RawError* Init(Isolate* isolate); |
302 static void InitFromSnapshot(Isolate* isolate); | 289 static void InitFromSnapshot(Isolate* isolate); |
303 static void InitOnce(); | 290 static void InitOnce(); |
304 static void RegisterSingletonClassNames(); | 291 static void RegisterSingletonClassNames(); |
305 | 292 |
306 static intptr_t InstanceSize() { | 293 static intptr_t InstanceSize() { |
307 return RoundedAllocationSize(sizeof(RawObject)); | 294 return RoundedAllocationSize(sizeof(RawObject)); |
308 } | 295 } |
309 | 296 |
310 static const ClassId kClassId = kObjectCid; | 297 static const ClassId kClassId = kObjectCid; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 uword ptr = reinterpret_cast<uword>(addr); | 345 uword ptr = reinterpret_cast<uword>(addr); |
359 Isolate::Current()->store_buffer()->AddPointer(ptr); | 346 Isolate::Current()->store_buffer()->AddPointer(ptr); |
360 } | 347 } |
361 } | 348 } |
362 | 349 |
363 RawObject* raw_; // The raw object reference. | 350 RawObject* raw_; // The raw object reference. |
364 | 351 |
365 private: | 352 private: |
366 static void InitializeObject(uword address, intptr_t id, intptr_t size); | 353 static void InitializeObject(uword address, intptr_t id, intptr_t size); |
367 | 354 |
| 355 static RawClass* CreateAndRegisterInterface(const char* cname, |
| 356 const Script& script, |
| 357 const Library& lib); |
| 358 static void RegisterClass(const Class& cls, |
| 359 const char* cname, |
| 360 const Library& lib); |
| 361 static void RegisterPrivateClass(const Class& cls, |
| 362 const char* cname, |
| 363 const Library& lib); |
| 364 |
368 cpp_vtable* vtable_address() const { | 365 cpp_vtable* vtable_address() const { |
369 uword vtable_addr = reinterpret_cast<uword>(this); | 366 uword vtable_addr = reinterpret_cast<uword>(this); |
370 return reinterpret_cast<cpp_vtable*>(vtable_addr); | 367 return reinterpret_cast<cpp_vtable*>(vtable_addr); |
371 } | 368 } |
372 | 369 |
373 static cpp_vtable handle_vtable_; | 370 static cpp_vtable handle_vtable_; |
374 static cpp_vtable builtin_vtables_[kNumPredefinedCids]; | 371 static cpp_vtable builtin_vtables_[kNumPredefinedCids]; |
375 | 372 |
376 // The static values below are singletons shared between the different | 373 // The static values below are singletons shared between the different |
377 // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_. | 374 // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 intptr_t id() const { return raw_ptr()->id_; } | 454 intptr_t id() const { return raw_ptr()->id_; } |
458 void set_id(intptr_t value) const { | 455 void set_id(intptr_t value) const { |
459 raw_ptr()->id_ = value; | 456 raw_ptr()->id_ = value; |
460 } | 457 } |
461 | 458 |
462 RawString* Name() const; | 459 RawString* Name() const; |
463 | 460 |
464 RawString* UserVisibleName() const; | 461 RawString* UserVisibleName() const; |
465 | 462 |
466 RawScript* script() const { return raw_ptr()->script_; } | 463 RawScript* script() const { return raw_ptr()->script_; } |
| 464 void set_script(const Script& value) const; |
467 | 465 |
468 intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 466 intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
469 | 467 |
470 // This class represents the signature class of a closure function if | 468 // This class represents the signature class of a closure function if |
471 // signature_function() is not null. | 469 // signature_function() is not null. |
472 // The associated function may be a closure function (with code) or a | 470 // The associated function may be a closure function (with code) or a |
473 // signature function (without code) solely describing the result type and | 471 // signature function (without code) solely describing the result type and |
474 // parameter types of the signature. | 472 // parameter types of the signature. |
475 RawFunction* signature_function() const { | 473 RawFunction* signature_function() const { |
476 return raw_ptr()->signature_function_; | 474 return raw_ptr()->signature_function_; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 const Function& signature_function, | 703 const Function& signature_function, |
706 const Script& script); | 704 const Script& script); |
707 | 705 |
708 // Return a class object corresponding to the specified kind. If | 706 // Return a class object corresponding to the specified kind. If |
709 // a canonicalized version of it exists then that object is returned | 707 // a canonicalized version of it exists then that object is returned |
710 // otherwise a new object is allocated and returned. | 708 // otherwise a new object is allocated and returned. |
711 static RawClass* GetClass(intptr_t class_id, bool is_signature_class); | 709 static RawClass* GetClass(intptr_t class_id, bool is_signature_class); |
712 | 710 |
713 private: | 711 private: |
714 void set_name(const String& value) const; | 712 void set_name(const String& value) const; |
715 void set_script(const Script& value) const; | |
716 void set_token_pos(intptr_t value) const; | 713 void set_token_pos(intptr_t value) const; |
717 void set_signature_function(const Function& value) const; | 714 void set_signature_function(const Function& value) const; |
718 void set_signature_type(const AbstractType& value) const; | 715 void set_signature_type(const AbstractType& value) const; |
719 void set_class_state(int8_t state) const; | 716 void set_class_state(int8_t state) const; |
720 | 717 |
721 void set_constants(const Array& value) const; | 718 void set_constants(const Array& value) const; |
722 | 719 |
723 void set_canonical_types(const Array& value) const; | 720 void set_canonical_types(const Array& value) const; |
724 RawArray* canonical_types() const; | 721 RawArray* canonical_types() const; |
725 | 722 |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 intptr_t token_pos) const; | 1985 intptr_t token_pos) const; |
1989 | 1986 |
1990 // Resolving native methods for script loaded in the library. | 1987 // Resolving native methods for script loaded in the library. |
1991 Dart_NativeEntryResolver native_entry_resolver() const { | 1988 Dart_NativeEntryResolver native_entry_resolver() const { |
1992 return raw_ptr()->native_entry_resolver_; | 1989 return raw_ptr()->native_entry_resolver_; |
1993 } | 1990 } |
1994 void set_native_entry_resolver(Dart_NativeEntryResolver value) const { | 1991 void set_native_entry_resolver(Dart_NativeEntryResolver value) const { |
1995 raw_ptr()->native_entry_resolver_ = value; | 1992 raw_ptr()->native_entry_resolver_ = value; |
1996 } | 1993 } |
1997 | 1994 |
1998 RawError* Patch(const String& url, const String& source) const; | 1995 RawError* Patch(const Script& script) const; |
1999 | 1996 |
2000 RawString* PrivateName(const String& name) const; | 1997 RawString* PrivateName(const String& name) const; |
2001 | 1998 |
2002 intptr_t index() const { return raw_ptr()->index_; } | 1999 intptr_t index() const { return raw_ptr()->index_; } |
2003 void set_index(intptr_t value) const { | 2000 void set_index(intptr_t value) const { |
2004 raw_ptr()->index_ = value; | 2001 raw_ptr()->index_ = value; |
2005 } | 2002 } |
2006 | 2003 |
2007 void Register() const; | 2004 void Register() const; |
2008 | 2005 |
(...skipping 3443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5452 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5449 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
5453 return false; | 5450 return false; |
5454 } | 5451 } |
5455 } | 5452 } |
5456 return true; | 5453 return true; |
5457 } | 5454 } |
5458 | 5455 |
5459 } // namespace dart | 5456 } // namespace dart |
5460 | 5457 |
5461 #endif // VM_OBJECT_H_ | 5458 #endif // VM_OBJECT_H_ |
OLD | NEW |