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 3997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4008 }; | 4008 }; |
4009 | 4009 |
4010 | 4010 |
4011 class LanguageError : public Error { | 4011 class LanguageError : public Error { |
4012 public: | 4012 public: |
4013 enum Kind { | 4013 enum Kind { |
4014 kWarning, | 4014 kWarning, |
4015 kError, | 4015 kError, |
4016 kMalformedType, | 4016 kMalformedType, |
4017 kMalboundedType, | 4017 kMalboundedType, |
| 4018 kBailout, |
4018 }; | 4019 }; |
4019 | 4020 |
4020 Kind kind() const { return static_cast<Kind>(raw_ptr()->kind_); } | 4021 Kind kind() const { return static_cast<Kind>(raw_ptr()->kind_); } |
4021 | 4022 |
4022 // Build, cache, and return formatted message. | 4023 // Build, cache, and return formatted message. |
4023 RawString* FormatMessage() const; | 4024 RawString* FormatMessage() const; |
4024 | 4025 |
4025 static intptr_t InstanceSize() { | 4026 static intptr_t InstanceSize() { |
4026 return RoundedAllocationSize(sizeof(RawLanguageError)); | 4027 return RoundedAllocationSize(sizeof(RawLanguageError)); |
4027 } | 4028 } |
4028 | 4029 |
4029 // A null script means no source and a negative token_pos means no position. | 4030 // A null script means no source and a negative token_pos means no position. |
4030 static RawLanguageError* NewFormatted(const Error& prev_error, | 4031 static RawLanguageError* NewFormatted(const Error& prev_error, |
4031 const Script& script, | 4032 const Script& script, |
4032 intptr_t token_pos, | 4033 intptr_t token_pos, |
4033 Kind kind, | 4034 Kind kind, |
4034 Heap::Space space, | 4035 Heap::Space space, |
4035 const char* format, ...) | 4036 const char* format, ...) |
4036 PRINTF_ATTRIBUTE(6, 7); | 4037 PRINTF_ATTRIBUTE(6, 7); |
4037 | 4038 |
4038 static RawLanguageError* NewFormattedV(const Error& prev_error, | 4039 static RawLanguageError* NewFormattedV(const Error& prev_error, |
4039 const Script& script, | 4040 const Script& script, |
4040 intptr_t token_pos, | 4041 intptr_t token_pos, |
4041 Kind kind, | 4042 Kind kind, |
4042 Heap::Space space, | 4043 Heap::Space space, |
4043 const char* format, va_list args); | 4044 const char* format, va_list args); |
4044 | 4045 |
4045 static RawLanguageError* New(const String& formatted_message, | 4046 static RawLanguageError* New(const String& formatted_message, |
| 4047 Kind kind = kError, |
4046 Heap::Space space = Heap::kNew); | 4048 Heap::Space space = Heap::kNew); |
4047 | 4049 |
4048 virtual const char* ToErrorCString() const; | 4050 virtual const char* ToErrorCString() const; |
4049 | 4051 |
4050 private: | 4052 private: |
4051 RawError* previous_error() const { | 4053 RawError* previous_error() const { |
4052 return raw_ptr()->previous_error_; | 4054 return raw_ptr()->previous_error_; |
4053 } | 4055 } |
4054 void set_previous_error(const Error& value) const; | 4056 void set_previous_error(const Error& value) const; |
4055 | 4057 |
(...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6863 }; | 6865 }; |
6864 | 6866 |
6865 | 6867 |
6866 class UserTag : public Instance { | 6868 class UserTag : public Instance { |
6867 public: | 6869 public: |
6868 uword tag() const { return raw_ptr()->tag(); } | 6870 uword tag() const { return raw_ptr()->tag(); } |
6869 void set_tag(uword t) const { | 6871 void set_tag(uword t) const { |
6870 ASSERT(t >= UserTags::kUserTagIdOffset); | 6872 ASSERT(t >= UserTags::kUserTagIdOffset); |
6871 ASSERT(t < UserTags::kUserTagIdOffset + UserTags::kMaxUserTags); | 6873 ASSERT(t < UserTags::kUserTagIdOffset + UserTags::kMaxUserTags); |
6872 raw_ptr()->tag_ = t; | 6874 raw_ptr()->tag_ = t; |
6873 }; | 6875 } |
6874 static intptr_t tag_offset() { return OFFSET_OF(RawUserTag, tag_); } | 6876 static intptr_t tag_offset() { return OFFSET_OF(RawUserTag, tag_); } |
6875 | 6877 |
6876 RawString* label() const { | 6878 RawString* label() const { |
6877 return raw_ptr()->label_; | 6879 return raw_ptr()->label_; |
6878 } | 6880 } |
6879 | 6881 |
6880 void MakeActive() const; | 6882 void MakeActive() const; |
6881 | 6883 |
6882 static intptr_t InstanceSize() { | 6884 static intptr_t InstanceSize() { |
6883 return RoundedAllocationSize(sizeof(RawUserTag)); | 6885 return RoundedAllocationSize(sizeof(RawUserTag)); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7036 | 7038 |
7037 | 7039 |
7038 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7040 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7039 intptr_t index) { | 7041 intptr_t index) { |
7040 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7042 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7041 } | 7043 } |
7042 | 7044 |
7043 } // namespace dart | 7045 } // namespace dart |
7044 | 7046 |
7045 #endif // VM_OBJECT_H_ | 7047 #endif // VM_OBJECT_H_ |
OLD | NEW |