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 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 bool IsValidNativeIndex(int index) const { | 3183 bool IsValidNativeIndex(int index) const { |
3184 return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_)); | 3184 return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_)); |
3185 } | 3185 } |
3186 | 3186 |
3187 inline intptr_t GetNativeField(Isolate* isolate, int index) const; | 3187 inline intptr_t GetNativeField(Isolate* isolate, int index) const; |
3188 void SetNativeField(int index, intptr_t value) const; | 3188 void SetNativeField(int index, intptr_t value) const; |
3189 | 3189 |
3190 // Returns true if the instance is a closure object. | 3190 // Returns true if the instance is a closure object. |
3191 bool IsClosure() const; | 3191 bool IsClosure() const; |
3192 | 3192 |
| 3193 // If the instance is a callable object, i.e. a closure or the instance of a |
| 3194 // class implementing a 'call' method, return true and set the function |
| 3195 // (if not NULL) to call and the context (if not NULL) to pass to the |
| 3196 // function. |
| 3197 bool IsCallable(Function* function, Context* context) const; |
| 3198 |
3193 static intptr_t InstanceSize() { | 3199 static intptr_t InstanceSize() { |
3194 return RoundedAllocationSize(sizeof(RawInstance)); | 3200 return RoundedAllocationSize(sizeof(RawInstance)); |
3195 } | 3201 } |
3196 | 3202 |
3197 static RawInstance* New(const Class& cls, Heap::Space space = Heap::kNew); | 3203 static RawInstance* New(const Class& cls, Heap::Space space = Heap::kNew); |
3198 | 3204 |
3199 private: | 3205 private: |
3200 RawObject** FieldAddrAtOffset(intptr_t offset) const { | 3206 RawObject** FieldAddrAtOffset(intptr_t offset) const { |
3201 ASSERT(IsValidFieldOffset(offset)); | 3207 ASSERT(IsValidFieldOffset(offset)); |
3202 return reinterpret_cast<RawObject**>(raw_value() - kHeapObjectTag + offset); | 3208 return reinterpret_cast<RawObject**>(raw_value() - kHeapObjectTag + offset); |
(...skipping 2965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6168 | 6174 |
6169 | 6175 |
6170 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6176 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6171 intptr_t index) { | 6177 intptr_t index) { |
6172 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6178 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6173 } | 6179 } |
6174 | 6180 |
6175 } // namespace dart | 6181 } // namespace dart |
6176 | 6182 |
6177 #endif // VM_OBJECT_H_ | 6183 #endif // VM_OBJECT_H_ |
OLD | NEW |