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 13 matching lines...) Expand all Loading... |
24 // Forward declarations. | 24 // Forward declarations. |
25 #define DEFINE_FORWARD_DECLARATION(clazz) \ | 25 #define DEFINE_FORWARD_DECLARATION(clazz) \ |
26 class clazz; | 26 class clazz; |
27 CLASS_LIST(DEFINE_FORWARD_DECLARATION) | 27 CLASS_LIST(DEFINE_FORWARD_DECLARATION) |
28 #undef DEFINE_FORWARD_DECLARATION | 28 #undef DEFINE_FORWARD_DECLARATION |
29 class Api; | 29 class Api; |
30 class ArgumentsDescriptor; | 30 class ArgumentsDescriptor; |
31 class Assembler; | 31 class Assembler; |
32 class Closure; | 32 class Closure; |
33 class Code; | 33 class Code; |
| 34 class DisassemblyFormatter; |
34 class DeoptInstr; | 35 class DeoptInstr; |
35 class FinalizablePersistentHandle; | 36 class FinalizablePersistentHandle; |
36 class LocalScope; | 37 class LocalScope; |
37 class ReusableHandleScope; | 38 class ReusableHandleScope; |
38 class ReusableObjectHandleScope; | 39 class ReusableObjectHandleScope; |
39 class Symbols; | 40 class Symbols; |
40 | 41 |
41 #if defined(DEBUG) | 42 #if defined(DEBUG) |
42 #define CHECK_HANDLE() CheckHandle(); | 43 #define CHECK_HANDLE() CheckHandle(); |
43 #else | 44 #else |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 // by offset in words. | 885 // by offset in words. |
885 RawArray* OffsetToFieldMap() const; | 886 RawArray* OffsetToFieldMap() const; |
886 | 887 |
887 // Returns true if non-static fields are defined. | 888 // Returns true if non-static fields are defined. |
888 bool HasInstanceFields() const; | 889 bool HasInstanceFields() const; |
889 | 890 |
890 RawArray* functions() const { return raw_ptr()->functions_; } | 891 RawArray* functions() const { return raw_ptr()->functions_; } |
891 void SetFunctions(const Array& value) const; | 892 void SetFunctions(const Array& value) const; |
892 void AddFunction(const Function& function) const; | 893 void AddFunction(const Function& function) const; |
893 intptr_t FindFunctionIndex(const Function& function) const; | 894 intptr_t FindFunctionIndex(const Function& function) const; |
| 895 intptr_t FindImplicitClosureFunctionIndex(const Function& needle) const; |
| 896 intptr_t FindInvocationDispatcherFunctionIndex(const Function& needle) const; |
894 | 897 |
895 RawGrowableObjectArray* closures() const { | 898 RawGrowableObjectArray* closures() const { |
896 return raw_ptr()->closure_functions_; | 899 return raw_ptr()->closure_functions_; |
897 } | 900 } |
898 void AddClosureFunction(const Function& function) const; | 901 void AddClosureFunction(const Function& function) const; |
899 RawFunction* LookupClosureFunction(intptr_t token_pos) const; | 902 RawFunction* LookupClosureFunction(intptr_t token_pos) const; |
900 intptr_t FindClosureIndex(intptr_t token_pos) const; | 903 intptr_t FindClosureIndex(const Function& function) const; |
901 | 904 |
902 RawFunction* LookupDynamicFunction(const String& name) const; | 905 RawFunction* LookupDynamicFunction(const String& name) const; |
903 RawFunction* LookupDynamicFunctionAllowPrivate(const String& name) const; | 906 RawFunction* LookupDynamicFunctionAllowPrivate(const String& name) const; |
904 RawFunction* LookupStaticFunction(const String& name) const; | 907 RawFunction* LookupStaticFunction(const String& name) const; |
905 RawFunction* LookupStaticFunctionAllowPrivate(const String& name) const; | 908 RawFunction* LookupStaticFunctionAllowPrivate(const String& name) const; |
906 RawFunction* LookupConstructor(const String& name) const; | 909 RawFunction* LookupConstructor(const String& name) const; |
907 RawFunction* LookupConstructorAllowPrivate(const String& name) const; | 910 RawFunction* LookupConstructorAllowPrivate(const String& name) const; |
908 RawFunction* LookupFactory(const String& name) const; | 911 RawFunction* LookupFactory(const String& name) const; |
909 RawFunction* LookupFunction(const String& name) const; | 912 RawFunction* LookupFunction(const String& name) const; |
910 RawFunction* LookupFunctionAllowPrivate(const String& name) const; | 913 RawFunction* LookupFunctionAllowPrivate(const String& name) const; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 raw_ptr()->num_native_fields_ = value; | 990 raw_ptr()->num_native_fields_ = value; |
988 } | 991 } |
989 | 992 |
990 RawCode* allocation_stub() const { | 993 RawCode* allocation_stub() const { |
991 return raw_ptr()->allocation_stub_; | 994 return raw_ptr()->allocation_stub_; |
992 } | 995 } |
993 void set_allocation_stub(const Code& value) const; | 996 void set_allocation_stub(const Code& value) const; |
994 | 997 |
995 RawArray* constants() const; | 998 RawArray* constants() const; |
996 | 999 |
| 1000 RawFunction* InvocationDispatcherFunctionFromIndex(intptr_t idx) const; |
| 1001 |
997 RawFunction* GetInvocationDispatcher(const String& target_name, | 1002 RawFunction* GetInvocationDispatcher(const String& target_name, |
998 const Array& args_desc, | 1003 const Array& args_desc, |
999 RawFunction::Kind kind) const; | 1004 RawFunction::Kind kind) const; |
1000 | 1005 |
1001 void Finalize() const; | 1006 void Finalize() const; |
1002 | 1007 |
1003 // Apply given patch class to this class. | 1008 // Apply given patch class to this class. |
1004 // Return true on success, or false and error otherwise. | 1009 // Return true on success, or false and error otherwise. |
1005 bool ApplyPatch(const Class& patch, Error* error) const; | 1010 bool ApplyPatch(const Class& patch, Error* error) const; |
1006 | 1011 |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 void SetRedirectionType(const Type& type) const; | 1597 void SetRedirectionType(const Type& type) const; |
1593 RawString* RedirectionIdentifier() const; | 1598 RawString* RedirectionIdentifier() const; |
1594 void SetRedirectionIdentifier(const String& identifier) const; | 1599 void SetRedirectionIdentifier(const String& identifier) const; |
1595 RawFunction* RedirectionTarget() const; | 1600 RawFunction* RedirectionTarget() const; |
1596 void SetRedirectionTarget(const Function& target) const; | 1601 void SetRedirectionTarget(const Function& target) const; |
1597 | 1602 |
1598 RawFunction::Kind kind() const { | 1603 RawFunction::Kind kind() const { |
1599 return KindBits::decode(raw_ptr()->kind_tag_); | 1604 return KindBits::decode(raw_ptr()->kind_tag_); |
1600 } | 1605 } |
1601 | 1606 |
| 1607 static const char* KindToCString(RawFunction::Kind kind); |
| 1608 |
1602 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_tag_); } | 1609 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_tag_); } |
1603 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_tag_); } | 1610 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_tag_); } |
1604 bool is_external() const { return ExternalBit::decode(raw_ptr()->kind_tag_); } | 1611 bool is_external() const { return ExternalBit::decode(raw_ptr()->kind_tag_); } |
1605 bool IsConstructor() const { | 1612 bool IsConstructor() const { |
1606 return (kind() == RawFunction::kConstructor) && !is_static(); | 1613 return (kind() == RawFunction::kConstructor) && !is_static(); |
1607 } | 1614 } |
1608 bool IsImplicitConstructor() const; | 1615 bool IsImplicitConstructor() const; |
1609 bool IsFactory() const { | 1616 bool IsFactory() const { |
1610 return (kind() == RawFunction::kConstructor) && is_static(); | 1617 return (kind() == RawFunction::kConstructor) && is_static(); |
1611 } | 1618 } |
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 RawDeoptInfo* GetDeoptInfoAtPc(uword pc, intptr_t* deopt_reason) const; | 3243 RawDeoptInfo* GetDeoptInfoAtPc(uword pc, intptr_t* deopt_reason) const; |
3237 | 3244 |
3238 // Returns null if there is no static call at 'pc'. | 3245 // Returns null if there is no static call at 'pc'. |
3239 RawFunction* GetStaticCallTargetFunctionAt(uword pc) const; | 3246 RawFunction* GetStaticCallTargetFunctionAt(uword pc) const; |
3240 // Returns null if there is no static call at 'pc'. | 3247 // Returns null if there is no static call at 'pc'. |
3241 RawCode* GetStaticCallTargetCodeAt(uword pc) const; | 3248 RawCode* GetStaticCallTargetCodeAt(uword pc) const; |
3242 // Aborts if there is no static call at 'pc'. | 3249 // Aborts if there is no static call at 'pc'. |
3243 void SetStaticCallTargetCodeAt(uword pc, const Code& code) const; | 3250 void SetStaticCallTargetCodeAt(uword pc, const Code& code) const; |
3244 | 3251 |
3245 void Disassemble() const; | 3252 void Disassemble() const; |
| 3253 void Disassemble(DisassemblyFormatter* formatter) const; |
3246 | 3254 |
3247 class Comments : public ZoneAllocated { | 3255 class Comments : public ZoneAllocated { |
3248 public: | 3256 public: |
3249 static Comments& New(intptr_t count); | 3257 static Comments& New(intptr_t count); |
3250 | 3258 |
3251 intptr_t Length() const; | 3259 intptr_t Length() const; |
3252 | 3260 |
3253 void SetPCOffsetAt(intptr_t idx, intptr_t pc_offset); | 3261 void SetPCOffsetAt(intptr_t idx, intptr_t pc_offset); |
3254 void SetCommentAt(intptr_t idx, const String& comment); | 3262 void SetCommentAt(intptr_t idx, const String& comment); |
3255 | 3263 |
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6571 | 6579 |
6572 | 6580 |
6573 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6581 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6574 intptr_t index) { | 6582 intptr_t index) { |
6575 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6583 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6576 } | 6584 } |
6577 | 6585 |
6578 } // namespace dart | 6586 } // namespace dart |
6579 | 6587 |
6580 #endif // VM_OBJECT_H_ | 6588 #endif // VM_OBJECT_H_ |
OLD | NEW |