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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 VMHandles::AllocateHandle(zone)); | 847 VMHandles::AllocateHandle(zone)); |
848 obj->raw_ = raw_ptr; | 848 obj->raw_ = raw_ptr; |
849 obj->set_vtable(0); | 849 obj->set_vtable(0); |
850 return *obj; | 850 return *obj; |
851 } | 851 } |
852 // DEPRECATED - use Zone version. | 852 // DEPRECATED - use Zone version. |
853 static PassiveObject& Handle(Isolate* I, RawObject* raw_ptr) { | 853 static PassiveObject& Handle(Isolate* I, RawObject* raw_ptr) { |
854 return Handle(I->current_zone(), raw_ptr); | 854 return Handle(I->current_zone(), raw_ptr); |
855 } | 855 } |
856 static PassiveObject& Handle(RawObject* raw_ptr) { | 856 static PassiveObject& Handle(RawObject* raw_ptr) { |
857 return Handle(Isolate::Current(), raw_ptr); | 857 return Handle(Thread::Current()->zone(), raw_ptr); |
858 } | 858 } |
859 static PassiveObject& Handle() { | 859 static PassiveObject& Handle() { |
860 return Handle(Isolate::Current(), Object::null()); | 860 return Handle(Thread::Current()->zone(), Object::null()); |
861 } | 861 } |
862 static PassiveObject& Handle(Zone* zone) { | 862 static PassiveObject& Handle(Zone* zone) { |
863 return Handle(zone, Object::null()); | 863 return Handle(zone, Object::null()); |
864 } | 864 } |
865 // DEPRECATED - use Zone version. | 865 // DEPRECATED - use Zone version. |
866 static PassiveObject& Handle(Isolate* I) { | 866 static PassiveObject& Handle(Isolate* I) { |
867 return Handle(I, Object::null()); | 867 return Handle(I, Object::null()); |
868 } | 868 } |
869 static PassiveObject& ZoneHandle(Zone* zone, RawObject* raw_ptr) { | 869 static PassiveObject& ZoneHandle(Zone* zone, RawObject* raw_ptr) { |
870 PassiveObject* obj = reinterpret_cast<PassiveObject*>( | 870 PassiveObject* obj = reinterpret_cast<PassiveObject*>( |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 | 986 |
987 RawLibrary* library() const { return raw_ptr()->library_; } | 987 RawLibrary* library() const { return raw_ptr()->library_; } |
988 void set_library(const Library& value) const; | 988 void set_library(const Library& value) const; |
989 | 989 |
990 // The type parameters (and their bounds) are specified as an array of | 990 // The type parameters (and their bounds) are specified as an array of |
991 // TypeParameter. | 991 // TypeParameter. |
992 RawTypeArguments* type_parameters() const { | 992 RawTypeArguments* type_parameters() const { |
993 return raw_ptr()->type_parameters_; | 993 return raw_ptr()->type_parameters_; |
994 } | 994 } |
995 void set_type_parameters(const TypeArguments& value) const; | 995 void set_type_parameters(const TypeArguments& value) const; |
996 intptr_t NumTypeParameters(Isolate* isolate) const; | 996 intptr_t NumTypeParameters(Thread* thread) const; |
997 intptr_t NumTypeParameters() const { | 997 intptr_t NumTypeParameters() const { |
998 return NumTypeParameters(Isolate::Current()); | 998 return NumTypeParameters(Thread::Current()); |
999 } | 999 } |
1000 static intptr_t type_parameters_offset() { | 1000 static intptr_t type_parameters_offset() { |
1001 return OFFSET_OF(RawClass, type_parameters_); | 1001 return OFFSET_OF(RawClass, type_parameters_); |
1002 } | 1002 } |
1003 | 1003 |
1004 // Return a TypeParameter if the type_name is a type parameter of this class. | 1004 // Return a TypeParameter if the type_name is a type parameter of this class. |
1005 // Return null otherwise. | 1005 // Return null otherwise. |
1006 RawTypeParameter* LookupTypeParameter(const String& type_name) const; | 1006 RawTypeParameter* LookupTypeParameter(const String& type_name) const; |
1007 | 1007 |
1008 // The type argument vector is flattened and includes the type arguments of | 1008 // The type argument vector is flattened and includes the type arguments of |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 | 1324 |
1325 // Evaluate the given expression as if it appeared in a static | 1325 // Evaluate the given expression as if it appeared in a static |
1326 // method of this class and return the resulting value, or an | 1326 // method of this class and return the resulting value, or an |
1327 // error object if evaluating the expression fails. The method has | 1327 // error object if evaluating the expression fails. The method has |
1328 // the formal parameters given in param_names, and is invoked with | 1328 // the formal parameters given in param_names, and is invoked with |
1329 // the argument values given in param_values. | 1329 // the argument values given in param_values. |
1330 RawObject* Evaluate(const String& expr, | 1330 RawObject* Evaluate(const String& expr, |
1331 const Array& param_names, | 1331 const Array& param_names, |
1332 const Array& param_values) const; | 1332 const Array& param_values) const; |
1333 | 1333 |
1334 RawError* EnsureIsFinalized(Isolate* isolate) const; | 1334 RawError* EnsureIsFinalized(Thread* thread) const; |
1335 | 1335 |
1336 // Allocate a class used for VM internal objects. | 1336 // Allocate a class used for VM internal objects. |
1337 template <class FakeObject> static RawClass* New(); | 1337 template <class FakeObject> static RawClass* New(); |
1338 | 1338 |
1339 // Allocate instance classes. | 1339 // Allocate instance classes. |
1340 static RawClass* New(const String& name, | 1340 static RawClass* New(const String& name, |
1341 const Script& script, | 1341 const Script& script, |
1342 intptr_t token_pos); | 1342 intptr_t token_pos); |
1343 static RawClass* NewNativeWrapper(const Library& library, | 1343 static RawClass* NewNativeWrapper(const Library& library, |
1344 const String& name, | 1344 const String& name, |
(...skipping 6804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8149 | 8149 |
8150 | 8150 |
8151 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8151 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8152 intptr_t index) { | 8152 intptr_t index) { |
8153 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8153 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8154 } | 8154 } |
8155 | 8155 |
8156 } // namespace dart | 8156 } // namespace dart |
8157 | 8157 |
8158 #endif // VM_OBJECT_H_ | 8158 #endif // VM_OBJECT_H_ |
OLD | NEW |