| 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 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 | 1946 |
| 1944 private: | 1947 private: |
| 1945 void set_exception(const Instance& exception) const; | 1948 void set_exception(const Instance& exception) const; |
| 1946 void set_stacktrace(const Instance& stacktrace) const; | 1949 void set_stacktrace(const Instance& stacktrace) const; |
| 1947 | 1950 |
| 1948 HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Object); | 1951 HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Object); |
| 1949 friend class Class; | 1952 friend class Class; |
| 1950 }; | 1953 }; |
| 1951 | 1954 |
| 1952 | 1955 |
| 1956 class ApiFailure : public Object { |
| 1957 public: |
| 1958 RawString* message() const { return raw_ptr()->message_; } |
| 1959 static intptr_t message_offset() { |
| 1960 return OFFSET_OF(RawApiFailure, message_); |
| 1961 } |
| 1962 |
| 1963 static intptr_t InstanceSize() { |
| 1964 return RoundedAllocationSize(sizeof(RawApiFailure)); |
| 1965 } |
| 1966 |
| 1967 static RawApiFailure* New(const String& message, |
| 1968 Heap::Space space = Heap::kNew); |
| 1969 |
| 1970 private: |
| 1971 void set_message(const String& message) const; |
| 1972 |
| 1973 HEAP_OBJECT_IMPLEMENTATION(ApiFailure, Object); |
| 1974 friend class Class; |
| 1975 }; |
| 1976 |
| 1977 |
| 1953 // Instance is the base class for all instance objects (aka the Object class | 1978 // Instance is the base class for all instance objects (aka the Object class |
| 1954 // in Dart source code. | 1979 // in Dart source code. |
| 1955 class Instance : public Object { | 1980 class Instance : public Object { |
| 1956 public: | 1981 public: |
| 1957 virtual bool Equals(const Instance& other) const; | 1982 virtual bool Equals(const Instance& other) const; |
| 1958 virtual RawInstance* Canonicalize() const; | 1983 virtual RawInstance* Canonicalize() const; |
| 1959 | 1984 |
| 1960 RawObject* GetField(const Field& field) const { | 1985 RawObject* GetField(const Field& field) const { |
| 1961 return *FieldAddr(field); | 1986 return *FieldAddr(field); |
| 1962 } | 1987 } |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 } | 2868 } |
| 2844 | 2869 |
| 2845 | 2870 |
| 2846 void Context::SetAt(intptr_t index, const Instance& value) const { | 2871 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 2847 StorePointer(InstanceAddr(index), value.raw()); | 2872 StorePointer(InstanceAddr(index), value.raw()); |
| 2848 } | 2873 } |
| 2849 | 2874 |
| 2850 } // namespace dart | 2875 } // namespace dart |
| 2851 | 2876 |
| 2852 #endif // VM_OBJECT_H_ | 2877 #endif // VM_OBJECT_H_ |
| OLD | NEW |