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 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3686 | 3686 |
3687 // Returns true if the instance is a closure object. | 3687 // Returns true if the instance is a closure object. |
3688 bool IsClosure() const; | 3688 bool IsClosure() const; |
3689 | 3689 |
3690 // If the instance is a callable object, i.e. a closure or the instance of a | 3690 // If the instance is a callable object, i.e. a closure or the instance of a |
3691 // class implementing a 'call' method, return true and set the function | 3691 // class implementing a 'call' method, return true and set the function |
3692 // (if not NULL) to call and the context (if not NULL) to pass to the | 3692 // (if not NULL) to call and the context (if not NULL) to pass to the |
3693 // function. | 3693 // function. |
3694 bool IsCallable(Function* function, Context* context) const; | 3694 bool IsCallable(Function* function, Context* context) const; |
3695 | 3695 |
| 3696 // Evaluate the given expression as if it appeared in an instance |
| 3697 // method of this instance and return the resulting value, or an |
| 3698 // error object if evaluating the expression fails. |
| 3699 RawObject* Evaluate(const String& expr) const; |
| 3700 |
3696 static intptr_t InstanceSize() { | 3701 static intptr_t InstanceSize() { |
3697 return RoundedAllocationSize(sizeof(RawInstance)); | 3702 return RoundedAllocationSize(sizeof(RawInstance)); |
3698 } | 3703 } |
3699 | 3704 |
3700 static RawInstance* New(const Class& cls, Heap::Space space = Heap::kNew); | 3705 static RawInstance* New(const Class& cls, Heap::Space space = Heap::kNew); |
3701 | 3706 |
3702 private: | 3707 private: |
3703 RawObject** FieldAddrAtOffset(intptr_t offset) const { | 3708 RawObject** FieldAddrAtOffset(intptr_t offset) const { |
3704 ASSERT(IsValidFieldOffset(offset)); | 3709 ASSERT(IsValidFieldOffset(offset)); |
3705 return reinterpret_cast<RawObject**>(raw_value() - kHeapObjectTag + offset); | 3710 return reinterpret_cast<RawObject**>(raw_value() - kHeapObjectTag + offset); |
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6074 | 6079 |
6075 | 6080 |
6076 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6081 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6077 intptr_t index) { | 6082 intptr_t index) { |
6078 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6083 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6079 } | 6084 } |
6080 | 6085 |
6081 } // namespace dart | 6086 } // namespace dart |
6082 | 6087 |
6083 #endif // VM_OBJECT_H_ | 6088 #endif // VM_OBJECT_H_ |
OLD | NEW |