| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 kInstantiatedTypeArgumentsClass, | 131 kInstantiatedTypeArgumentsClass, |
| 132 kFunctionClass, | 132 kFunctionClass, |
| 133 kFieldClass, | 133 kFieldClass, |
| 134 kTokenStreamClass, | 134 kTokenStreamClass, |
| 135 kScriptClass, | 135 kScriptClass, |
| 136 kLibraryClass, | 136 kLibraryClass, |
| 137 kLibraryPrefixClass, | 137 kLibraryPrefixClass, |
| 138 kCodeClass, | 138 kCodeClass, |
| 139 kInstructionsClass, | 139 kInstructionsClass, |
| 140 kPcDescriptorsClass, | 140 kPcDescriptorsClass, |
| 141 kLocalVarDescriptorsClass, |
| 141 kExceptionHandlersClass, | 142 kExceptionHandlersClass, |
| 142 kContextClass, | 143 kContextClass, |
| 143 kContextScopeClass, | 144 kContextScopeClass, |
| 144 kApiErrorClass, | 145 kApiErrorClass, |
| 145 kMaxId, | 146 kMaxId, |
| 146 kInvalidIndex = -1, | 147 kInvalidIndex = -1, |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 virtual ~Object() { } | 150 virtual ~Object() { } |
| 150 | 151 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 250 } |
| 250 static RawClass* function_class() { return function_class_; } | 251 static RawClass* function_class() { return function_class_; } |
| 251 static RawClass* field_class() { return field_class_; } | 252 static RawClass* field_class() { return field_class_; } |
| 252 static RawClass* token_stream_class() { return token_stream_class_; } | 253 static RawClass* token_stream_class() { return token_stream_class_; } |
| 253 static RawClass* script_class() { return script_class_; } | 254 static RawClass* script_class() { return script_class_; } |
| 254 static RawClass* library_class() { return library_class_; } | 255 static RawClass* library_class() { return library_class_; } |
| 255 static RawClass* library_prefix_class() { return library_prefix_class_; } | 256 static RawClass* library_prefix_class() { return library_prefix_class_; } |
| 256 static RawClass* code_class() { return code_class_; } | 257 static RawClass* code_class() { return code_class_; } |
| 257 static RawClass* instructions_class() { return instructions_class_; } | 258 static RawClass* instructions_class() { return instructions_class_; } |
| 258 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } | 259 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } |
| 260 static RawClass* var_descriptors_class() { return var_descriptors_class_; } |
| 259 static RawClass* exception_handlers_class() { | 261 static RawClass* exception_handlers_class() { |
| 260 return exception_handlers_class_; | 262 return exception_handlers_class_; |
| 261 } | 263 } |
| 262 static RawClass* context_class() { return context_class_; } | 264 static RawClass* context_class() { return context_class_; } |
| 263 static RawClass* context_scope_class() { return context_scope_class_; } | 265 static RawClass* context_scope_class() { return context_scope_class_; } |
| 264 static RawClass* api_error_class() { return api_error_class_; } | 266 static RawClass* api_error_class() { return api_error_class_; } |
| 265 | 267 |
| 266 static int GetSingletonClassIndex(const RawClass* raw_class); | 268 static int GetSingletonClassIndex(const RawClass* raw_class); |
| 267 static RawClass* GetSingletonClass(int index); | 269 static RawClass* GetSingletonClass(int index); |
| 268 static const char* GetSingletonClassName(int index); | 270 static const char* GetSingletonClassName(int index); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments. | 356 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments. |
| 355 static RawClass* function_class_; // Class of the Function vm object. | 357 static RawClass* function_class_; // Class of the Function vm object. |
| 356 static RawClass* field_class_; // Class of the Field vm object. | 358 static RawClass* field_class_; // Class of the Field vm object. |
| 357 static RawClass* token_stream_class_; // Class of the TokenStream vm object. | 359 static RawClass* token_stream_class_; // Class of the TokenStream vm object. |
| 358 static RawClass* script_class_; // Class of the Script vm object. | 360 static RawClass* script_class_; // Class of the Script vm object. |
| 359 static RawClass* library_class_; // Class of the Library vm object. | 361 static RawClass* library_class_; // Class of the Library vm object. |
| 360 static RawClass* library_prefix_class_; // Class of Library prefix vm object. | 362 static RawClass* library_prefix_class_; // Class of Library prefix vm object. |
| 361 static RawClass* code_class_; // Class of the Code vm object. | 363 static RawClass* code_class_; // Class of the Code vm object. |
| 362 static RawClass* instructions_class_; // Class of the Instructions vm object. | 364 static RawClass* instructions_class_; // Class of the Instructions vm object. |
| 363 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. | 365 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. |
| 366 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. |
| 364 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. | 367 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. |
| 365 static RawClass* context_class_; // Class of the Context vm object. | 368 static RawClass* context_class_; // Class of the Context vm object. |
| 366 static RawClass* context_scope_class_; // Class of ContextScope vm object. | 369 static RawClass* context_scope_class_; // Class of ContextScope vm object. |
| 367 static RawClass* api_error_class_; // Class of ApiError. | 370 static RawClass* api_error_class_; // Class of ApiError. |
| 368 | 371 |
| 369 friend class Class; | 372 friend class Class; |
| 370 friend class SnapshotReader; | 373 friend class SnapshotReader; |
| 371 | 374 |
| 372 // Disallow allocation. | 375 // Disallow allocation. |
| 373 void* operator new(size_t size); | 376 void* operator new(size_t size); |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 // the RawInstruction and RawCode objects, sets up the pointer offsets | 1738 // the RawInstruction and RawCode objects, sets up the pointer offsets |
| 1736 // and links the two in a GC safe manner. | 1739 // and links the two in a GC safe manner. |
| 1737 static RawInstructions* New(intptr_t size); | 1740 static RawInstructions* New(intptr_t size); |
| 1738 | 1741 |
| 1739 HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); | 1742 HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); |
| 1740 friend class Code; | 1743 friend class Code; |
| 1741 friend class Class; | 1744 friend class Class; |
| 1742 }; | 1745 }; |
| 1743 | 1746 |
| 1744 | 1747 |
| 1748 class LocalVarDescriptors : public Object { |
| 1749 public: |
| 1750 intptr_t Length() const; |
| 1751 |
| 1752 RawString* GetName(intptr_t var_index) const; |
| 1753 void GetRange(intptr_t var_index, |
| 1754 intptr_t* begin_token_pos, intptr_t* end_token_pos) const; |
| 1755 |
| 1756 void SetVar(intptr_t var_index, |
| 1757 const String& name, |
| 1758 intptr_t stack_slot, |
| 1759 intptr_t begin_pos, |
| 1760 intptr_t end_pos) const; |
| 1761 |
| 1762 static intptr_t InstanceSize() { |
| 1763 ASSERT(sizeof(RawLocalVarDescriptors) == |
| 1764 OFFSET_OF(RawLocalVarDescriptors, data_)); |
| 1765 return 0; |
| 1766 } |
| 1767 static intptr_t InstanceSize(intptr_t len) { |
| 1768 return RoundedAllocationSize( |
| 1769 sizeof(RawLocalVarDescriptors) + |
| 1770 (len * sizeof(RawLocalVarDescriptors::VarInfo))); |
| 1771 } |
| 1772 |
| 1773 static RawLocalVarDescriptors* New(intptr_t num_variables); |
| 1774 |
| 1775 private: |
| 1776 HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); |
| 1777 friend class Class; |
| 1778 }; |
| 1779 |
| 1780 |
| 1745 class PcDescriptors : public Object { | 1781 class PcDescriptors : public Object { |
| 1746 public: | 1782 public: |
| 1747 enum Kind { | 1783 enum Kind { |
| 1748 kDeopt = 0, // Deoptimization cotinuation point. | 1784 kDeopt = 0, // Deoptimization cotinuation point. |
| 1749 kPatchCode, // Buffer for patching code entry. | 1785 kPatchCode, // Buffer for patching code entry. |
| 1750 kIcCall, // IC call. | 1786 kIcCall, // IC call. |
| 1751 kOther | 1787 kOther |
| 1752 }; | 1788 }; |
| 1753 | 1789 |
| 1754 intptr_t Length() const; | 1790 intptr_t Length() const; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 return instr.size(); | 1935 return instr.size(); |
| 1900 } | 1936 } |
| 1901 | 1937 |
| 1902 RawPcDescriptors* pc_descriptors() const { | 1938 RawPcDescriptors* pc_descriptors() const { |
| 1903 return raw_ptr()->pc_descriptors_; | 1939 return raw_ptr()->pc_descriptors_; |
| 1904 } | 1940 } |
| 1905 void set_pc_descriptors(const PcDescriptors& descriptors) const { | 1941 void set_pc_descriptors(const PcDescriptors& descriptors) const { |
| 1906 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); | 1942 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); |
| 1907 } | 1943 } |
| 1908 | 1944 |
| 1945 RawLocalVarDescriptors* var_descriptors() const { |
| 1946 return raw_ptr()->var_descriptors_; |
| 1947 } |
| 1948 void set_var_descriptors(const LocalVarDescriptors& value) const { |
| 1949 StorePointer(&raw_ptr()->var_descriptors_, value.raw()); |
| 1950 } |
| 1951 |
| 1909 // See class ICData for interpretation of the 'ic_data_' array. | 1952 // See class ICData for interpretation of the 'ic_data_' array. |
| 1910 RawArray* ic_data() const; | 1953 RawArray* ic_data() const; |
| 1911 void set_ic_data(const Array& ic_data) const; | 1954 void set_ic_data(const Array& ic_data) const; |
| 1912 | 1955 |
| 1913 RawExceptionHandlers* exception_handlers() const { | 1956 RawExceptionHandlers* exception_handlers() const { |
| 1914 return raw_ptr()->exception_handlers_; | 1957 return raw_ptr()->exception_handlers_; |
| 1915 } | 1958 } |
| 1916 void set_exception_handlers(const ExceptionHandlers& handlers) const { | 1959 void set_exception_handlers(const ExceptionHandlers& handlers) const { |
| 1917 StorePointer(&raw_ptr()->exception_handlers_, handlers.raw()); | 1960 StorePointer(&raw_ptr()->exception_handlers_, handlers.raw()); |
| 1918 } | 1961 } |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3304 } | 3347 } |
| 3305 | 3348 |
| 3306 | 3349 |
| 3307 void Context::SetAt(intptr_t index, const Instance& value) const { | 3350 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 3308 StorePointer(InstanceAddr(index), value.raw()); | 3351 StorePointer(InstanceAddr(index), value.raw()); |
| 3309 } | 3352 } |
| 3310 | 3353 |
| 3311 } // namespace dart | 3354 } // namespace dart |
| 3312 | 3355 |
| 3313 #endif // VM_OBJECT_H_ | 3356 #endif // VM_OBJECT_H_ |
| OLD | NEW |