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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 kFunctionClass, | 145 kFunctionClass, |
146 kFieldClass, | 146 kFieldClass, |
147 kLiteralTokenClass, | 147 kLiteralTokenClass, |
148 kTokenStreamClass, | 148 kTokenStreamClass, |
149 kScriptClass, | 149 kScriptClass, |
150 kLibraryClass, | 150 kLibraryClass, |
151 kLibraryPrefixClass, | 151 kLibraryPrefixClass, |
152 kCodeClass, | 152 kCodeClass, |
153 kInstructionsClass, | 153 kInstructionsClass, |
154 kPcDescriptorsClass, | 154 kPcDescriptorsClass, |
155 kBitmapClass, | |
155 kLocalVarDescriptorsClass, | 156 kLocalVarDescriptorsClass, |
156 kExceptionHandlersClass, | 157 kExceptionHandlersClass, |
157 kContextClass, | 158 kContextClass, |
158 kContextScopeClass, | 159 kContextScopeClass, |
159 kICDataClass, | 160 kICDataClass, |
160 kApiErrorClass, | 161 kApiErrorClass, |
161 kLanguageErrorClass, | 162 kLanguageErrorClass, |
162 kUnhandledExceptionClass, | 163 kUnhandledExceptionClass, |
163 kUnwindErrorClass, | 164 kUnwindErrorClass, |
164 kMaxId, | 165 kMaxId, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 static RawClass* function_class() { return function_class_; } | 282 static RawClass* function_class() { return function_class_; } |
282 static RawClass* field_class() { return field_class_; } | 283 static RawClass* field_class() { return field_class_; } |
283 static RawClass* literal_token_class() { return literal_token_class_; } | 284 static RawClass* literal_token_class() { return literal_token_class_; } |
284 static RawClass* token_stream_class() { return token_stream_class_; } | 285 static RawClass* token_stream_class() { return token_stream_class_; } |
285 static RawClass* script_class() { return script_class_; } | 286 static RawClass* script_class() { return script_class_; } |
286 static RawClass* library_class() { return library_class_; } | 287 static RawClass* library_class() { return library_class_; } |
287 static RawClass* library_prefix_class() { return library_prefix_class_; } | 288 static RawClass* library_prefix_class() { return library_prefix_class_; } |
288 static RawClass* code_class() { return code_class_; } | 289 static RawClass* code_class() { return code_class_; } |
289 static RawClass* instructions_class() { return instructions_class_; } | 290 static RawClass* instructions_class() { return instructions_class_; } |
290 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } | 291 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } |
292 static RawClass* bitmap_class() { return bitmap_class_; } | |
291 static RawClass* var_descriptors_class() { return var_descriptors_class_; } | 293 static RawClass* var_descriptors_class() { return var_descriptors_class_; } |
292 static RawClass* exception_handlers_class() { | 294 static RawClass* exception_handlers_class() { |
293 return exception_handlers_class_; | 295 return exception_handlers_class_; |
294 } | 296 } |
295 static RawClass* context_class() { return context_class_; } | 297 static RawClass* context_class() { return context_class_; } |
296 static RawClass* context_scope_class() { return context_scope_class_; } | 298 static RawClass* context_scope_class() { return context_scope_class_; } |
297 static RawClass* api_error_class() { return api_error_class_; } | 299 static RawClass* api_error_class() { return api_error_class_; } |
298 static RawClass* language_error_class() { return language_error_class_; } | 300 static RawClass* language_error_class() { return language_error_class_; } |
299 static RawClass* unhandled_exception_class() { | 301 static RawClass* unhandled_exception_class() { |
300 return unhandled_exception_class_; | 302 return unhandled_exception_class_; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 static RawClass* function_class_; // Class of the Function vm object. | 390 static RawClass* function_class_; // Class of the Function vm object. |
389 static RawClass* field_class_; // Class of the Field vm object. | 391 static RawClass* field_class_; // Class of the Field vm object. |
390 static RawClass* literal_token_class_; // Class of LiteralToken vm object. | 392 static RawClass* literal_token_class_; // Class of LiteralToken vm object. |
391 static RawClass* token_stream_class_; // Class of the TokenStream vm object. | 393 static RawClass* token_stream_class_; // Class of the TokenStream vm object. |
392 static RawClass* script_class_; // Class of the Script vm object. | 394 static RawClass* script_class_; // Class of the Script vm object. |
393 static RawClass* library_class_; // Class of the Library vm object. | 395 static RawClass* library_class_; // Class of the Library vm object. |
394 static RawClass* library_prefix_class_; // Class of Library prefix vm object. | 396 static RawClass* library_prefix_class_; // Class of Library prefix vm object. |
395 static RawClass* code_class_; // Class of the Code vm object. | 397 static RawClass* code_class_; // Class of the Code vm object. |
396 static RawClass* instructions_class_; // Class of the Instructions vm object. | 398 static RawClass* instructions_class_; // Class of the Instructions vm object. |
397 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. | 399 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. |
400 static RawClass* bitmap_class_; // Class of BitMap vm object. | |
398 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. | 401 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. |
399 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. | 402 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. |
400 static RawClass* context_class_; // Class of the Context vm object. | 403 static RawClass* context_class_; // Class of the Context vm object. |
401 static RawClass* context_scope_class_; // Class of ContextScope vm object. | 404 static RawClass* context_scope_class_; // Class of ContextScope vm object. |
402 static RawClass* icdata_class_; // Class of ICData. | 405 static RawClass* icdata_class_; // Class of ICData. |
403 static RawClass* api_error_class_; // Class of ApiError. | 406 static RawClass* api_error_class_; // Class of ApiError. |
404 static RawClass* language_error_class_; // Class of LanguageError. | 407 static RawClass* language_error_class_; // Class of LanguageError. |
405 static RawClass* unhandled_exception_class_; // Class of UnhandledException. | 408 static RawClass* unhandled_exception_class_; // Class of UnhandledException. |
406 static RawClass* unwind_error_class_; // Class of UnwindError. | 409 static RawClass* unwind_error_class_; // Class of UnwindError. |
407 | 410 |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1977 } | 1980 } |
1978 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { | 1981 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { |
1979 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); | 1982 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); |
1980 } | 1983 } |
1981 | 1984 |
1982 HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); | 1985 HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); |
1983 friend class Class; | 1986 friend class Class; |
1984 }; | 1987 }; |
1985 | 1988 |
1986 | 1989 |
1990 class Bitmap : public Object { | |
1991 public: | |
1992 static const int32_t kNoMaximum = -1; | |
1993 static const int32_t kNoMinimum = -1; | |
1994 | |
1995 bool Get(int32_t bit_offset) const { | |
1996 return InRange(bit_offset) && GetBit(bit_offset); | |
1997 } | |
1998 | |
1999 // Return the bit offset of the highest bit set. | |
2000 int32_t Maximum() const; | |
srdjan
2012/03/14 17:31:32
intptr_t, here and elsewhere
siva
2012/03/14 22:54:20
Done.
| |
2001 | |
2002 // Return the bit offset of the lowest bit set. | |
2003 int32_t Minimum() const; | |
2004 | |
2005 static intptr_t InstanceSize() { | |
2006 ASSERT(sizeof(RawBitmap) == OFFSET_OF(RawBitmap, data_)); | |
2007 return 0; | |
2008 } | |
2009 static intptr_t InstanceSize(intptr_t size) { | |
2010 return RoundedAllocationSize(sizeof(RawBitmap) + (size * kWordSize)); | |
2011 } | |
2012 static RawBitmap* New(intptr_t size); | |
2013 | |
2014 private: | |
2015 inline int32_t Size() const; | |
srdjan
2012/03/14 17:31:32
SizeInBits?
siva
2012/03/14 22:54:20
Done.
| |
2016 | |
2017 bool InRange(int32_t offset) const { return offset < Size(); } | |
2018 | |
2019 bool GetBit(int32_t bit_offset) const; | |
2020 void SetBit(int32_t bit_offset, bool value) const; | |
2021 | |
2022 void set_size(int32_t value) const; | |
srdjan
2012/03/14 17:31:32
SetSizeInBits?
siva
2012/03/14 22:54:20
This size is not in bits it is just the size of th
| |
2023 | |
2024 HEAP_OBJECT_IMPLEMENTATION(Bitmap, Object); | |
2025 friend class Class; | |
2026 friend class BitmapBuilder; | |
2027 }; | |
2028 | |
2029 | |
1987 class ExceptionHandlers : public Object { | 2030 class ExceptionHandlers : public Object { |
1988 public: | 2031 public: |
1989 intptr_t Length() const; | 2032 intptr_t Length() const; |
1990 | 2033 |
1991 intptr_t TryIndex(intptr_t index) const; | 2034 intptr_t TryIndex(intptr_t index) const; |
1992 intptr_t HandlerPC(intptr_t index) const; | 2035 intptr_t HandlerPC(intptr_t index) const; |
1993 | 2036 |
1994 void SetHandlerEntry(intptr_t index, | 2037 void SetHandlerEntry(intptr_t index, |
1995 intptr_t try_index, | 2038 intptr_t try_index, |
1996 intptr_t handler_pc) const { | 2039 intptr_t handler_pc) const { |
(...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3827 } | 3870 } |
3828 ASSERT(obj.IsString()); // Must be an identifier. | 3871 ASSERT(obj.IsString()); // Must be an identifier. |
3829 return Token::kIDENT; | 3872 return Token::kIDENT; |
3830 } | 3873 } |
3831 | 3874 |
3832 | 3875 |
3833 void Context::SetAt(intptr_t index, const Instance& value) const { | 3876 void Context::SetAt(intptr_t index, const Instance& value) const { |
3834 StorePointer(InstanceAddr(index), value.raw()); | 3877 StorePointer(InstanceAddr(index), value.raw()); |
3835 } | 3878 } |
3836 | 3879 |
3880 | |
3881 int32_t Bitmap::Size() const { | |
3882 return (Smi::Value(raw_ptr()->size_) * kBitsPerByte); | |
3883 } | |
3884 | |
3837 } // namespace dart | 3885 } // namespace dart |
3838 | 3886 |
3839 #endif // VM_OBJECT_H_ | 3887 #endif // VM_OBJECT_H_ |
OLD | NEW |