| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 kTokenStreamClass, | 132 kTokenStreamClass, |
| 133 kScriptClass, | 133 kScriptClass, |
| 134 kLibraryClass, | 134 kLibraryClass, |
| 135 kLibraryPrefixClass, | 135 kLibraryPrefixClass, |
| 136 kCodeClass, | 136 kCodeClass, |
| 137 kInstructionsClass, | 137 kInstructionsClass, |
| 138 kPcDescriptorsClass, | 138 kPcDescriptorsClass, |
| 139 kExceptionHandlersClass, | 139 kExceptionHandlersClass, |
| 140 kContextClass, | 140 kContextClass, |
| 141 kContextScopeClass, | 141 kContextScopeClass, |
| 142 kApiFailureClass, |
| 142 kMaxId, | 143 kMaxId, |
| 143 kInvalidIndex = -1, | 144 kInvalidIndex = -1, |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 virtual ~Object() { } | 147 virtual ~Object() { } |
| 147 | 148 |
| 148 RawObject* raw() const { return raw_; } | 149 RawObject* raw() const { return raw_; } |
| 149 void operator=(RawObject* value) { SetRaw(value); } | 150 void operator=(RawObject* value) { SetRaw(value); } |
| 150 | 151 |
| 151 inline RawClass* clazz() const; | 152 inline RawClass* clazz() const; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 static RawClass* library_class() { return library_class_; } | 232 static RawClass* library_class() { return library_class_; } |
| 232 static RawClass* library_prefix_class() { return library_prefix_class_; } | 233 static RawClass* library_prefix_class() { return library_prefix_class_; } |
| 233 static RawClass* code_class() { return code_class_; } | 234 static RawClass* code_class() { return code_class_; } |
| 234 static RawClass* instructions_class() { return instructions_class_; } | 235 static RawClass* instructions_class() { return instructions_class_; } |
| 235 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } | 236 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } |
| 236 static RawClass* exception_handlers_class() { | 237 static RawClass* exception_handlers_class() { |
| 237 return exception_handlers_class_; | 238 return exception_handlers_class_; |
| 238 } | 239 } |
| 239 static RawClass* context_class() { return context_class_; } | 240 static RawClass* context_class() { return context_class_; } |
| 240 static RawClass* context_scope_class() { return context_scope_class_; } | 241 static RawClass* context_scope_class() { return context_scope_class_; } |
| 242 static RawClass* api_failure_class() { return api_failure_class_; } |
| 241 | 243 |
| 242 static int GetSingletonClassIndex(const RawClass* raw_class); | 244 static int GetSingletonClassIndex(const RawClass* raw_class); |
| 243 static RawClass* GetSingletonClass(int index); | 245 static RawClass* GetSingletonClass(int index); |
| 244 static const char* GetSingletonClassName(int index); | 246 static const char* GetSingletonClassName(int index); |
| 245 | 247 |
| 246 static void Init(Isolate* isolate); | 248 static void Init(Isolate* isolate); |
| 247 static void InitFromSnapshot(Isolate* isolate); | 249 static void InitFromSnapshot(Isolate* isolate); |
| 248 static void InitOnce(); | 250 static void InitOnce(); |
| 249 | 251 |
| 250 static intptr_t InstanceSize() { | 252 static intptr_t InstanceSize() { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 static RawClass* token_stream_class_; // Class of the TokenStream vm object. | 325 static RawClass* token_stream_class_; // Class of the TokenStream vm object. |
| 324 static RawClass* script_class_; // Class of the Script vm object. | 326 static RawClass* script_class_; // Class of the Script vm object. |
| 325 static RawClass* library_class_; // Class of the Library vm object. | 327 static RawClass* library_class_; // Class of the Library vm object. |
| 326 static RawClass* library_prefix_class_; // Class of Library prefix vm object. | 328 static RawClass* library_prefix_class_; // Class of Library prefix vm object. |
| 327 static RawClass* code_class_; // Class of the Code vm object. | 329 static RawClass* code_class_; // Class of the Code vm object. |
| 328 static RawClass* instructions_class_; // Class of the Instructions vm object. | 330 static RawClass* instructions_class_; // Class of the Instructions vm object. |
| 329 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. | 331 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. |
| 330 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. | 332 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. |
| 331 static RawClass* context_class_; // Class of the Context vm object. | 333 static RawClass* context_class_; // Class of the Context vm object. |
| 332 static RawClass* context_scope_class_; // Class of ContextScope vm object. | 334 static RawClass* context_scope_class_; // Class of ContextScope vm object. |
| 335 static RawClass* api_failure_class_; // Class of ApiFailure. |
| 333 | 336 |
| 334 friend class Class; | 337 friend class Class; |
| 335 | 338 |
| 336 // Disallow allocation. | 339 // Disallow allocation. |
| 337 void* operator new(size_t size); | 340 void* operator new(size_t size); |
| 338 // Disallow copy constructor. | 341 // Disallow copy constructor. |
| 339 DISALLOW_COPY_AND_ASSIGN(Object); | 342 DISALLOW_COPY_AND_ASSIGN(Object); |
| 340 }; | 343 }; |
| 341 | 344 |
| 342 | 345 |
| (...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 | 1980 |
| 1978 private: | 1981 private: |
| 1979 void set_exception(const Instance& exception) const; | 1982 void set_exception(const Instance& exception) const; |
| 1980 void set_stacktrace(const Instance& stacktrace) const; | 1983 void set_stacktrace(const Instance& stacktrace) const; |
| 1981 | 1984 |
| 1982 HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Object); | 1985 HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Object); |
| 1983 friend class Class; | 1986 friend class Class; |
| 1984 }; | 1987 }; |
| 1985 | 1988 |
| 1986 | 1989 |
| 1990 class ApiFailure : public Object { |
| 1991 public: |
| 1992 RawString* message() const { return raw_ptr()->message_; } |
| 1993 static intptr_t message_offset() { |
| 1994 return OFFSET_OF(RawApiFailure, message_); |
| 1995 } |
| 1996 |
| 1997 static intptr_t InstanceSize() { |
| 1998 return RoundedAllocationSize(sizeof(RawApiFailure)); |
| 1999 } |
| 2000 |
| 2001 static RawApiFailure* New(const String& message, |
| 2002 Heap::Space space = Heap::kNew); |
| 2003 |
| 2004 private: |
| 2005 void set_message(const String& message) const; |
| 2006 |
| 2007 HEAP_OBJECT_IMPLEMENTATION(ApiFailure, Object); |
| 2008 friend class Class; |
| 2009 }; |
| 2010 |
| 2011 |
| 1987 // Instance is the base class for all instance objects (aka the Object class | 2012 // Instance is the base class for all instance objects (aka the Object class |
| 1988 // in Dart source code. | 2013 // in Dart source code. |
| 1989 class Instance : public Object { | 2014 class Instance : public Object { |
| 1990 public: | 2015 public: |
| 1991 virtual bool Equals(const Instance& other) const; | 2016 virtual bool Equals(const Instance& other) const; |
| 1992 virtual RawInstance* Canonicalize() const; | 2017 virtual RawInstance* Canonicalize() const; |
| 1993 | 2018 |
| 1994 RawObject* GetField(const Field& field) const { | 2019 RawObject* GetField(const Field& field) const { |
| 1995 return *FieldAddr(field); | 2020 return *FieldAddr(field); |
| 1996 } | 2021 } |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2877 } | 2902 } |
| 2878 | 2903 |
| 2879 | 2904 |
| 2880 void Context::SetAt(intptr_t index, const Instance& value) const { | 2905 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 2881 StorePointer(InstanceAddr(index), value.raw()); | 2906 StorePointer(InstanceAddr(index), value.raw()); |
| 2882 } | 2907 } |
| 2883 | 2908 |
| 2884 } // namespace dart | 2909 } // namespace dart |
| 2885 | 2910 |
| 2886 #endif // VM_OBJECT_H_ | 2911 #endif // VM_OBJECT_H_ |
| OLD | NEW |