| 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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 RawFunction::Kind kind) const; | 1043 RawFunction::Kind kind) const; |
| 1044 | 1044 |
| 1045 void Finalize() const; | 1045 void Finalize() const; |
| 1046 | 1046 |
| 1047 // Apply given patch class to this class. | 1047 // Apply given patch class to this class. |
| 1048 // Return true on success, or false and error otherwise. | 1048 // Return true on success, or false and error otherwise. |
| 1049 bool ApplyPatch(const Class& patch, Error* error) const; | 1049 bool ApplyPatch(const Class& patch, Error* error) const; |
| 1050 | 1050 |
| 1051 // Evaluate the given expression as if it appeared in a static | 1051 // Evaluate the given expression as if it appeared in a static |
| 1052 // method of this class and return the resulting value, or an | 1052 // method of this class and return the resulting value, or an |
| 1053 // error object if evaluating the expression fails. | 1053 // error object if evaluating the expression fails. The method has |
| 1054 RawObject* Evaluate(const String& expr) const; | 1054 // the formal parameters given in param_names, and is invoked with |
| 1055 // the argument values given in param_values. |
| 1056 RawObject* Evaluate(const String& expr, |
| 1057 const Array& param_names, |
| 1058 const Array& param_values) const; |
| 1055 | 1059 |
| 1056 RawError* EnsureIsFinalized(Isolate* isolate) const; | 1060 RawError* EnsureIsFinalized(Isolate* isolate) const; |
| 1057 | 1061 |
| 1058 // Allocate a class used for VM internal objects. | 1062 // Allocate a class used for VM internal objects. |
| 1059 template <class FakeObject> static RawClass* New(); | 1063 template <class FakeObject> static RawClass* New(); |
| 1060 | 1064 |
| 1061 // Allocate instance classes. | 1065 // Allocate instance classes. |
| 1062 static RawClass* New(const String& name, | 1066 static RawClass* New(const String& name, |
| 1063 const Script& script, | 1067 const Script& script, |
| 1064 intptr_t token_pos); | 1068 intptr_t token_pos); |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2535 return raw_ptr()->load_state_ == RawLibrary::kLoadError; | 2539 return raw_ptr()->load_state_ == RawLibrary::kLoadError; |
| 2536 } | 2540 } |
| 2537 void SetLoadError() const; | 2541 void SetLoadError() const; |
| 2538 | 2542 |
| 2539 static intptr_t InstanceSize() { | 2543 static intptr_t InstanceSize() { |
| 2540 return RoundedAllocationSize(sizeof(RawLibrary)); | 2544 return RoundedAllocationSize(sizeof(RawLibrary)); |
| 2541 } | 2545 } |
| 2542 | 2546 |
| 2543 static RawLibrary* New(const String& url); | 2547 static RawLibrary* New(const String& url); |
| 2544 | 2548 |
| 2545 RawObject* Evaluate(const String& expr) const; | 2549 // Evaluate the given expression as if it appeared in an top-level |
| 2550 // method of this library and return the resulting value, or an |
| 2551 // error object if evaluating the expression fails. The method has |
| 2552 // the formal parameters given in param_names, and is invoked with |
| 2553 // the argument values given in param_values. |
| 2554 RawObject* Evaluate(const String& expr, |
| 2555 const Array& param_names, |
| 2556 const Array& param_values) const; |
| 2546 | 2557 |
| 2547 // Library scope name dictionary. | 2558 // Library scope name dictionary. |
| 2548 // | 2559 // |
| 2549 // TODO(turnidge): The Lookup functions are not consistent in how | 2560 // TODO(turnidge): The Lookup functions are not consistent in how |
| 2550 // they deal with private names. Go through and make them a bit | 2561 // they deal with private names. Go through and make them a bit |
| 2551 // more regular. | 2562 // more regular. |
| 2552 void AddClass(const Class& cls) const; | 2563 void AddClass(const Class& cls) const; |
| 2553 void AddObject(const Object& obj, const String& name) const; | 2564 void AddObject(const Object& obj, const String& name) const; |
| 2554 void ReplaceObject(const Object& obj, const String& name) const; | 2565 void ReplaceObject(const Object& obj, const String& name) const; |
| 2555 RawObject* LookupReExport(const String& name) const; | 2566 RawObject* LookupReExport(const String& name) const; |
| (...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4055 bool IsClosure() const; | 4066 bool IsClosure() const; |
| 4056 | 4067 |
| 4057 // If the instance is a callable object, i.e. a closure or the instance of a | 4068 // If the instance is a callable object, i.e. a closure or the instance of a |
| 4058 // class implementing a 'call' method, return true and set the function | 4069 // class implementing a 'call' method, return true and set the function |
| 4059 // (if not NULL) to call and the context (if not NULL) to pass to the | 4070 // (if not NULL) to call and the context (if not NULL) to pass to the |
| 4060 // function. | 4071 // function. |
| 4061 bool IsCallable(Function* function, Context* context) const; | 4072 bool IsCallable(Function* function, Context* context) const; |
| 4062 | 4073 |
| 4063 // Evaluate the given expression as if it appeared in an instance | 4074 // Evaluate the given expression as if it appeared in an instance |
| 4064 // method of this instance and return the resulting value, or an | 4075 // method of this instance and return the resulting value, or an |
| 4065 // error object if evaluating the expression fails. | 4076 // error object if evaluating the expression fails. The method has |
| 4066 RawObject* Evaluate(const String& expr) const; | 4077 // the formal parameters given in param_names, and is invoked with |
| 4078 // the argument values given in param_values. |
| 4079 RawObject* Evaluate(const String& expr, |
| 4080 const Array& param_names, |
| 4081 const Array& param_values) const; |
| 4067 | 4082 |
| 4068 static intptr_t InstanceSize() { | 4083 static intptr_t InstanceSize() { |
| 4069 return RoundedAllocationSize(sizeof(RawInstance)); | 4084 return RoundedAllocationSize(sizeof(RawInstance)); |
| 4070 } | 4085 } |
| 4071 | 4086 |
| 4072 static RawInstance* New(const Class& cls, Heap::Space space = Heap::kNew); | 4087 static RawInstance* New(const Class& cls, Heap::Space space = Heap::kNew); |
| 4073 | 4088 |
| 4074 protected: | 4089 protected: |
| 4075 virtual void PrintSharedInstanceJSON(JSONObject* jsobj, bool ref) const; | 4090 virtual void PrintSharedInstanceJSON(JSONObject* jsobj, bool ref) const; |
| 4076 | 4091 |
| (...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6894 | 6909 |
| 6895 | 6910 |
| 6896 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6911 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6897 intptr_t index) { | 6912 intptr_t index) { |
| 6898 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6913 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6899 } | 6914 } |
| 6900 | 6915 |
| 6901 } // namespace dart | 6916 } // namespace dart |
| 6902 | 6917 |
| 6903 #endif // VM_OBJECT_H_ | 6918 #endif // VM_OBJECT_H_ |
| OLD | NEW |